blob: 5dae2a06c83a272971cea92cb33b12b42df44629 [file] [log] [blame]
Jason Molenda680a7d72013-08-15 02:49:16 +00001"""Test that the 'add-dsym', aka 'target symbols add', succeeds in the middle of debug session."""
2
Zachary Turner77db4a82015-10-22 20:06:20 +00003import lldb_shared
4
Jason Molenda680a7d72013-08-15 02:49:16 +00005import os, time
Jason Molenda680a7d72013-08-15 02:49:16 +00006import lldb
Todd Fialae373b682014-03-25 18:55:48 +00007import sys
Jason Molenda680a7d72013-08-15 02:49:16 +00008from lldbtest import *
9
Robert Flack13c7ad92015-03-30 14:12:17 +000010@skipUnlessDarwin
Jason Molenda680a7d72013-08-15 02:49:16 +000011class AddDsymMidExecutionCommandCase(TestBase):
12
Greg Clayton4570d3e2013-12-10 23:19:29 +000013 mydir = TestBase.compute_mydir(__file__)
Jason Molenda680a7d72013-08-15 02:49:16 +000014
15 def setUp(self):
16 # Call super's setUp().
17 TestBase.setUp(self)
18 self.source = 'main.c'
19
Tamas Berghammerc8fd1302015-09-30 10:12:40 +000020 @no_debug_info_test # Prevent the genaration of the dwarf version of this test
Jason Molenda680a7d72013-08-15 02:49:16 +000021 def test_add_dsym_mid_execution(self):
22 """Test that add-dsym mid-execution loads the symbols at the right place for a slid binary."""
23 self.buildDsym(clean=True)
24 exe = os.path.join(os.getcwd(), "a.out")
25
26 self.target = self.dbg.CreateTarget(exe)
27 self.assertTrue(self.target, VALID_TARGET)
28
29 main_bp = self.target.BreakpointCreateByName ("main", "a.out")
30 self.assertTrue(main_bp, VALID_BREAKPOINT)
31
32 self.runCmd("settings set target.disable-aslr false")
Greg Claytonc6947512013-12-13 19:18:59 +000033 self.process = self.target.LaunchSimple (None, None, self.get_process_working_directory())
Jason Molenda680a7d72013-08-15 02:49:16 +000034 self.assertTrue(self.process, PROCESS_IS_VALID)
35
36 # The stop reason of the thread should be breakpoint.
37 self.assertTrue(self.process.GetState() == lldb.eStateStopped,
38 STOPPED_DUE_TO_BREAKPOINT)
39
40 self.runCmd("add-dsym hide.app/Contents/a.out.dSYM")
41
42 self.expect("frame select",
43 substrs = ['a.out`main at main.c'])