From 7ae4c3a566beba00e16dd10bb69414ffc214dcbb Mon Sep 17 00:00:00 2001 From: Joel Brobecker Date: Wed, 10 Dec 2003 17:40:43 +0000 Subject: [PATCH 1/1] * frame.c (select_frame): Get the current frame PC using get_frame_address_in_block() instead of get_frame_pc(). * stack.c (get_frame_language): Likewise. --- gdb/ChangeLog | 6 ++++++ gdb/frame.c | 8 +++++++- gdb/stack.c | 9 ++++++++- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 1a2c034338..0bec025621 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2003-12-10 J. Brobecker + + * frame.c (select_frame): Get the current frame PC using + get_frame_address_in_block() instead of get_frame_pc(). + * stack.c (get_frame_language): Likewise. + 2003-12-08 Kevin Buettner * remote.c (remote_open_1, remote_cisco_open): Avoid closing diff --git a/gdb/frame.c b/gdb/frame.c index 5dc0705a03..1d378913fb 100644 --- a/gdb/frame.c +++ b/gdb/frame.c @@ -917,7 +917,13 @@ select_frame (struct frame_info *fi) source language of this frame, and switch to it if desired. */ if (fi) { - s = find_pc_symtab (get_frame_pc (fi)); + /* We retrieve the frame's symtab by using the frame PC. However + we cannot use the frame pc as is, because it usually points to + the instruction following the "call", which is sometimes the + first instruction of another function. So we rely on + get_frame_address_in_block() which provides us with a PC which + is guaranteed to be inside the frame's code block. */ + s = find_pc_symtab (get_frame_address_in_block (fi)); if (s && s->language != current_language->la_language && s->language != language_unknown diff --git a/gdb/stack.c b/gdb/stack.c index 04e6a18bce..a2b331f029 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -2036,7 +2036,14 @@ get_frame_language (void) if (deprecated_selected_frame) { - s = find_pc_symtab (get_frame_pc (deprecated_selected_frame)); + /* We determine the current frame language by looking up its + associated symtab. To retrieve this symtab, we use the frame PC. + However we cannot use the frame pc as is, because it usually points + to the instruction following the "call", which is sometimes the first + instruction of another function. So we rely on + get_frame_address_in_block(), it provides us with a PC which is + guaranteed to be inside the frame's code block. */ + s = find_pc_symtab (get_frame_address_in_block (deprecated_selected_frame)); if (s) flang = s->language; else -- 2.34.1