This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH]: Use core regset when possible in linux-nat.c
- From: Daniel Jacobowitz <drow at false dot org>
- To: "David S. Miller" <davem at davemloft dot net>
- Cc: gdb-patches at sources dot redhat dot com, mark dot kettenis at xs4all dot nl
- Date: Sat, 8 Apr 2006 16:34:37 -0400
- Subject: Re: [PATCH]: Use core regset when possible in linux-nat.c
- References: <20060406.150330.76592441.davem@davemloft.net>
On Thu, Apr 06, 2006 at 03:03:30PM -0700, David S. Miller wrote:
> *1: The test in corefile.exp to look at the mmap() area pointed
> to by buf2 fails due to a Linux kernel bug, it doesn't dump
> mmap() areas which have not been written to into the core
> file so gdb can't look at it. I've posted a patch to linux-kernel
> already suggesting to take away that check in the ELF core dumper.
Or, we could just change the test. I don't know...
> 2006-04-06 David S. Miller <davem@sunset.davemloft.net>
>
> * linux-nat.c (linux_nat_do_thread_registers): Use the
> regset_from_core_section infrastructure if the target
> supports it.
> * Makefile.in: Update dependencies.
Almost. I know I suggested changing the fallback case from your
original suggestion, but this isn't quite what I meant:
> - fill_fpregset (&fpregs, -1);
> + if (core_regset_p)
> + {
> + regset = gdbarch_regset_from_core_section (gdbarch, ".reg2",
> + sizeof (fpregs));
> + regset->collect_regset (regset, current_regcache, -1,
> + &fpregs, sizeof (fpregs));
> + }
> + else
> + fill_fpregset (&fpregs, -1);
> note_data = (char *) elfcore_write_prfpreg (obfd,
> note_data,
> note_size,
> &fpregs, sizeof (fpregs));
A target which only defines .reg and not .reg2 will crash here.
We'd still have to check for non-NULL; I just think that if the
target supports regset_from_core_section, and still returns NULL,
that that's a pretty good hint we have nothing to write.
The other thing that bugs me about this interface may be harder to fix
- we're still assuming the two are the same, more or less, because the
regset type is required here and we use its sizeof. A problem for
another day?
--
Daniel Jacobowitz
CodeSourcery