Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,17 @@ def frames_below_main(self):
def evaluate_expression(self, expression, frame_idx=0) -> ValueIR:
pass

def get_pc(self, frame_idx: int = 0) -> str:
"""Get the current PC in frame at frame_idx depth.
frame_idx 0 is the current function.
"""
r = self.evaluate_expression("$pc", frame_idx)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does $pc work for all supported debuggers?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Define supported debugger - it works for our debugger and LLDB.

I suppose the failure mode could be more user friendly. An exception explaining the feature isn't supported by the debugger might be better than these asserts.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with the exception instead of the asserts.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

if not r.could_evaluate or r.is_optimized_away or r.is_irretrievable:
raise DebuggerException(
"evaluating '$pc' failed - possibly unsupported by the debugger"
)
return r.value

def _external_to_debug_path(self, path):
if not self.options.debugger_use_relative_paths:
return path
Expand Down
Loading