[Lldb-commits] [lldb] 4706a60 - [lldb] [testsuite] Fix Linux fail: Unwind/thread-step-out-ret-addr-check.test
Jan Kratochvil via lldb-commits
lldb-commits at lists.llvm.org
Sat Dec 21 02:30:32 PST 2019
Author: Jan Kratochvil
Date: 2019-12-21T11:27:54+01:00
New Revision: 4706a60e8a071f0c6a686c45ed08c7bab0bb8446
URL: https://github.com/llvm/llvm-project/commit/4706a60e8a071f0c6a686c45ed08c7bab0bb8446
DIFF: https://github.com/llvm/llvm-project/commit/4706a60e8a071f0c6a686c45ed08c7bab0bb8446.diff
LOG: [lldb] [testsuite] Fix Linux fail: Unwind/thread-step-out-ret-addr-check.test
D71372 introduced: `Unwind/thread-step-out-ret-addr-check.test` failing on
Fedora 30 Linux x86_64.
[lldb] Add additional validation on return address in 'thread step-out'
https://reviews.llvm.org/D71372
One problem is the underscored `_nonstandard_stub` in the `.s` file but not in
the LLDB command:
(lldb) breakpoint set -n nonstandard_stub
Breakpoint 1: no locations (pending).
WARNING: Unable to resolve breakpoint to any actual locations.
(lldb) process launch
Process 21919 exited with status = 0 (0x00000000)
Process 21919 launched: '/home/jkratoch/redhat/llvm-monorepo-clangassert/tools/lldb/test/Unwind/Output/thread-step-out-ret-addr-check.test.tmp' (x86_64)
(lldb) thread step-out
error: invalid thread
(lldb) _
Another problem is that Fedora Linux has executable stack by default and all
programs indicate non-executable stack by `PT_GNU_STACK`, after fixing the
underscore I was getting:
(lldb) thread step-out
Process 22294 exited with status = 0 (0x00000000)
(lldb) _
A different approach was tried as:
[lldb] Refactor thread-step-out-ret-addr-check test to use .data instead of stack variable
https://reviews.llvm.org/D71789
Differential revision: https://reviews.llvm.org/D71784
Added:
Modified:
lldb/test/Shell/Unwind/Inputs/thread-step-out-ret-addr-check.s
lldb/test/Shell/Unwind/thread-step-out-ret-addr-check.test
Removed:
################################################################################
diff --git a/lldb/test/Shell/Unwind/Inputs/thread-step-out-ret-addr-check.s b/lldb/test/Shell/Unwind/Inputs/thread-step-out-ret-addr-check.s
index d18ea24fba4d..2fb4935b38bb 100644
--- a/lldb/test/Shell/Unwind/Inputs/thread-step-out-ret-addr-check.s
+++ b/lldb/test/Shell/Unwind/Inputs/thread-step-out-ret-addr-check.s
@@ -4,13 +4,13 @@ asm_main:
sub $0x8, %rsp
movq $0, (%rsp)
push %rsp
- jmp _nonstandard_stub
+ jmp nonstandard_stub
# Takes a single pointer argument via the stack, which is nonstandard for x64.
# Executing 'thread step-out' here will initially attempt to write a
# breakpoint to that stack address, but should fail because of the executable
# memory check.
-_nonstandard_stub:
+nonstandard_stub:
mov (%rsp), %rdi
mov (%rdi), %rsi
add $1, %rsi
@@ -18,3 +18,7 @@ _nonstandard_stub:
add $0x10, %rsp
ret
+
+#ifdef __linux__
+ .section .note.GNU-stack,"", at progbits
+#endif
diff --git a/lldb/test/Shell/Unwind/thread-step-out-ret-addr-check.test b/lldb/test/Shell/Unwind/thread-step-out-ret-addr-check.test
index 53436cd55af1..ec73bd808c24 100644
--- a/lldb/test/Shell/Unwind/thread-step-out-ret-addr-check.test
+++ b/lldb/test/Shell/Unwind/thread-step-out-ret-addr-check.test
@@ -1,7 +1,7 @@
# Test that `thread step-out` fails when the "return address"
# points to non-executable memory.
-# REQUIRES: target-x86_64, system-darwin
+# REQUIRES: target-x86_64
# RUN: %clang_host %p/Inputs/call-asm.c %p/Inputs/thread-step-out-ret-addr-check.s -o %t
# RUN: %lldb %t -s %s -b 2>&1 | FileCheck %s
More information about the lldb-commits
mailing list