This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFA bug fix -- x86-64 stabs and deprecated fp register


David,

On Fri, Nov 21, 2014 at 03:58:04PM -0500, David Taylor wrote:
> Sometimes when using STABS on x86-64 GNU/Linux, GDB does not know which
> register to use for the frame pointer and as a result offsets from the
> frame pointer are treated as absolute addresses rather than as
> offsets...
> 
> This patch provides a default for when the debug information doesn't
> specify which register to use.
> 
> We have seen this problem when debugging problems with a previous
> release of our software (I believe it was built with GCC 4.5.x, if that
> matters).
> 
> There were no regressions on x86-64 GNU/Linux.
> 
> 2014-11-21  David Taylor  <dtaylor@emc.com>
> 
> 	* amd64-tdep.c (amd64_init_abi): Set default frame pointer.

I don't think your patch is correct, as it is going to affect
the outcome of...

    (gdb) print $fp

... for frameless functions compiled with DWARF2. See
std-regs.c:value_of_builtin_frame_fp_reg.

If we were to apply your patch, it would unconditionally print
the contents of the %rbp register as the result, which is not
what we've been printing so far.

I wish I could suggest another approach but I haven't had to touch
stabs support in several years, now. If you provided a bit more details
as to what actually happened in the debugger and where, I might be
able to help you better.

> diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c
> index e69da01..5a68c33 100644
> --- a/gdb/amd64-tdep.c
> +++ b/gdb/amd64-tdep.c
> @@ -3006,6 +3006,8 @@ amd64_init_abi (struct gdbarch_info info, struct gdbarch *
> gdbarch)
>    set_gdbarch_ps_regnum (gdbarch, AMD64_EFLAGS_REGNUM); /* %eflags */
>    set_gdbarch_fp0_regnum (gdbarch, AMD64_ST0_REGNUM); /* %st(0) */
>  
> +  set_gdbarch_deprecated_fp_regnum (gdbarch, AMD64_RBP_REGNUM); /* %rbp */
> +
>    /* The "default" register numbering scheme for AMD64 is referred to
>       as the "DWARF Register Number Mapping" in the System V psABI.
>       The preferred debugging format for all known AMD64 targets is

-- 
Joel


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]