From ef6a482b0285870c45f39c9b17ed827362b334ae Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Thu, 7 Apr 2022 12:31:01 -0700 Subject: bpo-47177: Replace `f_lasti` with `prev_instr` (GH-32208) --- Tools/gdb/libpython.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'Tools/gdb/libpython.py') diff --git a/Tools/gdb/libpython.py b/Tools/gdb/libpython.py index 00cdcca084e..4f7a8bca5fd 100755 --- a/Tools/gdb/libpython.py +++ b/Tools/gdb/libpython.py @@ -1015,7 +1015,10 @@ class PyFramePtr: return self._f_special("nlocalsplus", int_from_int) def _f_lasti(self): - return self._f_special("f_lasti", int_from_int) + codeunit_p = gdb.lookup_type("_Py_CODEUNIT").pointer() + prev_instr = self._gdbval["prev_instr"] + first_instr = self._f_code().field("co_code_adaptive").cast(codeunit_p) + return int(prev_instr - first_instr) def is_entry(self): return self._f_special("is_entry", bool) -- cgit v1.2.3