From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30452 invoked by alias); 31 Oct 2011 16:29:25 -0000 Received: (qmail 30432 invoked by uid 22791); 31 Oct 2011 16:29:22 -0000 X-SWARE-Spam-Status: No, hits=-1.6 required=5.0 tests=AWL,BAYES_00,HK_RANDOM_ENVFROM,RCVD_IN_DNSWL_LOW,TW_GJ,TW_YM X-Spam-Check-By: sourceware.org Received: from sneak2.sneakemail.com (HELO sneak2.sneakemail.com) (38.113.6.65) by sourceware.org (qpsmtpd/0.43rc1) with SMTP; Mon, 31 Oct 2011 16:29:08 +0000 Received: (qmail 7765 invoked from network); 31 Oct 2011 16:29:07 -0000 Received: from unknown (HELO localhost.localdomain) (192.168.0.1) by sneak2.sneakemail.com with SMTP; 31 Oct 2011 16:29:07 -0000 Received: from 206.168.13.214 by mail.sneakemail.com with SMTP; 31 Oct 2011 16:29:07 -0000 Received: (sneakemail censored 31555-1320078547-391519 #3); 31 Oct 2011 16:29:07 -0000 Received: (sneakemail censored 31555-1320078547-391519 #2); 31 Oct 2011 16:29:07 -0000 Received: (sneakemail censored 31555-1320078547-391519 #1); 31 Oct 2011 16:29:07 -0000 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <31555-1320078547-391519@sneakemail.com> Date: Mon, 31 Oct 2011 17:16:00 -0000 From: "John Hein" To: gdb@sourceware.org Subject: cross gdb for arm-freebsd X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2011-10/txt/msg00237.txt.bz2 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 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: . 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.