From: Petr Vandrovec <vandrove@vc.cvut.cz>
To: Dave Jiang <djiang@mvista.com>
Cc: Andi Kleen <ak@suse.de>, linux-kernel@vger.kernel.org
Subject: Re: x86_64 frame pointer via thread context
Date: Tue, 09 Aug 2005 00:29:15 +0200 [thread overview]
Message-ID: <42F7DCBB.3000607@vc.cvut.cz> (raw)
In-Reply-To: <42F7C9F9.7000505@mvista.com>
Dave Jiang wrote:
> Petr Vandrovec wrote:
>> #0 tb_sig_handler (sig=33, info=0x407ff2f0, ucontext=0x407ff1c0) at
>> ttest1.c:26
>> #1 <signal handler called>
>> #2 0x00002aaaaad81335 in nanosleep () from /lib/libc.so.6
>> #3 0x00002aaaaad811a5 in sleep () from /lib/libc.so.6
>> #4 0x0000000000400871 in test_thread1 (arg=0x0) at ttest1.c:40
>> #5 0x00002aaaaabc6b55 in start_thread () from /lib/libpthread.so.0
>> #6 0x00002aaaaada87f0 in clone () from /lib/libc.so.6
>
>
> Ooops, you are right. I forgot about those ones in the threads. Yes you
> are right. Once the sleep goes away rBP displays the correct values. Is
> this issue due to glibc or because of the toolchain? I do not have this
> issues on 32bit x86.... I would assume that the reason it works on
> Mandrake is due to the toolchain they use versus other distros? The
> toolchain determines which registers to use and the
> -fno-omit-frame-pointer did not prevent some of them from clobbering rbp?
You are building only your application with -fno-omit-frame-pointer,
libraries you are using are just used as is. On 32bit x86 it works
as -O2 on x86 does not imply -fomit-frame-pointer, as frame pointer
is required (well, was) for debugging. On x86-64 frame pointer is
not needed for debugging as it was always using DWARF debug info,
and so -O2 on x86-64 implies -fomit-frame-pointer. Due to this most
of libraries you'll find on your 64bit system are built without frame
pointer. Mandrake either explicitly asks for -fno-omit-frame-pointer,
or maybe their glibc is just sufficiently different that their sleep()
does not need %rbp for sleep().
Loading their glibc to the debugger and inspecting sleep & nanosleep
will reveal whether %rbp is just unchanged by these (and so it works
due to luck), or whether their sleep uses pushq %rbp; movq %rsp,%rbp
- in which case they built glibc with frame pointers for no apparent
reason.
You must use debugging informations to get stacktrace on x86-64.
Blindly following %rbp does not work on this architecture (and lot
of others).
Petr
next prev parent reply other threads:[~2005-08-08 22:29 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <42F3EC97.2060906@mvista.com.suse.lists.linux.kernel>
2005-08-06 11:54 ` x86_64 frame pointer via thread context Andi Kleen
2005-08-08 7:13 ` Jan Engelhardt
2005-08-08 17:27 ` Dave Jiang
2005-08-08 17:35 ` Dave Jiang
2005-08-08 18:35 ` Dave Jiang
2005-08-08 20:06 ` Petr Vandrovec
2005-08-08 20:19 ` Dave Jiang
2005-08-08 20:27 ` Petr Vandrovec
2005-08-08 21:09 ` Dave Jiang
2005-08-08 22:29 ` Petr Vandrovec [this message]
2005-08-05 22:47 Dave Jiang
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=42F7DCBB.3000607@vc.cvut.cz \
--to=vandrove@vc.cvut.cz \
--cc=ak@suse.de \
--cc=djiang@mvista.com \
--cc=linux-kernel@vger.kernel.org \
/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