HomePhabricator

[lldb/testsuite] Fix TestInlineStepping on arm64 with newer compilers
4e82212c29b8Unpublished

Authored by friss on Mar 18 2020, 8:56 PM.

Unpublished Commit ยท Learn More

Not On Permanent Ref: This commit is not an ancestor of any permanent ref.

Description

[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

(cherry picked from commit ecc6c426977f59f69b683d67ceb3157fb694ce09)