From: Mark Kettenis <kettenis@chello.nl>
To: hongjiu.lu@intel.com
Cc: gdb-patches@sources.redhat.com
Subject: Re: HACK: Fix the backstrace for Linux/x86-64.
Date: Fri, 28 May 2004 21:46:00 -0000 [thread overview]
Message-ID: <200405282146.i4SLkWqh000442@elgar.kettenis.dyndns.org> (raw)
In-Reply-To: <20040528012818.GA7420@lucon.org>
Date: Thu, 27 May 2004 18:28:18 -0700
From: "H. J. Lu" <hongjiu.lu@intel.com>
Should we put "hacks" into GDB?
I am using this hack to work around the backstrace bug on x86-64. Right
now we are getting:
(gdb) bt
#0 foo () at foo.c:4
During symbol reading, Incomplete CFI data; unspecified registers at
0x0000000000400490.
#1 0x00000034d4b1c48a in __libc_start_main () from
/lib64/tls/libc.so.6
#2 0x00000000004003ea in _start ()
#3 0x0000007fbffff8a8 in ?? ()
#4 0x000000000000001c in ?? ()
This is weird. Where is main()? I think that's the problem, which
should be solved.
2004-05-27 H.J. Lu <hongjiu.lu@intel.com>
* amd64-tdep.c (amd64_frame_cache): Add outermost_p.
(amd64_alloc_frame_cache): Clear outermost_p.
(amd64_analyze_prologue): Set outermost_p for "xor %rbp,%rbp"
to mark the outermost frame.
(amd64_frame_cache): Return if outermost_p is set.
Clever, however, I'm not convinced this is a good idea. The fact that
the Linux startup code clears %rbp is utterly pointless:
.text
.globl _start
.type _start,@function
_start:
/* Clear the frame pointer. The ABI suggests this be done, to mark
the outermost frame obviously. */
xorq %rbp, %rbp
The ABI doesn't suggest that at all (at least I can't find it) and
usage of %rbp as a frame pointer is optional, and certainly not the
default. This was probably just copied from the i386 code, and should
be removed. Then your "hack" doesn't work anymore.
Personaly I don't think the fact that the frame chain isn't properly
terminated is a big problem. It only manifests itself if you'r
backtracing from within the startup code. People doing so should now
what they're doing. However, other people might think differently.
In that case we should think about enabling the inside_entry_func()
test.
Mark
next prev parent reply other threads:[~2004-05-28 21:46 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-05-28 1:28 H. J. Lu
2004-05-28 21:46 ` Mark Kettenis [this message]
2004-05-28 22:07 Lu, Hongjiu
2004-05-28 22:14 Lu, Hongjiu
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=200405282146.i4SLkWqh000442@elgar.kettenis.dyndns.org \
--to=kettenis@chello.nl \
--cc=gdb-patches@sources.redhat.com \
--cc=hongjiu.lu@intel.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