Skip to content

Commit ab459c4

Browse files
authored
[Dexter] add get_pc (#152719)
1 parent 8a5a782 commit ab459c4

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,17 @@ def frames_below_main(self):
233233
def evaluate_expression(self, expression, frame_idx=0) -> ValueIR:
234234
pass
235235

236+
def get_pc(self, frame_idx: int = 0) -> str:
237+
"""Get the current PC in frame at frame_idx depth.
238+
frame_idx 0 is the current function.
239+
"""
240+
r = self.evaluate_expression("$pc", frame_idx)
241+
if not r.could_evaluate or r.is_optimized_away or r.is_irretrievable:
242+
raise DebuggerException(
243+
"evaluating '$pc' failed - possibly unsupported by the debugger"
244+
)
245+
return r.value
246+
236247
def _external_to_debug_path(self, path):
237248
if not self.options.debugger_use_relative_paths:
238249
return path

0 commit comments

Comments
 (0)