xref: /llvm-project/lldb/test/API/python_api/process/main.cpp (revision 99451b4453688a94c6014cac233d371ab4cc342d)
1 //===-- main.c --------------------------------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 #include <stdio.h>
9 #include <stdint.h>
10 
11 // This simple program is to test the lldb Python API related to process.
12 
13 char my_char = 'u';
14 char my_cstring[] = "lldb.SBProcess.ReadCStringFromMemory() works!";
15 char *my_char_ptr = (char *)"Does it work?";
16 uint32_t my_uint32 = 12345;
17 int my_int = 0;
18 
19 int main (int argc, char const *argv[])
20 {
21     for (int i = 0; i < 3; ++i) {
22         printf("my_char='%c'\n", my_char);
23         ++my_char;
24     }
25 
26     printf("after the loop: my_char='%c'\n", my_char); // 'my_char' should print out as 'x'.
27 
28     return 0; // Set break point at this line and check variable 'my_char'.
29               // Use lldb Python API to set memory content for my_int and check the result.
30 }
31