public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* cross gdb for arm-freebsd
@ 2011-10-31 17:16 John Hein
  2011-11-01 19:24 ` Tom Tromey
  0 siblings, 1 reply; 4+ messages in thread
From: John Hein @ 2011-10-31 17:16 UTC (permalink / raw)
  To: gdb

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

I made the following changes:

--- orig/armfbsd-tdep.c	2007-11-18 10:07:47.000000000 -0700
+++ armfbsd-tdep.c	2011-10-31 10:14:58.000000000 -0600
@@ -26,6 +26,7 @@
 #include "arch-utils.h"
 #include "arm-tdep.h"
 #include "solib-svr4.h"
+#include "target.h"
 
 /* Description of the longjmp buffer.  */
 #define ARM_FBSD_JB_PC 24
@@ -52,8 +53,7 @@
   arm_freebsd_init_abi_common (info, gdbarch);
 
   /* FreeBSD ELF uses SVR4-style shared libraries.  */
-  set_gdbarch_in_solib_call_trampoline
-    (gdbarch, generic_in_solib_call_trampoline);
+  set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
   set_solib_svr4_fetch_link_map_offsets
     (gdbarch, svr4_ilp32_fetch_link_map_offsets);
 
and 

--- configure.tgt.orig	2010-04-27 15:01:14.000000000 -0600
+++ configure.tgt	2011-10-31 08:38:12.000000000 -0600
@@ -81,6 +81,10 @@
 			solib.o solib-svr4.o symfile-mem.o corelow.o linux-tdep.o"
 	build_gdbserver=yes
 	;;
+arm*-*-freebsd*)
+	# Target: FreeBSD/arm
+	gdb_target_obs="arm-tdep.o armfbsd-tdep.o corelow.o solib.o solib-svr4.o"
+	;;
 arm*-*-netbsd* | arm*-*-knetbsd*-gnu)
 	# Target: NetBSD/arm
 	gdb_target_obs="arm-tdep.o armnbsd-tdep.o solib.o solib-svr4.o"


It compiles, but I'm getting this when I try to debug a core file:

GNU gdb (GDB) 7.2
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=i386-portbld-freebsd8.2 --target=arm-freebsd".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
warning: "/tmp/core1.core": no core file handler recognizes format, using default
Can't fetch registers from this type of core file
warning: .dynamic section for "/tmp/crossroot/lib/libthr.so.3" is not at the expected address (wrong library or version mismatch?)
Can't fetch registers from this type of core file
Can't fetch registers from this type of core file
#0  0x00000000 in ?? ()
(gdb)

Does anyone have hints to steer me in the right direction to read the core file?

Oh, also for FreeBSD 8.x, the base version of binutils is at 2.15, but
also a newer version is available in ports also.  However, my
application is built using the base version.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: cross gdb for arm-freebsd
  2011-10-31 17:16 cross gdb for arm-freebsd John Hein
@ 2011-11-01 19:24 ` Tom Tromey
  2011-11-01 19:57   ` John Hein
  0 siblings, 1 reply; 4+ messages in thread
From: Tom Tromey @ 2011-11-01 19:24 UTC (permalink / raw)
  To: John Hein; +Cc: gdb

>>>>> "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.

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.

Tom

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: cross gdb for arm-freebsd
  2011-11-01 19:24 ` Tom Tromey
@ 2011-11-01 19:57   ` John Hein
  2011-11-01 20:23     ` Tom Tromey
  0 siblings, 1 reply; 4+ messages in thread
From: John Hein @ 2011-11-01 19:57 UTC (permalink / raw)
  To: gdb, gdb, Tom Tromey

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"

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: cross gdb for arm-freebsd
  2011-11-01 19:57   ` John Hein
@ 2011-11-01 20:23     ` Tom Tromey
  0 siblings, 0 replies; 4+ messages in thread
From: Tom Tromey @ 2011-11-01 20:23 UTC (permalink / raw)
  To: John Hein; +Cc: gdb

>>>>> "John" == John Hein <jhein-gdbml@snkmail.com> writes:

Tom> This file isn't in gdb.  I guess it is a FreeBSD addition.

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

Oops, sorry about that.

Tom

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-11-01 20:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-31 17:16 cross gdb for arm-freebsd John Hein
2011-11-01 19:24 ` Tom Tromey
2011-11-01 19:57   ` John Hein
2011-11-01 20:23     ` Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).