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: PATCH: PR corefiles/11511: gcore doesn't work with orig_rax on Linux/amd64


On Sun, Apr 18, 2010 at 2:32 PM, Mark Kettenis <mark.kettenis@xs4all.nl> wrote:
>> Date: Sat, 17 Apr 2010 11:50:11 -0700
>> From: "H.J. Lu" <hjl.tools@gmail.com>
>>
>> On Sat, Apr 17, 2010 at 9:25 AM, Mark Kettenis <mark.kettenis@xs4all.nl> wrote:
>> >> Date: Sat, 17 Apr 2010 09:11:15 -0700
>> >> From: "H.J. Lu" <hongjiu.lu@intel.com>
>> >>
>> >> This patch adds orig_rax support to amd64_linux_gregset_reg_offset.
>> >> amd64 has both tdep->gregset_reg_offset/tdep->gregset_num_regs and
>> >> amd64_native_gregset64_reg_offset/amd64_native_gregset64_num_regs. ?They
>> >> are identical. There is no need to keep both. ?This patch also removes
>> >> amd64_native_gregset64_reg_offset/amd64_native_gregset64_num_regs. OK
>> >> to install?
>> >
>> > No. ?I want to keep the -nat.c and -tdep.c code separate.
>>
>> Can I replace amd64_linux_gregset64_reg_offset with
>> amd64_linux_gregset_reg_offset, like amd64nbsd-nat.c
>> and amd64obsd-nat.c?
>
> We can discuss that, yes. ?The way the code is organized now, at least
> native debugging will continue to work if the layout of the trap frame
> in the Linux kernel were to change. ?At least in the past there was
> some fear that this would happen. ?That danger is probably small; I'm
> not even sure if the data structure for PTRACE_GETREGS is even linked
> to the trap frame layout anymore.
>
> Of course the benefit of doing so is that if the kernel ABI is ever
> broken GDB will completely stop working on Linux instead of just being
> partly broken.
>
> Any other people have an opinion about this?
>

I am CCing Peter, who is the Linux x86 kernel maintainer.

We have 2 general-purpose register maps in GDB. One is in nat.c:

/* Mapping between the general-purpose registers in GNU/Linux x86-64
   `struct user' format and GDB's register cache layout.  */

static int amd64_linux_gregset64_reg_offset[] =

It is used for reading/writing registers from/to kernel. One is in tdep.c:

/* Mapping between the general-purpose registers in `struct user'
   format and GDB's register cache layout.  */

/* From <sys/reg.h>.  */
static int amd64_linux_gregset_reg_offset[] =

It is use for reading/writing core dump.

Both are mappings between `struct user'  and  GDB's register cache.
It is very unlikely that the current x86 Linux kernel ABI for accessing
 `struct user' will change.  If the kernel ABI does need to change for
whatever reason, the new interface will be introduced.

This applies to both i386 and x86-64 Linux kernel. I'd like to keep
a single map between the general-purpose registers in `struct user'
format and GDB's register cache for i386/x86-64 Linux. Will such
a patch acceptable?

Thanks.


-- 
H.J.


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