1#include <stdio.h>
2#include <stdint.h>
3
4// This simple program is to test the lldb Python API related to process.
5
6static char my_char = 'u';
7char my_cstring[] = "lldb.SBProcess.ReadCStringFromMemory() works!";
8char *my_char_ptr = (char *)"Does it work?";
9uint32_t my_uint32 = 12345;
10int my_int = 0;
11
12int main (int argc, char const *argv[])
13{
14 for (int i = 0; i < 3; ++i) {
15 printf(format: "my_char='%c'\n", my_char);
16 ++my_char;
17 }
18
19 printf(format: "after the loop: my_char='%c'\n", my_char); // 'my_char' should print out as 'x'.
20
21 return 0; // Set break point at this line and check variable 'my_char'.
22 // Use lldb Python API to set memory content for my_int and check the result.
23}
24
25char test_read (char *ptr)
26{
27 return *ptr;
28}
29
30void test_write (char *ptr, char c)
31{
32 *ptr = c;
33}
34

source code of lldb/test/API/python_api/process/main.cpp