Skip to content

Commit 97820be

Browse files
authored
[Dexter] Make lldb-dap _post_step_hook more stable (#157663)
Buildbot cross-project-tests-sie-ubuntu has been unstable recently (https://lab.llvm.org/buildbot/#/builders/181). Dexter uses lldb-dap in these tests. Occasionally a one will fail with a KeyError because of a missing "stackFrames" "source" "path". I can't reproduce the failure locally, but with PRs #157130 and #157145 I've got DAP logs from a pass and fail. In a failure, "path" is missing for a step out of main (off the final brace), and the passing test has one additional "module" event for libc.so.6. ``` <- { "body": { "module": { "addressRange": "0x7ffff7dd1000", "debugInfoSize": "4.9MB", "id": "5792732F-7831-58C6-6FB4-F3756458CA24-E46E827D", "name": "libc.so.6", "path": "/lib/x86_64-linux-gnu/libc.so.6", "symbolFilePath": "/usr/lib/debug/.build-id/57/92732f783158c66fb4f3756458ca24e46e827d.debug", "symbolStatus": "Symbols loaded." }, "reason": "new" }, "event": "module", "seq": 0, "type": "event" } ``` That explains why we get a step that is missing a "path" component in the failure. I don't understand why LLDB (or LLDB-DAP) is sometimes unable to load the module (in time?). But "path" is an optional field anyway, so I think it's worth handling in dexter even if LLDB's behaviour here is confusing. This commit should stabilize the bot if the only time a module goes missing is for steps outside main. (Ideally none would go missing, but those shouldn't interfere with the tests).
1 parent 723fcd5 commit 97820be

File tree

1 file changed

+8
-1
lines changed
  • cross-project-tests/debuginfo-tests/dexter/dex/debugger/lldb

1 file changed

+8
-1
lines changed

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,8 +431,15 @@ def _post_step_hook(self):
431431
if not trace_response["success"]:
432432
raise DebuggerException("failed to get stack frames")
433433
stackframes = trace_response["body"]["stackFrames"]
434-
path = stackframes[0]["source"]["path"]
435434
addr = stackframes[0]["instructionPointerReference"]
435+
try:
436+
path = stackframes[0]["source"]["path"]
437+
except KeyError:
438+
# We may have no path, e.g., if the module hasn't loaded or
439+
# there's no debug info. If that's the case we won't have
440+
# bound a source-location breakpoint here, so we can bail now.
441+
return
442+
436443
if any(
437444
self._debugger_state.bp_addr_map.get(self.dex_id_to_dap_id[dex_bp_id])
438445
== addr

0 commit comments

Comments
 (0)