diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2017-01-02 19:26:05 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2017-01-02 19:26:05 +0000 |
| commit | 14f1b3e8826ce43b978db93a62d1166055db5394 (patch) | |
| tree | 0a00ad8d3498783fe0193f3b656bca17c4c8697d /packages/Python/lldbsuite/test/functionalities/unwind/ehframe | |
| parent | 4ee8c119c71a06dcad1e0fecc8c675e480e59337 (diff) | |
Notes
Diffstat (limited to 'packages/Python/lldbsuite/test/functionalities/unwind/ehframe')
| -rw-r--r-- | packages/Python/lldbsuite/test/functionalities/unwind/ehframe/TestEhFrameUnwind.py | 17 | ||||
| -rw-r--r-- | packages/Python/lldbsuite/test/functionalities/unwind/ehframe/main.c | 32 |
2 files changed, 38 insertions, 11 deletions
diff --git a/packages/Python/lldbsuite/test/functionalities/unwind/ehframe/TestEhFrameUnwind.py b/packages/Python/lldbsuite/test/functionalities/unwind/ehframe/TestEhFrameUnwind.py index e17d5d36d394..a855be7536ca 100644 --- a/packages/Python/lldbsuite/test/functionalities/unwind/ehframe/TestEhFrameUnwind.py +++ b/packages/Python/lldbsuite/test/functionalities/unwind/ehframe/TestEhFrameUnwind.py @@ -5,20 +5,20 @@ Test that we can backtrace correctly from Non ABI functions on the stack from __future__ import print_function - -import os, time +import os +import time import lldb from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * from lldbsuite.test import lldbutil + class EHFrameBasedUnwind(TestBase): mydir = TestBase.compute_mydir(__file__) - @skipUnlessPlatform(['linux']) @skipIf(archs=["aarch64", "arm", "i386", "i686"]) - def test (self): + def test(self): """Test that we can backtrace correctly from Non ABI functions on the stack""" self.build() self.setTearDownCleanup() @@ -28,9 +28,10 @@ class EHFrameBasedUnwind(TestBase): self.assertTrue(target, VALID_TARGET) - lldbutil.run_break_set_by_symbol (self, "func") + lldbutil.run_break_set_by_symbol(self, "func") - process = target.LaunchSimple (["abc", "xyz"], None, self.get_process_working_directory()) + process = target.LaunchSimple( + ["abc", "xyz"], None, self.get_process_working_directory()) if not process: self.fail("SBTarget.Launch() failed") @@ -42,10 +43,10 @@ class EHFrameBasedUnwind(TestBase): stacktraces = lldbutil.print_stacktraces(process, string_buffer=True) self.expect(stacktraces, exe=False, - substrs = ['(int)argc=3']) + substrs=['(int)argc=3']) self.runCmd("thread step-inst") stacktraces = lldbutil.print_stacktraces(process, string_buffer=True) self.expect(stacktraces, exe=False, - substrs = ['(int)argc=3']) + substrs=['(int)argc=3']) diff --git a/packages/Python/lldbsuite/test/functionalities/unwind/ehframe/main.c b/packages/Python/lldbsuite/test/functionalities/unwind/ehframe/main.c index f62f7d814f38..ae8060124ab2 100644 --- a/packages/Python/lldbsuite/test/functionalities/unwind/ehframe/main.c +++ b/packages/Python/lldbsuite/test/functionalities/unwind/ehframe/main.c @@ -1,4 +1,6 @@ void func() { + +#ifndef __mips__ __asm__ ( "pushq $0x10;" ".cfi_def_cfa_offset 16;" @@ -10,11 +12,35 @@ void func() { "movq $0x48, %rax;" "popq %rax;" ); - +#elif __mips64 + __asm__ ( + "daddiu $sp,$sp,-16;" + ".cfi_def_cfa_offset 16;" + "sd $ra,8($sp);" + ".cfi_offset 31, -8;" + "daddiu $ra,$zero,0;" + "ld $ra,8($sp);" + "daddiu $sp, $sp,16;" + ".cfi_restore 31;" + ".cfi_def_cfa_offset 0;" + ); +#else + // For MIPS32 + __asm__ ( + "addiu $sp,$sp,-8;" + ".cfi_def_cfa_offset 8;" + "sw $ra,4($sp);" + ".cfi_offset 31, -4;" + "addiu $ra,$zero,0;" + "lw $ra,4($sp);" + "addiu $sp,$sp,8;" + ".cfi_restore 31;" + ".cfi_def_cfa_offset 0;" + ); +#endif } - int main(int argc, char const *argv[]) { func(); -}
\ No newline at end of file +} |
