diff options
author | Djordje Todorovic <djordje.todorovic@rt-rk.com> | 2019-11-21 11:07:39 +0100 |
---|---|---|
committer | Djordje Todorovic <djordje.todorovic@rt-rk.com> | 2019-12-03 11:01:45 +0100 |
commit | 4cfceb910692f9e894622da1b394324503667e46 (patch) | |
tree | 695ffafb2543d29dcba719f53f08faa89187ec05 /lldb/packages/Python/lldbsuite/test | |
parent | 6d18e5366c9a0bffe45b179a830483b3f2ec9fa9 (diff) | |
download | bcm5719-llvm-4cfceb910692f9e894622da1b394324503667e46.tar.gz bcm5719-llvm-4cfceb910692f9e894622da1b394324503667e46.zip |
[LiveDebugValues] Introduce entry values of unmodified params
The idea is to remove front-end analysis for the parameter's value
modification and leave it to the value tracking system. Front-end in some
cases marks a parameter as modified even the line of code that modifies the
parameter gets optimized, that implies that this will cover more entry
values even. In addition, extending the support for modified parameters
will be easier with this approach.
Since the goal is to recognize if a parameter’s value has changed, the idea
at very high level is: If we encounter a DBG_VALUE other than the entry
value one describing the same variable (parameter), we can assume that the
variable’s value has changed and we should not track its entry value any
more. That would be ideal scenario, but due to various LLVM optimizations,
a variable’s value could be just moved around from one register to another
(and there will be additional DBG_VALUEs describing the same variable), so
we have to recognize such situation (otherwise, we will lose a lot of entry
values) and salvage the debug entry value.
Differential Revision: https://reviews.llvm.org/D68209
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test')
2 files changed, 59 insertions, 15 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/param_entry_vals/basic_entry_values_x86_64/TestBasicEntryValuesX86_64.py b/lldb/packages/Python/lldbsuite/test/functionalities/param_entry_vals/basic_entry_values_x86_64/TestBasicEntryValuesX86_64.py index 1192c2b672f..e0285e6d626 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/param_entry_vals/basic_entry_values_x86_64/TestBasicEntryValuesX86_64.py +++ b/lldb/packages/Python/lldbsuite/test/functionalities/param_entry_vals/basic_entry_values_x86_64/TestBasicEntryValuesX86_64.py @@ -6,8 +6,7 @@ supported_platforms = ["linux"] supported_platforms.extend(lldbplatformutil.getDarwinOSTriples()) lldbinline.MakeInlineTest(__file__, globals(), - [decorators.skipIf(bugnumber="llvm.org/pr44059"), - decorators.skipUnlessPlatform(supported_platforms), + [decorators.skipUnlessPlatform(supported_platforms), decorators.skipIf(compiler="clang", compiler_version=['<', '10.0']), decorators.skipUnlessArch('x86_64'), decorators.skipUnlessHasCallSiteInfo, diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/param_entry_vals/basic_entry_values_x86_64/main.cpp b/lldb/packages/Python/lldbsuite/test/functionalities/param_entry_vals/basic_entry_values_x86_64/main.cpp index ff72a81c6b2..9aac6e94783 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/param_entry_vals/basic_entry_values_x86_64/main.cpp +++ b/lldb/packages/Python/lldbsuite/test/functionalities/param_entry_vals/basic_entry_values_x86_64/main.cpp @@ -18,6 +18,14 @@ template<typename T> __attribute__((noinline)) void use(T x) { /* Clobbers */ : "rsi" \ ); +// Destroy %rbx in the current frame. +#define DESTROY_RBX \ + asm volatile ("xorq %%rbx, %%rbx" \ + /* Outputs */ : \ + /* Inputs */ : \ + /* Clobbers */ : "rbx" \ + ); + struct S1 { int field1 = 123; int *field2 = &field1; @@ -30,10 +38,17 @@ void func1(int &sink, int x) { // Destroy 'x' in the current frame. DESTROY_RSI; - //% self.filecheck("image lookup -va $pc", "main.cpp", "-check-prefix=FUNC1-DESC") - // FUNC1-DESC: name = "x", type = "int", location = DW_OP_entry_value(DW_OP_reg4 RSI) + // NOTE: Currently, we do not generate DW_OP_entry_value for the 'x', + // since it gets copied into a register that is not callee saved, + // and we can not guarantee that its value has not changed. ++sink; + + // Destroy 'sink' in the current frame. + DESTROY_RBX; + + //% self.filecheck("image lookup -va $pc", "main.cpp", "-check-prefix=FUNC1-DESC") + // FUNC1-DESC: name = "sink", type = "int &", location = DW_OP_entry_value(DW_OP_reg5 RDI) } __attribute__((noinline)) @@ -43,10 +58,16 @@ void func2(int &sink, int x) { // Destroy 'x' in the current frame. DESTROY_RSI; - //% self.filecheck("expr x", "main.cpp", "-check-prefix=FUNC2-EXPR") - // FUNC2-EXPR: (int) ${{.*}} = 123 + //% self.filecheck("expr x", "main.cpp", "-check-prefix=FUNC2-EXPR-FAIL", expect_cmd_failure=True) + // FUNC2-EXPR-FAIL: couldn't get the value of variable x: variable not available ++sink; + + // Destroy 'sink' in the current frame. + DESTROY_RBX; + + //% self.filecheck("expr sink", "main.cpp", "-check-prefix=FUNC2-EXPR") + // FUNC2-EXPR: ${{.*}} = 2 } __attribute__((noinline)) @@ -69,10 +90,16 @@ void func4_amb(int &sink, int x) { // Destroy 'x' in the current frame. DESTROY_RSI; - //% self.filecheck("expr x", "main.cpp", "-check-prefix=FUNC4-EXPR", expect_cmd_failure=True) - // FUNC4-EXPR: couldn't get the value of variable x: Could not evaluate DW_OP_entry_value. + //% self.filecheck("expr x", "main.cpp", "-check-prefix=FUNC4-EXPR-FAIL", expect_cmd_failure=True) + // FUNC4-EXPR-FAIL: couldn't get the value of variable x: variable not available ++sink; + + // Destroy 'sink' in the current frame. + DESTROY_RBX; + + //% self.filecheck("expr sink", "main.cpp", "-check-prefix=FUNC4-EXPR", expect_cmd_failure=True) + // FUNC4-EXPR: couldn't get the value of variable sink: Could not evaluate DW_OP_entry_value. } __attribute__((noinline)) @@ -98,10 +125,16 @@ void func7(int &sink, int x) { // Destroy 'x' in the current frame. DESTROY_RSI; - //% self.filecheck("expr x", "main.cpp", "-check-prefix=FUNC7-EXPR") - // FUNC7-EXPR: (int) ${{.*}} = 123 + //% self.filecheck("expr x", "main.cpp", "-check-prefix=FUNC7-EXPR-FAIL", expect_cmd_failure=True) + // FUNC7-EXPR-FAIL: couldn't get the value of variable x: variable not available ++sink; + + // Destroy 'sink' in the current frame. + DESTROY_RBX; + + //% self.filecheck("expr sink", "main.cpp", "-check-prefix=FUNC7-EXPR") + // FUNC7-EXPR: ${{.*}} = 4 } __attribute__((always_inline)) @@ -129,10 +162,16 @@ void func11_tailcalled(int &sink, int x) { // Destroy 'x' in the current frame. DESTROY_RSI; - //% self.filecheck("expr x", "main.cpp", "-check-prefix=FUNC11-EXPR") - // FUNC11-EXPR: (int) ${{.*}} = 123 + //% self.filecheck("expr x", "main.cpp", "-check-prefix=FUNC11-EXPR-FAIL", expect_cmd_failure=True) + // FUNC11-EXPR-FAIL: couldn't get the value of variable x: variable not available ++sink; + + // Destroy 'sink' in the current frame. + DESTROY_RBX; + + //% self.filecheck("expr sink", "main.cpp", "-check-prefix=FUNC11-EXPR") + // FUNC11-EXPR: ${{.*}} = 5 } __attribute__((noinline)) @@ -150,10 +189,16 @@ void func13(int &sink, int x) { // Destroy 'x' in the current frame. DESTROY_RSI; - //% self.filecheck("expr x", "main.cpp", "-check-prefix=FUNC13-EXPR") - // FUNC13-EXPR: (int) ${{.*}} = 123 + //% self.filecheck("expr x", "main.cpp", "-check-prefix=FUNC13-EXPR-FAIL", expect_cmd_failure=True) + // FUNC13-EXPR-FAIL: couldn't get the value of variable x: variable not available - ++sink; + use(sink); + + // Destroy 'sink' in the current frame. + DESTROY_RBX; + + //% self.filecheck("expr sink", "main.cpp", "-check-prefix=FUNC13-EXPR") + // FUNC13-EXPR: ${{.*}} = 5 } __attribute__((noinline, disable_tail_calls)) |