This is the mail archive of the gdb@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]

cross gdb for arm-freebsd


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.


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