Skip to content

Commit 058842d

Browse files
[Dexter] Fix test failures on greendragon
The issue with these test failures is that the dSYM was not being found by lldb, which is why setting breakpoints was failing and lldb quit without performing any steps. This change copies the dSYM to the same temp directory that the executeable is copied to.
1 parent d4ae1ab commit 058842d

File tree

5 files changed

+25
-5
lines changed

5 files changed

+25
-5
lines changed

cross-project-tests/debuginfo-tests/dexter/dex/debugger/DebuggerControllers/DefaultController.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,9 @@ def _run_debugger_custom(self, cmdline):
8787
self.step_collection.debugger = self.debugger.debugger_info
8888
self._break_point_all_lines()
8989
self.debugger.launch(cmdline)
90-
9190
for command_obj in chain.from_iterable(self.step_collection.commands.values()):
9291
self.watches.update(command_obj.get_watches())
9392
early_exit_conditions = self._get_early_exit_conditions()
94-
9593
timed_out = False
9694
total_timeout = Timeout(self.context.options.timeout_total)
9795
max_steps = self.context.options.max_steps

cross-project-tests/debuginfo-tests/dexter/dex/debugger/Debuggers.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,6 @@ def run_debugger_subprocess(debugger_controller, working_dir_path):
226226

227227
with open(controller_path, "rb") as fp:
228228
debugger_controller = pickle.load(fp)
229-
230229
return debugger_controller
231230

232231

cross-project-tests/debuginfo-tests/dexter/dex/debugger/lldb/LLDB.py

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,14 +174,34 @@ def delete_breakpoints(self, ids):
174174
self._target.BreakpointDelete(id)
175175

176176
def launch(self, cmdline):
177+
num_resolved_breakpoints = 0
178+
for b in self._target.breakpoint_iter():
179+
num_resolved_breakpoints += b.GetNumLocations() > 0
180+
assert num_resolved_breakpoints > 0
181+
177182
if self.context.options.target_run_args:
178183
cmdline += shlex.split(self.context.options.target_run_args)
179-
self._process = self._target.LaunchSimple(cmdline, None, os.getcwd())
184+
launch_info = self._target.GetLaunchInfo()
185+
launch_info.SetWorkingDirectory(os.getcwd())
186+
launch_info.SetArguments(cmdline, True)
187+
error = self._interface.SBError()
188+
self._process = self._target.Launch(launch_info, error)
189+
190+
if error.Fail():
191+
raise DebuggerException(error.GetCString())
192+
if not os.path.exists(self._target.executable.fullpath):
193+
raise DebuggerException("exe does not exist")
180194
if not self._process or self._process.GetNumThreads() == 0:
181195
raise DebuggerException("could not launch process")
182196
if self._process.GetNumThreads() != 1:
183197
raise DebuggerException("multiple threads not supported")
184198
self._thread = self._process.GetThreadAtIndex(0)
199+
200+
num_stopped_threads = 0
201+
for thread in self._process:
202+
if thread.GetStopReason() == self._interface.eStopReasonBreakpoint:
203+
num_stopped_threads += 1
204+
assert num_stopped_threads > 0
185205
assert self._thread, (self._process, self._thread)
186206

187207
def step(self):

cross-project-tests/debuginfo-tests/dexter/dex/tools/Main.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,6 @@ def __init__(self):
193193

194194
def main() -> ReturnCode:
195195
context = Context()
196-
197196
with PrettyOutput() as context.o:
198197
context.logger = Logger(context.o)
199198
try:

cross-project-tests/debuginfo-tests/dexter/dex/tools/test/Tool.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import csv
1212
import pickle
1313
import shutil
14+
import platform
1415

1516
from dex.command.ParseCommand import get_command_infos
1617
from dex.debugger.Debuggers import run_debugger_subprocess
@@ -217,6 +218,9 @@ def _run_test(self, test_name):
217218
"""
218219
try:
219220
if self.context.options.binary:
221+
if platform.system() == 'Darwin' and os.path.exists(self.context.options.binary + '.dSYM'):
222+
# On Darwin, the debug info is in the .dSYM which might not be found by lldb, copy it into the tmp working directory
223+
shutil.copytree(self.context.options.binary + '.dSYM', self.context.options.executable + '.dSYM')
220224
# Copy user's binary into the tmp working directory.
221225
shutil.copy(
222226
self.context.options.binary, self.context.options.executable

0 commit comments

Comments
 (0)