As Stefan Fischer wrote:
> Noch nicht mal ein -fomit-frame-pointer? Wenn ich richtig gelesen habe
> (bin gerade erst beim gcc-Einstieg), spart das doch ein Register...
Es macht den Code nur undebuggable...
Der Framepointer wird bei vielen Funktionen ja dennoch benötigt. Hier
mal ein simples foo.c, einmal mit und einmal ohne
-fomit-frame-pointer, davon ein diff:
--- foo.s1 Mon Mar 5 21:28:26 2001
+++ foo.s Mon Mar 5 21:28:46 2001
@@ -6,12 +6,10 @@
.globl foo
.type foo,@function
foo:
- pushl %ebp
- movl %esp,%ebp
- subl $16,%esp
+ subl $20,%esp
pushl %esi
pushl %ebx
- movl 8(%ebp),%ebx
+ movl 32(%esp),%ebx
addl $-12,%esp
pushl %ebx
call foobar
@@ -21,10 +19,10 @@
pushl %ebx
call foobar
imull %esi,%eax
- leal -24(%ebp),%esp
+ addl $32,%esp
popl %ebx
popl %esi
- leave
+ addl $20,%esp
ret
.Lfe1:
.size foo,.Lfe1-foo
Man spart zwei Befehle und ein Stückchen im Stack, aber das war's
schon. Und man kann keinen einzigen Coredump mehr damit debuggen...
Hat man den Framepointer dagegen drin, kann man (zumindest auf i386)
im Falle eines Coredumps das Binary anschließend nochmal mit -g (und
ansonsten identischen -O's) recompilieren und bekommt denselben Code
wie zuvor ohne -g, so daß man einen ,,zufällig herumliegenden'' und
nicht so schnell wieder reproduzierbaren Dump analysieren kann.
-- cheers, J"org .-.-. --... ...-- -.. . DL8DTL http://www.sax.de/~joerg/ NIC: JW11-RIPE Never trust an operating system you don't have sources for. ;-) To Unsubscribe: send mail to majordomo(at)de.FreeBSD.org with "unsubscribe de-bsd-questions" in the body of the messageReceived on Mon 05 Mar 2001 - 21:50:44 CET