Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Randolph Chung <randolph@tausq.org>
To: John David Anglin <dave@hiauly1.hia.nrc.ca>
Cc: brobecker@adacore.com,  gdb@sources.redhat.com
Subject: Re: [hpux] interesting but difficult to unwind code
Date: Fri, 09 Dec 2005 03:33:00 -0000	[thread overview]
Message-ID: <4398FB10.1050307@tausq.org> (raw)
In-Reply-To: <200512090044.jB90in3E017441@hiauly1.hia.nrc.ca>

> No, this code has been compiled by GCC.  The save of the frame
> pointer at the incomming stack pointer address is the clue.  SAVE_SP
> should be set to indicate this.  This should allow unwinding
> through this function...

hrm, is there a way to verify this other than the above? The fact that
the "args_stored" flag is set in the unwind record is also a bit
surprising, as (afaict) gcc doesn't emit this flag.

I downloaded this wdb binary from HP's website and their documentation
also seems to suggest that it is compiled with HP compilers.

>> 1) it has a branch right in the middle of the prologue at +16. This is a 
>> call to strlen()
> 
> Interesting.  It looks ok from a functional standpoint.

Yes, but I've never seen gcc do this.... does it?

>> 2) It contains a stack adjustment beyond what is marked in the unwind 
>> info. This is probably due to alloca(). Note that there is nothing in 
>> the unwind data that indicates this. The line of code in wdb that 
>> generates this is probably:
>>
>>   save_line = (char *) alloca (strlen (p) + 1);
> 
> GCC has never recorded alloca adjustments.  However, SAVE_SP will
> be set in any frame using alloca.

Right.

> Note copy of info stored at -4 and -10 in the frame marker.  This
> is mandated by the ABI but unfortunately psp isn't required to be
> saved in the frame marker.  So it's not a whole lot of use.  Signal
> frames are the only ones that I know save the psp for sure.  In
> any case, r3 contains the previous stack pointer.

The problem is that currently, absent some indication from the unwind
data that a frame pointer is present (e.g. Save_SP), we do not use the
saved frame pointer to do unwinding. This can probably be enhanced by
teaching gdb more about common prologue sequences that actually store
the psp into r3. Perhaps this is another argument for Joel's proposal to
do more detailed prologue analysis.

>> (gdb) maintenance print unwind execute_command
>> unwind_table_entry (0x40286424):
>>          region_start = 0xcb44c <execute_command>
>>          region_end = 0xcb798 <execute_command+844>
>>          flags = Args_stored Save_RP
> 
> I don't understand why you don't see SAVE_SP in the flags.

Yes, very odd....

randolph
-- 
Randolph Chung
Debian GNU/Linux Developer, hppa/ia64 ports
http://www.tausq.org/


  reply	other threads:[~2005-12-09  3:33 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-09  0:08 Randolph Chung
2005-12-09  0:44 ` John David Anglin
2005-12-09  3:33   ` Randolph Chung [this message]
2005-12-09  4:55     ` John David Anglin
2005-12-09 18:47 Carl Burch
2005-12-10  0:43 ` John David Anglin
2005-12-11 14:45 ` Randolph Chung

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=4398FB10.1050307@tausq.org \
    --to=randolph@tausq.org \
    --cc=brobecker@adacore.com \
    --cc=dave@hiauly1.hia.nrc.ca \
    --cc=gdb@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