public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: "John Hein" <jhein-gdbml@snkmail.com>
To: gdb@sourceware.org
Subject: cross gdb for arm-freebsd
Date: Mon, 31 Oct 2011 17:16:00 -0000	[thread overview]
Message-ID: <31555-1320078547-391519@sneakemail.com> (raw)

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.

             reply	other threads:[~2011-10-31 16:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-31 17:16 John Hein [this message]
2011-11-01 19:24 ` Tom Tromey
2011-11-01 19:57   ` John Hein
2011-11-01 20:23     ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=31555-1320078547-391519@sneakemail.com \
    --to=jhein-gdbml@snkmail.com \
    --cc=gdb@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).