From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10868 invoked by alias); 18 Aug 2003 04:59:37 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 10470 invoked from network); 18 Aug 2003 04:59:35 -0000 Received: from unknown (HELO mms1.broadcom.com) (63.70.210.58) by sources.redhat.com with SMTP; 18 Aug 2003 04:59:35 -0000 Received: from 63.70.210.1 by mms1.broadcom.com with ESMTP (Broadcom SMTP Relay (MMS v5.5.3)); Sun, 17 Aug 2003 21:58:32 -0700 Received: from mail-sj1-5.sj.broadcom.com (mail-sj1-5.sj.broadcom.com [10.16.128.236]) by mon-irva-11.broadcom.com (8.9.1/8.9.1) with ESMTP id VAA13486; Sun, 17 Aug 2003 21:58:04 -0700 (PDT) Received: from ldt-sj3-010.sj.broadcom.com (ldt-sj3-010 [10.21.64.10]) by mail-sj1-5.sj.broadcom.com (8.12.9/8.12.9/SSF) with ESMTP id h7I4wUov028170; Sun, 17 Aug 2003 21:58:30 -0700 (PDT) Received: (from cgd@localhost) by ldt-sj3-010.sj.broadcom.com ( 8.11.6/8.9.3) id h7I4wUr07019; Sun, 17 Aug 2003 21:58:30 -0700 X-Authentication-Warning: ldt-sj3-010.sj.broadcom.com: cgd set sender to cgd@broadcom.com using -f To: micrio@mv.com cc: gdb@sources.redhat.com, binutils@sources.redhat.com Subject: Re: MIPS64 problem with symbols References: <20030818025436.GP21328@tausq.org> <005501c36536$e96251c0$c9d145cc@lndnnh.adelphia.net> From: cgd@broadcom.com Date: Mon, 18 Aug 2003 04:59:00 -0000 In-Reply-To: Message-ID: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 MIME-Version: 1.0 X-WSS-ID: 135E8372152624-01-01 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-SW-Source: 2003-08/txt/msg00183.txt.bz2 At Mon, 18 Aug 2003 03:15:41 +0000 (UTC), "Peter Reilley" wrote: > I have built a GDB cross tool for the MIPS 64 bit processor hosted > on Intel Linux. GDB works OK in controlling the target but symbols > fail to load. In particular, the start address is truncated to 32 bits. > My base address is 0xffffffffa0080000. When I load symbols > I get an error message; > > (Internal error: pc 0xa0080000 in read in psymtab, but not in symtab.) > > The symbols in the elf file look OK so I think that the problem is > in GDB. Is cross GDB known to work on 64 bit targets when hosted > on a 32 bit Intel host? what kind of symbols? I ran across something the other week w/ STABS-in-ELF, which i solved like the following patches, but i've not tested them well for MIPS, let alone for other targets. i'm a bit uncomfortable with them because not all of the the stabs values are VMAs, but it would have been harder to fix it better (and i'm not really worried about 2G offsets into peoples' .o files / executables). (If you've got an executable or .o file that big, use a better bloody debugging format. 8-) they did do well enough for my few initial tests, though, which were addr2line and objdump --stabs on KSEG0/KSEG1 programs (kernels, firmware). Consider these contributed. If somebody wants to test them well enough to be included, great, but i've got other fish to fry right now. 8-) chris -- [ bfd/ChangeLog ] * syms.c (_bfd_stab_section_find_nearest_line): Handle sign extension of VMAs used in stabs. [ gas/ChangeLog ] * rddbg.c (read_section_stabs_debugging_info): Handle sign extension of VMAs used in stabs. Index: bfd/syms.c =================================================================== RCS file: /projects/bbp/cvsroot/systemsw/tools/src/binutils/bfd/syms.c,v retrieving revision 1.1.1.9 retrieving revision 1.10 diff -u -p -r1.1.1.9 -r1.10 --- syms.c 2003/07/26 05:39:17 1.1.1.9 +++ syms.c 2003/08/07 22:46:07 1.10 @@ -899,12 +899,17 @@ _bfd_stab_section_find_nearest_line (bfd char *directory_name; int saw_fun; bfd_boolean saw_line, saw_func; + int sext_vma; *pfound = FALSE; *pfilename = bfd_get_filename (abfd); *pfnname = NULL; *pline = 0; + sext_vma = bfd_get_sign_extend_vma (abfd); + if (sext_vma == -1) + sext_vma = 0; + /* Stabs entries use a 12 byte format: 4 byte string table index 1 byte stab type @@ -1111,7 +1116,10 @@ _bfd_stab_section_find_nearest_line (bfd and directory. */ if (saw_fun == 0) { - info->indextable[i].val = bfd_get_32 (abfd, last_stab + VALOFF); + if (sext_vma) + info->indextable[i].val = bfd_get_signed_32 (abfd, last_stab + VALOFF); + else + info->indextable[i].val = bfd_get_32 (abfd, last_stab + VALOFF); info->indextable[i].stab = last_stab; info->indextable[i].str = str; info->indextable[i].directory_name = directory_name; @@ -1166,7 +1174,10 @@ _bfd_stab_section_find_nearest_line (bfd if (name == NULL) continue; - info->indextable[i].val = bfd_get_32 (abfd, stab + VALOFF); + if (sext_vma) + info->indextable[i].val = bfd_get_signed_32 (abfd, stab + VALOFF); + else + info->indextable[i].val = bfd_get_32 (abfd, stab + VALOFF); info->indextable[i].stab = stab; info->indextable[i].str = str; info->indextable[i].directory_name = directory_name; @@ -1179,7 +1190,11 @@ _bfd_stab_section_find_nearest_line (bfd if (saw_fun == 0) { - info->indextable[i].val = bfd_get_32 (abfd, last_stab + VALOFF); + if (sext_vma) + info->indextable[i].val = bfd_get_signed_32 (abfd, last_stab + VALOFF); + else + info->indextable[i].val = bfd_get_32 (abfd, last_stab + VALOFF); + info->indextable[i].stab = last_stab; info->indextable[i].str = str; info->indextable[i].directory_name = directory_name; @@ -1267,7 +1282,10 @@ _bfd_stab_section_find_nearest_line (bfd { case N_SOL: /* The name of an include file. */ - val = bfd_get_32 (abfd, stab + VALOFF); + if (sext_vma) + val = bfd_get_signed_32 (abfd, stab + VALOFF); + else + val = bfd_get_32 (abfd, stab + VALOFF); if (val <= offset) { file_name = (char *) str + bfd_get_32 (abfd, stab + STRDXOFF); @@ -1281,8 +1299,11 @@ _bfd_stab_section_find_nearest_line (bfd /* A line number. If the function was specified, then the value is relative to the start of the function. Otherwise, the value is an absolute address. */ - val = ((indexentry->function_name ? indexentry->val : 0) - + bfd_get_32 (abfd, stab + VALOFF)); + if (sext_vma) + val = bfd_get_signed_32 (abfd, stab + VALOFF); + else + val = bfd_get_32 (abfd, stab + VALOFF); + val += indexentry->function_name ? indexentry->val : 0; /* If this line starts before our desired offset, or if it's the first line we've been able to find, use it. The !saw_line check works around a bug in GCC 2.95.3, which emits Index: binutils/rddbg.c =================================================================== RCS file: /projects/bbp/cvsroot/systemsw/tools/src/binutils/binutils/rddbg.c,v retrieving revision 1.1.1.5 retrieving revision 1.7 diff -u -p -r1.1.1.5 -r1.7 --- rddbg.c 2003/04/28 18:29:43 1.1.1.5 +++ rddbg.c 2003/08/07 22:46:09 1.7 @@ -114,10 +114,15 @@ read_section_stabs_debugging_info (abfd, { "LC_SYMTAB.stabs", "LC_SYMTAB.stabstr" } }; unsigned int i; PTR shandle; + int sext_vma; *pfound = FALSE; shandle = NULL; + sext_vma = bfd_get_sign_extend_vma (abfd); + if (sext_vma == -1) + sext_vma = 0; + for (i = 0; i < sizeof names / sizeof names[0]; i++) { asection *sec, *strsec; @@ -176,7 +181,10 @@ read_section_stabs_debugging_info (abfd, type = bfd_get_8 (abfd, stab + 4); other = bfd_get_8 (abfd, stab + 5); desc = bfd_get_16 (abfd, stab + 6); - value = bfd_get_32 (abfd, stab + 8); + if (sext_vma) + value = bfd_get_signed_32 (abfd, stab + 8); + else + value = bfd_get_32 (abfd, stab + 8); if (type == 0) {