From: Joel Brobecker <brobecker@gnat.com>
To: Andrew Cagney <cagney@gnu.org>
Cc: Michael Snyder <msnyder@redhat.com>, gdb-patches@sources.redhat.com
Subject: Re: [RFC] Unexpected automatic language switch - get_frame_language()
Date: Wed, 10 Dec 2003 17:42:00 -0000 [thread overview]
Message-ID: <20031210174220.GG1296@gnat.com> (raw)
In-Reply-To: <3FD74659.9020900@gnu.org>
[-- Attachment #1: Type: text/plain, Size: 551 bytes --]
> >2003-12-09 J. Brobecker <brobecker@gnat.com>
> >
> > * 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.
> >
> >Tested on x86-linux, with no regression.
> >
> >OK to apply?
>
> Yes, but just add a comment at each point reminding us why the PC is
> wrong before committing.
Thanks. Here is the patch that I ended up committing. Let me know if
somebody would like the comments to be worded differently.
--
Joel
[-- Attachment #2: addr_in_block.diff --]
[-- Type: text/plain, Size: 2079 bytes --]
Index: frame.c
===================================================================
RCS file: /cvs/src/src/gdb/frame.c,v
retrieving revision 1.152
diff -u -p -r1.152 frame.c
--- frame.c 23 Nov 2003 21:49:12 -0000 1.152
+++ frame.c 10 Dec 2003 17:21:46 -0000
@@ -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
Index: stack.c
===================================================================
RCS file: /cvs/src/src/gdb/stack.c,v
retrieving revision 1.97
diff -u -p -r1.97 stack.c
--- stack.c 23 Nov 2003 20:41:17 -0000 1.97
+++ stack.c 10 Dec 2003 17:21:47 -0000
@@ -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
next prev parent reply other threads:[~2003-12-10 17:42 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-12-05 22:48 Joel Brobecker
2003-12-05 23:57 ` Michael Snyder
2003-12-06 0:18 ` Joel Brobecker
2003-12-06 0:28 ` Andrew Cagney
2003-12-10 1:50 ` Joel Brobecker
2003-12-10 16:14 ` Andrew Cagney
2003-12-10 17:42 ` Joel Brobecker [this message]
2003-12-06 0:42 ` Michael Snyder
2003-12-10 17:47 ` Daniel Jacobowitz
2003-12-10 18:10 ` Joel Brobecker
2003-12-10 18:20 ` Daniel Jacobowitz
2003-12-10 19:16 ` Joel Brobecker
2003-12-10 19:18 ` Daniel Jacobowitz
2003-12-10 18:33 ` Ada's throw/catch; Was: " Andrew Cagney
2003-12-10 19:04 ` Joel Brobecker
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20031210174220.GG1296@gnat.com \
--to=brobecker@gnat.com \
--cc=cagney@gnu.org \
--cc=gdb-patches@sources.redhat.com \
--cc=msnyder@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox