[Lldb-commits] [lldb] ecc6c42 - [lldb/testsuite] Fix TestInlineStepping on arm64 with newer compilers

Fred Riss via lldb-commits lldb-commits at lists.llvm.org
Thu Mar 19 08:27:06 PDT 2020


Author: Fred Riss
Date: 2020-03-19T08:25:59-07:00
New Revision: ecc6c426977f59f69b683d67ceb3157fb694ce09

URL: https://github.com/llvm/llvm-project/commit/ecc6c426977f59f69b683d67ceb3157fb694ce09
DIFF: https://github.com/llvm/llvm-project/commit/ecc6c426977f59f69b683d67ceb3157fb694ce09.diff

LOG: [lldb/testsuite] Fix TestInlineStepping on arm64 with newer compilers

Summary:
TestInlineStepping tests LLDB's ability to step in the presence of
inline frames. The testcase source has a number of functions and some
of them are marked `always_inline`.

The test is built around the assumption that the inline function will
be fully represented once inlined, but this is not true with the
current arm64 code generation. For example:

void caller() {
     always_inline_function(); // Step here
}

When stppeing into `caller()` above, you might immediatly end up in
the inlines frame for `always_inline_function()`, because there might
literally be no code associated with `caller()` itself.

This patch hacks around the issue by adding an `asm volatile("nop")`
on some lines with inlined calls where we expect to be able to
step. Like so:

void caller() {
     asm volatile("nop"); always_inline_function(); // Step here
}

This guarantees there is always going to be one instruction for this
line in the caller.

Reviewers: labath, jingham

Subscribers: kristof.beyls, danielkiss, lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D76406

Added: 
    

Modified: 
    lldb/test/API/functionalities/inline-stepping/calling.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/test/API/functionalities/inline-stepping/calling.cpp b/lldb/test/API/functionalities/inline-stepping/calling.cpp
index 9982fbf42734..49179ce7c978 100644
--- a/lldb/test/API/functionalities/inline-stepping/calling.cpp
+++ b/lldb/test/API/functionalities/inline-stepping/calling.cpp
@@ -75,7 +75,7 @@ caller_trivial_1 ()
 void
 caller_trivial_2 ()
 {
-    inline_trivial_1 (); // In caller_trivial_2.
+    asm volatile ("nop"); inline_trivial_1 (); // In caller_trivial_2.
     inline_value += 1;  // At increment in caller_trivial_2.
 }
 
@@ -88,7 +88,7 @@ called_by_inline_trivial ()
 void
 inline_trivial_1 ()
 {
-    inline_trivial_2(); // In inline_trivial_1.
+    asm volatile ("nop"); inline_trivial_2(); // In inline_trivial_1.
     inline_value += 1;  // At increment in inline_trivial_1.
 }
 


        


More information about the lldb-commits mailing list