Re: cross gdb for arm-freebsd

John Hein
2011-11-01T19:57:49Z

Tom Tromey wrote at 13:24 -0600 on Nov 1, 2011:
> >>>>> "John" == John Hein <jhein-gdbml@snkmail.com> writes:
>
> John> The gdb in the base FreeBSD is quite old (6.1.1) and I'm having
> John> trouble debugging a core file from a threaded application. A newer
> John> gdb (7.2 and 7.3.1) are in FreeBSD's ports system, but getting it to
> John> build for --target=arm-freebsd and read core files is proving
> John> difficult - I could use a few hints.
>
> John> --- orig/armfbsd-tdep.c 2007-11-18 10:07:47.000000000 -0700
> John> +++ armfbsd-tdep.c 2011-10-31 10:14:58.000000000 -0600
>
> This file isn't in gdb. I guess it is a FreeBSD addition.

Indeed it is a FreeBSD addition. You removed a bit too much context
from my original email in your quote. Notably the svn url which
points out where armfbsd-tdep.c comes from:

John Hein wrote at 10:29 -0600 on Oct 31, 2011:
> The gdb in the base FreeBSD is quite old (6.1.1) and I'm having
> trouble debugging a core file from a threaded application. A newer
> gdb (7.2 and 7.3.1) are in FreeBSD's ports system, but getting it to
> build for --target=arm-freebsd and read core files is proving
> difficult - I could use a few hints.
>
> Since there is no support in the upstream latest gdb for a cross built
> arm-freebsd target (that I could see), I tried copying the
> architecture files from
> http://svnweb.freebsd.org/base/head/gnu/usr.bin/gdb/arch/arm/ and
> updating them for 7.3.1

Without using armfbsd-tdep.c and cross compiling the unmodified gdb
for --target=arm-freebsd, I get a different problem:

warning: A handler for the OS ABI "FreeBSD ELF" is not built into this configuration
of GDB. Attempting to continue with the default arm settings.

So, that's why I was looking into pulling in the FreeBSD specific
changes for the architecture files (except they are for gdb 6.1.1,
so some hacking is needed to get them building for gdb 7.2).

> John> It compiles, but I'm getting this when I try to debug a core file:
> [...]
>
> John> warning: "/tmp/core1.core": no core file handler recognizes format, using default
>
> I think this is probably the root of your problems. I suggest debugging
> gdb and stepping through sniff_core_bfd. I don't know this area well
> but I think this function should find the core file reader for your
> target.

Thanks. I'll dig in and report back.

"eof_eom_XYZ"