Re: Segfaults with latest sources
Martin Husemann <[email protected]> Sat, 19 Mar 2016 20:28:57 +0100
| Newsgroups | gmane.os.netbsd.ports.evbmips,gmane.os.netbsd.ports.mips.devel |
|---|---|
| Message-ID | <[email protected]> |
On Mon, Mar 14, 2016 at 08:53:22PM -0500, John D. Baker wrote:
> > And you said you can't get gdb to work at all, even starting the binary
> > with it? Mips has not switched binutils yet, so that is not the problem.
>
> Trying to load the core file causes 'gdb' to complain:
>
> ".../ftp.core" is not a core dump: File format not recognized
This is a bit tricky to debug currently. Unfortunately a cross gdb
build with MKCROSSGDB=YES has no support for any core files at all - anyone
know how to fix configury to support this? It would be tremendeously
usefull for cases like this!
> Starting program: /usr/bin/ftp
> /x/nbsd-tst/src/external/gpl3/gdb.old/lib/libgdb/../../dist/gdb/mips-tdep.c:768: internal-error: bad register size
This happens because gdb can deal with debugging 32bit programs with a 64bit
gdb, but not the other way around:
static enum register_status
mips_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
int cookednum, gdb_byte *buf)
{
int rawnum = cookednum % gdbarch_num_regs (gdbarch);
gdb_assert (cookednum >= gdbarch_num_regs (gdbarch)
&& cookednum < 2 * gdbarch_num_regs (gdbarch));
we get: rawnum = 37, cookednum = 127, gdbarch_num_regs (gdbarch) = 90
Then code tests for 1:1 register sizes:
if (register_size (gdbarch, rawnum) == register_size (gdbarch, cookednum))
return regcache_raw_read (regcache, rawnum, buf);
but we have: register_size (gdbarch, rawnum) = 4 and
register_size (gdbarch, cookednum) = 8
Next is code that would deal the other direction:
else if (register_size (gdbarch, rawnum) >
register_size (gdbarch, cookednum))
{
but none for our:
else
internal_error (__FILE__, __LINE__, _("bad register size"));
Do we need to extend gdb or compile it as 64bit binary?
Martin