From: Michael Snyder <msnyder@redhat.com>
To: Joel Brobecker <brobecker@gnat.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [RFC] Unexpected automatic language switch - get_frame_language()
Date: Sat, 06 Dec 2003 00:42:00 -0000 [thread overview]
Message-ID: <3FD1260A.8080903@redhat.com> (raw)
In-Reply-To: <20031206001815.GF716@gnat.com>
Joel Brobecker wrote:
>>Sounds kinda like a debugging-optimized-code problem. Your function
>>is tail-return optimized -- doesn't really return. That's outside
>>the expected API.
>
>
> Kind of, yes, but the code in question was compiled at -O0!
Never the less...
> It's a
> noreturn function because the compiler could statically determine that
> the exception would be unhandled.
Maybe the compiler shouldn't do that at -O0?
>>I think you have to do "special" things for non-returning functions.
>>I've seen the same sort of thing for eg. _exit.
>
>
> Do you remember how these similar problems were approached and solved?
Ummm... ok, this is embarassing. Well, note that this was written
(by me) for a specific target architecture, and never expected to be
portable. This little piece of work was called from
iq2000_frame_saved_pc:
/* Function: horrible_noreturn_hack
If the return address points to the first instruction of a function,
decrement the return address by one instruction. */
static void
iq2000_horrible_noreturn_hack (struct frame_info *fi)
{
/* Some functions (notably those that are not expected to return)
seem to end with a jump_and_link instruction (plus a no-op).
When this happens, the return address seems to be the first
instruction of the next function. This messes up the backtrace.
I can think of no legitimate way that the return address
could actually be the first address of a function,
[NOTE: except for the entry point address for a call dummy],
so if we detect this, we'll decrement it by one instruction
(so that it hopefully points into the previous function). */
if (fi && fi->extra_info && fi->extra_info->frame_cached_pc)
if (get_pc_function_start (fi->extra_info->frame_cached_pc) ==
fi->extra_info->frame_cached_pc)
if (fi->extra_info->frame_cached_pc != entry_point_address ())
fi->extra_info->frame_cached_pc -= SIZEOF_IQ2000_INSN;
}
next prev parent reply other threads:[~2003-12-06 0: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
2003-12-06 0:42 ` Michael Snyder [this message]
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=3FD1260A.8080903@redhat.com \
--to=msnyder@redhat.com \
--cc=brobecker@gnat.com \
--cc=gdb-patches@sources.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