[Lldb-commits] [lldb] r203268 - Fix malloc thread step-out test on FreeBSD

Ed Maste emaste at freebsd.org
Fri Mar 7 11:02:20 PST 2014


Author: emaste
Date: Fri Mar  7 13:02:20 2014
New Revision: 203268

URL: http://llvm.org/viewvc/llvm-project?rev=203268&view=rev
Log:
Fix malloc thread step-out test on FreeBSD

After hitting the malloc() breakpoint on FreeBSD our top frame is actually
an inlined function malloc_init.

  * frame #0: 0x0000000800dcba19 libc.so.7`malloc [inlined] malloc_init at malloc.c:5397
    frame #1: 0x0000000800dcba19 libc.so.7`malloc(size=1024) + 9 at malloc.c:5949
    frame #2: 0x00000000004006e5 test_step_out_of_malloc_into_function_b_with_dwarf`b(val=1) + 37 at main2.cpp:29

Add a heuristic to keep stepping out until we come to a non-malloc caller,
before checking if it is our desired caller from the test code.

llvm.org/pr17944

Modified:
    lldb/trunk/test/python_api/thread/TestThreadAPI.py

Modified: lldb/trunk/test/python_api/thread/TestThreadAPI.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/thread/TestThreadAPI.py?rev=203268&r1=203267&r2=203268&view=diff
==============================================================================
--- lldb/trunk/test/python_api/thread/TestThreadAPI.py (original)
+++ lldb/trunk/test/python_api/thread/TestThreadAPI.py Fri Mar  7 13:02:20 2014
@@ -74,7 +74,6 @@ class ThreadAPITestCase(TestBase):
         self.setTearDownCleanup(dictionary=d)
         self.step_out_of_malloc_into_function_b(self.exe_name)
 
-    @expectedFailureFreeBSD('llvm.org/pr17944')
     @expectedFailureLinux # llvm.org/pr14416
     @python_api_test
     @dwarf_test
@@ -187,6 +186,15 @@ class ThreadAPITestCase(TestBase):
             #print "caller symbol of malloc:", caller_symbol
             if not caller_symbol:
                 self.fail("Test failed: could not locate the caller symbol of malloc")
+
+            # Our top frame may be an inlined function in malloc() (e.g., on
+            # FreeBSD).  Apply a simple heuristic of stepping out until we find
+            # a non-malloc caller
+            while caller_symbol.startswith("malloc"):
+                thread.StepOut()
+                self.assertTrue(thread.IsValid(), "Thread valid after stepping to outer malloc")
+                caller_symbol = get_caller_symbol(thread)
+
             if caller_symbol == "b(int)":
                 break
             #self.runCmd("thread backtrace")





More information about the lldb-commits mailing list