Files
clang-p2996/lldb/test/API/tools/lldb-vscode/optimized/main.cpp
Pavel Labath 88ac9138f4 [lldb] Try harder to optimize away a test variable
The test was checking that we can print an error message when a variable
is optimized away, but the optimizer got smarter (D140404) in tracking
the variable's value (so that we were not able to recover its value).

Using a value in an argument registers (argc) makes it more likely to be
overwritten by subsequent function calls (and permanently lost).
2023-02-02 11:24:47 +01:00

15 lines
310 B
C++

#include <stdio.h>
#include <string>
int foo(int x, int y) {
printf("Got input %d, %d\n", x, y);
return x + y + 3; // breakpoint 1
}
int main(int argc, char const *argv[]) {
printf("argc: %d\n", argc);
int result = foo(20, argv[0][0]);
printf("result: %d\n", result); // breakpoint 2
return 0;
}