[Lldb-commits] [lldb] r188443 - A new test case which adds a dSYM to an executable mid-debug session
Jason Molenda
jmolenda at apple.com
Wed Aug 14 19:49:16 PDT 2013
Author: jmolenda
Date: Wed Aug 14 21:49:16 2013
New Revision: 188443
URL: http://llvm.org/viewvc/llvm-project?rev=188443&view=rev
Log:
A new test case which adds a dSYM to an executable mid-debug session
where the executable has been slid. This detects the regression fixed in
r188289.
Added:
lldb/trunk/test/macosx/add-dsym/
lldb/trunk/test/macosx/add-dsym/Makefile
lldb/trunk/test/macosx/add-dsym/TestAddDsymMidExecutionCommand.py
lldb/trunk/test/macosx/add-dsym/main.c
Added: lldb/trunk/test/macosx/add-dsym/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/macosx/add-dsym/Makefile?rev=188443&view=auto
==============================================================================
--- lldb/trunk/test/macosx/add-dsym/Makefile (added)
+++ lldb/trunk/test/macosx/add-dsym/Makefile Wed Aug 14 21:49:16 2013
@@ -0,0 +1,11 @@
+CC ?= clang
+
+all: clean
+ mkdir hide.app
+ mkdir hide.app/Contents
+ $(CC) -g main.c
+ mv a.out.dSYM hide.app/Contents
+ strip -x a.out
+
+clean:
+ rm -rf a.out a.out.dSYM hide.app
Added: lldb/trunk/test/macosx/add-dsym/TestAddDsymMidExecutionCommand.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/macosx/add-dsym/TestAddDsymMidExecutionCommand.py?rev=188443&view=auto
==============================================================================
--- lldb/trunk/test/macosx/add-dsym/TestAddDsymMidExecutionCommand.py (added)
+++ lldb/trunk/test/macosx/add-dsym/TestAddDsymMidExecutionCommand.py Wed Aug 14 21:49:16 2013
@@ -0,0 +1,47 @@
+"""Test that the 'add-dsym', aka 'target symbols add', succeeds in the middle of debug session."""
+
+import os, time
+import unittest2
+import lldb
+import pexpect
+from lldbtest import *
+
+ at unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+class AddDsymMidExecutionCommandCase(TestBase):
+
+ mydir = os.path.join ("macosx", "add-dsym")
+
+ def setUp(self):
+ # Call super's setUp().
+ TestBase.setUp(self)
+ self.source = 'main.c'
+
+ def test_add_dsym_mid_execution(self):
+ """Test that add-dsym mid-execution loads the symbols at the right place for a slid binary."""
+ self.buildDsym(clean=True)
+ exe = os.path.join(os.getcwd(), "a.out")
+
+ self.target = self.dbg.CreateTarget(exe)
+ self.assertTrue(self.target, VALID_TARGET)
+
+ main_bp = self.target.BreakpointCreateByName ("main", "a.out")
+ self.assertTrue(main_bp, VALID_BREAKPOINT)
+
+ self.runCmd("settings set target.disable-aslr false")
+ self.process = self.target.LaunchSimple(None, None, os.getcwd())
+ self.assertTrue(self.process, PROCESS_IS_VALID)
+
+ # The stop reason of the thread should be breakpoint.
+ self.assertTrue(self.process.GetState() == lldb.eStateStopped,
+ STOPPED_DUE_TO_BREAKPOINT)
+
+ self.runCmd("add-dsym hide.app/Contents/a.out.dSYM")
+
+ self.expect("frame select",
+ substrs = ['a.out`main at main.c'])
+
+if __name__ == '__main__':
+ import atexit
+ lldb.SBDebugger.Initialize()
+ atexit.register(lambda: lldb.SBDebugger.Terminate())
+ unittest2.main()
Added: lldb/trunk/test/macosx/add-dsym/main.c
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/macosx/add-dsym/main.c?rev=188443&view=auto
==============================================================================
--- lldb/trunk/test/macosx/add-dsym/main.c (added)
+++ lldb/trunk/test/macosx/add-dsym/main.c Wed Aug 14 21:49:16 2013
@@ -0,0 +1,7 @@
+#include <stdio.h>
+static int var = 5;
+int main ()
+{
+ printf ("%p is %d\n", &var, var); // break on this line
+ return ++var;
+}
More information about the lldb-commits
mailing list