* [RFA] Simple patch for x86-64 (can go to 5.2?)
@ 2002-04-26 7:54 Michal Ludvig
2002-04-26 17:36 ` Andrew Cagney
0 siblings, 1 reply; 2+ messages in thread
From: Michal Ludvig @ 2002-04-26 7:54 UTC (permalink / raw)
To: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 996 bytes --]
This patch is a really simple one without any side-effects. The problem
is, that gcc for x86-64 by default has -fomit-frame-pointer switched on
when optimalization is requested. People don't know it and are
complaining that (diplomaticaly said) "gdb doesn't work" (depending on
their attitude :-). The only thing this patch does is, that it prints a
note, when x86_64_skip_prologue doesn't see "push %rbp" as the very
first instruction of a given function. The note is printed only once.
That's all. I'd like to see it in 5.2 to teach people that they should
explicitly use -fno-omit-frame-pointer when compiling a code for
debugging. Can I commit? I'll remove this note as soon as I fix dwarf2
reader to handle even optimized code.
2002-04-26 Michal Ludvig <mludvig@suse.cz>
* x86-64-tdep.c (x86_64_skip_prologue): Print note when debugging
code without frame pointers.
Michal Ludvig
--
* SuSE CR, s.r.o * mludvig@suse.cz
* +420 2 9654 5373 * http://www.suse.cz
[-- Attachment #2: omitfp1.diff --]
[-- Type: text/plain, Size: 1861 bytes --]
Index: x86-64-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/x86-64-tdep.c,v
retrieving revision 1.13
diff -c -3 -p -r1.13 x86-64-tdep.c
*** x86-64-tdep.c 6 Apr 2002 00:02:50 -0000 1.13
--- x86-64-tdep.c 26 Apr 2002 14:06:54 -0000
*************** static struct register_info x86_64_regis
*** 116,121 ****
--- 116,124 ----
int x86_64_num_regs = X86_64_NUM_REGS;
int x86_64_num_gregs = X86_64_NUM_GREGS;
+ /* Did we already print a note about frame pointer? */
+ int omit_fp_note_printed = 0;
+
/* Number of bytes of storage in the actual machine representation for
register REGNO. */
int
*************** x86_64_skip_prologue (CORE_ADDR pc)
*** 811,820 ****
read_memory (pc, (char *) prolog_buf, PROLOG_BUFSIZE);
! /* First check, whether pc points to pushq %rbp, movq %rsp,%rbp. */
! for (i = 0; i < PROLOG_BUFSIZE; i++)
! if (prolog_expect[i] != prolog_buf[i])
return pc;
v_function = find_pc_function (pc);
v_sal = find_pc_line (pc, 0);
--- 814,836 ----
read_memory (pc, (char *) prolog_buf, PROLOG_BUFSIZE);
! /* First check, whether pc points to pushq %rbp. If not,
! * print a recommendation to enable frame pointer. */
! if (prolog_expect[0] != prolog_buf[0])
! {
! if (!omit_fp_note_printed)
! {
! printf_filtered
! ("NOTE: This function doesn't seem to have a valid prologue.\n"
! " Try to add -fno-omit-frame-pointer tou your gcc's CFLAGS.\n");
! omit_fp_note_printed++;
! }
return pc;
+ }
+ /* Valid prolog continues with movq %rsp,%rbp. */
+ for (i = 1; i < PROLOG_BUFSIZE; i++)
+ if (prolog_expect[i] != prolog_buf[i])
+ return pc + 1; /* First instruction after pushq %rbp. */
v_function = find_pc_function (pc);
v_sal = find_pc_line (pc, 0);
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [RFA] Simple patch for x86-64 (can go to 5.2?)
2002-04-26 7:54 [RFA] Simple patch for x86-64 (can go to 5.2?) Michal Ludvig
@ 2002-04-26 17:36 ` Andrew Cagney
0 siblings, 0 replies; 2+ messages in thread
From: Andrew Cagney @ 2002-04-26 17:36 UTC (permalink / raw)
To: Michal Ludvig; +Cc: gdb-patches
> This patch is a really simple one without any side-effects. The problem is, that gcc for x86-64 by default has -fomit-frame-pointer switched on when optimalization is requested. People don't know it and are complaining that (diplomaticaly said) "gdb doesn't work" (depending on their attitude :-). The only thing this patch does is, that it prints a note, when x86_64_skip_prologue doesn't see "push %rbp" as the very first instruction of a given function. The note is printed only once. That's all. I'd like to see it in 5.2 to teach people that they should explicitly use -fno-omit-frame-pointer when compiling a code for debugging. Can I commit? I'll remove this note as soon as I fix dwarf2 reader to handle even optimized code.
>
> 2002-04-26 Michal Ludvig <mludvig@suse.cz>
> * x86-64-tdep.c (x86_64_skip_prologue): Print note when debugging
> code without frame pointers.
Sigh (you've figured out the one thing that will make me delay a release :-)
Yes, I've committed it (can you please create a bug report explaining
the warning message).
Andrew
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2002-04-27 0:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-26 7:54 [RFA] Simple patch for x86-64 (can go to 5.2?) Michal Ludvig
2002-04-26 17:36 ` Andrew Cagney
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox