Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jim Blandy <jimb@zwingli.cygnus.com>
To: Daniel Jacobowitz <drow@mvista.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: RFA: Recognize bottom of stack on Linux
Date: Tue, 05 Feb 2002 11:58:00 -0000	[thread overview]
Message-ID: <npwuxrr978.fsf@zwingli.cygnus.com> (raw)
In-Reply-To: <20020203222111.A17644@nevyn.them.org>

Daniel Jacobowitz <drow@mvista.com> writes:
> On Sun, Feb 03, 2002 at 09:06:36PM -0500, Jim Blandy wrote:
> > 
> > Now, some folks feel that GDB should show the whole stack, including
> > _start, __libc_start_main, and anything else that's there.  However,
> > this isn't the way GDB has ever traditionally behaved on native
> > targets.  So this patch makes GDB's backtraces end after main.
> > 
> > 2002-02-03  Jim Blandy  <jimb@redhat.com>
> > 
> > 	* i386-linux-tdep.c (i386_linux_frame_chain): Stop the frame chain
> > 	after `main', not just after the compilation unit containing the
> > 	entry point.
> 
> Shouldn't we use func_frame_chain_valid instead of
> file_frame_chain_valid instead of duplicating this?
> 
> I don't understand why that function doesn't have more callers.  It
> seems that at least all non-embedded targets, or at the very least all
> Linux targets, should use it.

The following works fine for me, too:

2002-02-05  Jim Blandy  <jimb@redhat.com>

	* i386-linux-tdep.c (i386_linux_frame_chain): Use
	func_frame_chain_valid, instead of plain inside_entry_file.

Index: gdb/i386-linux-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/i386-linux-tdep.c,v
retrieving revision 1.10
diff -c -r1.10 i386-linux-tdep.c
*** gdb/i386-linux-tdep.c	2001/12/10 22:04:10	1.10
--- gdb/i386-linux-tdep.c	2002/02/05 19:55:03
***************
*** 342,348 ****
    if (frame->signal_handler_caller || FRAMELESS_SIGNAL (frame))
      return frame->frame;
  
!   if (! inside_entry_file (frame->pc))
      return read_memory_unsigned_integer (frame->frame, 4);
  
    return 0;
--- 342,356 ----
    if (frame->signal_handler_caller || FRAMELESS_SIGNAL (frame))
      return frame->frame;
  
!   /* On Linux, the entry point is called _start, but that invokes
!      something called __libc_start_main, which calls main.  So if we
!      want the stack to end at main (as it does for GDB's other
!      targets), the `PC in entry point function' rule triggers too late
!      to get us the right result; we've already included
!      __libc_start_main in the backtrace, which we don't want.
!      func_frame_chain_valid checks both for `main', and for the entry
!      point function.  */
!   if (func_frame_chain_valid (1, frame))
      return read_memory_unsigned_integer (frame->frame, 4);
  
    return 0;


  parent reply	other threads:[~2002-02-05 19:58 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-02-03 18:21 Jim Blandy
2002-02-03 19:21 ` Daniel Jacobowitz
2002-02-03 23:00   ` Michael Snyder
2002-02-05 11:58   ` Jim Blandy [this message]
2002-02-05 13:57     ` Daniel Jacobowitz
2002-02-06 11:24       ` Jim Blandy
2002-02-06 16:09         ` Andrew Cagney
2002-03-30 21:56         ` Daniel Jacobowitz
2002-02-03 22:15 ` Eli Zaretskii
2002-02-04 11:02 ` Kevin Buettner
2002-02-04 17:32   ` Andrew Cagney
2002-02-04 17:42     ` Kevin Buettner
2002-02-04 17:44       ` Daniel Jacobowitz
2002-02-04 17:57         ` Michael Snyder
2002-02-04 18:55           ` Daniel Jacobowitz
2002-02-05 11:52         ` Jim Blandy
2002-02-06 16:02           ` Andrew Cagney

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=npwuxrr978.fsf@zwingli.cygnus.com \
    --to=jimb@zwingli.cygnus.com \
    --cc=drow@mvista.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