[PATCH] Fix target architecture address size inside gdbarch structure
Simon Marchi
simon.marchi@polymtl.ca
Tue Oct 16 21:13:00 GMT 2018
On 2018-10-16 08:03, Denis Dmitriev wrote:
> Hi all,
> GDB can't get information about instructions when debugging
> mips:octeon2
> architecture.
> The problem is that the gdbarch structure contains the wrong address
> size
> for target architecture (gdbarch->addr_bit, 32).
> However, in the same structure there is data settings for the target
> architecture (mips:octeon2) which indicate the correct address size
> (gdbarch->bfd_arch_info->bits_per_address, 64).
> This patch fixes creation gdbarch structure. Now the address size is
> taken
> directly from the settings (gdbarch->bfd_arch_info).
Hi Denis,
This file (gdbarch.c) is generated from gdbarch.sh, so it can't be
modified directly. What you see here:
gdbarch->addr_bit = gdbarch_ptr_bit (gdbarch);
is the result from the default value of the addr_bit property in
gdbarch.sh:
402 v;int;addr_bit;;;8 * sizeof (void*);0;gdbarch_ptr_bit (gdbarch);
So if any modification needs to be done here, it needs to be in
gdbarch.sh.
However, I tried generating an executable with:
$ mips64el-linux-gnuabi64-gcc --versio
mips64el-linux-gnuabi64-gcc (Ubuntu 5.4.0-6ubuntu1~16.04.9) 5.4.0
20160609
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is
NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.
$ mips64el-linux-gnuabi64-gcc test.c -o test
And the resulting addr_bit and ptr_bit in gdb are both 64. From you
explanations, I get that the value you get for ptr_bit is 32. Is this
value the right one, or it should be 64?
Could you share how you generate you executable, with what toolchain,
etc?
Simon
More information about the Gdb-patches
mailing list