blob: e5d4202008ae189835f7272182f6f4d70f0988f2 [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 Turner35d017f2015-10-23 17:04:29 +00003from __future__ import print_function
4
Zachary Turner77db4a82015-10-22 20:06:20 +00005import lldb_shared
6
Jason Molenda680a7d72013-08-15 02:49:16 +00007import os, time
Jason Molenda680a7d72013-08-15 02:49:16 +00008import lldb
Todd Fialae373b682014-03-25 18:55:48 +00009import sys
Jason Molenda680a7d72013-08-15 02:49:16 +000010from lldbtest import *
11
Robert Flack13c7ad92015-03-30 14:12:17 +000012@skipUnlessDarwin
Jason Molenda680a7d72013-08-15 02:49:16 +000013class AddDsymMidExecutionCommandCase(TestBase):
14
Greg Clayton4570d3e2013-12-10 23:19:29 +000015 mydir = TestBase.compute_mydir(__file__)
Jason Molenda680a7d72013-08-15 02:49:16 +000016
17 def setUp(self):
18 # Call super's setUp().
19 TestBase.setUp(self)
20 self.source = 'main.c'
21
Tamas Berghammerc8fd1302015-09-30 10:12:40 +000022 @no_debug_info_test # Prevent the genaration of the dwarf version of this test
Jason Molenda680a7d72013-08-15 02:49:16 +000023 def test_add_dsym_mid_execution(self):
24 """Test that add-dsym mid-execution loads the symbols at the right place for a slid binary."""
25 self.buildDsym(clean=True)
26 exe = os.path.join(os.getcwd(), "a.out")
27
28 self.target = self.dbg.CreateTarget(exe)
29 self.assertTrue(self.target, VALID_TARGET)
30
31 main_bp = self.target.BreakpointCreateByName ("main", "a.out")
32 self.assertTrue(main_bp, VALID_BREAKPOINT)
33
34 self.runCmd("settings set target.disable-aslr false")
Greg Claytonc6947512013-12-13 19:18:59 +000035 self.process = self.target.LaunchSimple (None, None, self.get_process_working_directory())
Jason Molenda680a7d72013-08-15 02:49:16 +000036 self.assertTrue(self.process, PROCESS_IS_VALID)
37
38 # The stop reason of the thread should be breakpoint.
39 self.assertTrue(self.process.GetState() == lldb.eStateStopped,
40 STOPPED_DUE_TO_BREAKPOINT)
41
42 self.runCmd("add-dsym hide.app/Contents/a.out.dSYM")
43
44 self.expect("frame select",
45 substrs = ['a.out`main at main.c'])