From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Richard Smith <richard@ex-parrot.com>
Cc: gdb@sourceware.org
Subject: Re: Backtraces broken on i386 by unorthodox encoding of push %ebp
Date: Sat, 30 Mar 2013 19:50:00 -0000 [thread overview]
Message-ID: <20130330195008.GA11994@host2.jankratochvil.net> (raw)
In-Reply-To: <alpine.LRH.2.02.1303301849040.2445@sphinx.mythic-beasts.com>
On Sat, 30 Mar 2013 20:13:06 +0100, Richard Smith wrote:
> 08048104 <foo>:
> 8048104: ff f5 push %ebp
> 8048106: 89 e5 mov %esp,%ebp
>
> However, when I have this form of prologue, gdb doesn't recongnise
> it, and doesn't give a meaningful backtrace.
You should always provide unwind information and then it is irrelevant which
instructions and/or which their coding you use.
See how GCC does it: -S -fasynchronous-unwind-tables -m32
.cfi_startproc
pushl %ebp
.cfi_def_cfa_offset 8
.cfi_offset 5, -8
movl %esp, %ebp
.cfi_def_cfa_register 5
Then for:
0: 55 push %ebp
1: 89 e5 mov %esp,%ebp
3:
readelf -wf will show:
DW_CFA_advance_loc: 1 to 00000001
DW_CFA_def_cfa_offset: 8
DW_CFA_offset: r5 (ebp) at cfa-8
DW_CFA_advance_loc: 2 to 00000003
DW_CFA_def_cfa_register: r5 (ebp)
and readelf -wF will show:
LOC CFA ebp ra
00000000 esp+4 u c-4
00000001 esp+8 c-8 c-4
00000003 ebp+8 c-8 c-4
See DWARF .debug_frame documentation.
Jan
next prev parent reply other threads:[~2013-03-30 19:50 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-30 19:13 Richard Smith
2013-03-30 19:50 ` Jan Kratochvil [this message]
2013-03-30 20:07 ` Joel Brobecker
2013-03-30 21:03 ` Richard Smith
2013-03-30 23:53 ` Mike Frysinger
2013-03-31 5:48 ` Jan Kratochvil
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=20130330195008.GA11994@host2.jankratochvil.net \
--to=jan.kratochvil@redhat.com \
--cc=gdb@sourceware.org \
--cc=richard@ex-parrot.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