diff --git a/gdb/python/py-finishbreakpoint.c b/gdb/python/py-finishbreakpoint.c index 3370bb02580..4af8ec6c75f 100644 --- a/gdb/python/py-finishbreakpoint.c +++ b/gdb/python/py-finishbreakpoint.c @@ -174,7 +174,6 @@ bpfinishpy_init (PyObject *self, PyObject *args, PyObject *kwargs) struct frame_id frame_id; PyObject *internal = NULL; int internal_bp = 0; - std::optional pc; if (!gdb_PyArg_ParseTupleAndKeywords (args, kwargs, "|OO", keywords, &frame_obj, &internal)) @@ -248,9 +247,10 @@ bpfinishpy_init (PyObject *self, PyObject *args, PyObject *kwargs) try { - if ((pc = get_frame_pc_if_available (frame))) + CORE_ADDR pc; + if (get_frame_address_in_block_if_available (frame, &pc)) { - struct symbol *function = find_symbol_for_pc (*pc); + struct symbol *function = find_symbol_for_pc (pc); if (function != nullptr) { struct type *ret_type = diff --git a/gdb/testsuite/gdb.python/py-finish-breakpoint-tailcall.exp b/gdb/testsuite/gdb.python/py-finish-breakpoint-tailcall.exp index e5b5ebc5183..2ae61f389ef 100644 --- a/gdb/testsuite/gdb.python/py-finish-breakpoint-tailcall.exp +++ b/gdb/testsuite/gdb.python/py-finish-breakpoint-tailcall.exp @@ -66,11 +66,16 @@ proc run_test {} { set saw_stopped_message false set saw_breakpoint_line false set saw_source_line false + set saw_return_value false gdb_test_multiple "continue" "" { -re "^Stopped at MyFinishBreakpoint\r\n" { set saw_stopped_message true exp_continue } + -re "^Return value is 43\r\n" { + set saw_return_value true + exp_continue + } -re "^Breakpoint $::decimal, main \\(\\) at \[^\r\n\]+/$::srcfile:$lineno\r\n" { set saw_breakpoint_line true exp_continue @@ -82,7 +87,8 @@ proc run_test {} { -re "^$::gdb_prompt $" { gdb_assert { $saw_stopped_message \ && $saw_breakpoint_line \ - && $saw_source_line } $gdb_test_name + && $saw_source_line \ + && $saw_return_value } $gdb_test_name } -re "^\[^\r\n\]*\r\n" { exp_continue diff --git a/gdb/testsuite/gdb.python/py-finish-breakpoint-tailcall.py b/gdb/testsuite/gdb.python/py-finish-breakpoint-tailcall.py index bd10109a3dc..e493dfa4017 100644 --- a/gdb/testsuite/gdb.python/py-finish-breakpoint-tailcall.py +++ b/gdb/testsuite/gdb.python/py-finish-breakpoint-tailcall.py @@ -20,6 +20,7 @@ import gdb class MyFinishBreakpoint(gdb.FinishBreakpoint): def stop(self): print("Stopped at MyFinishBreakpoint") + print("Return value is {}".format(self.return_value)) return True