From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicholas Duffek To: gdb-patches@sources.redhat.com Cc: Peter.Schauer@regent.e-technik.tu-muenchen.de, kevinb@cygnus.com Subject: [RFA] xcoffread.c: handle -bbigtoc binaries Date: Thu, 12 Apr 2001 12:02:00 -0000 Message-id: <200104121857.OAA27215@nog.bosbc.com> X-SW-Source: 2001-04/msg00120.html This patch prevents "pc 0x... in read in psymtab, but not in symtab" warnings when debugging binaries linked with -bbigtoc. Explanation: -bbigtoc binaries have extra sections named @FIX1 containing linker-generated code to perform data loads from distant locations. E.g., if 'foo' in the following instruction: lwz r9,foo(r2) is greater than 32767, the linker might replace the lwz with a branch to linker-generated code that does the load in 2 instructions and then branches back to where execution should continue. When xcoffread.c encounters such a section, it allocates a new psymtab for the range of linker-generated instructions contained in the section. However, the section doesn't associate those instructions with any functions. Consequently, when GDB tries to resolve one of those instructions to a symbolic name, it fails, resulting in the "pc 0x... in read in psymtab, but not in symtab" warning. The appended patch avoids that warning by ignoring section names beginning with '@'. ChangeLog: * xcoffread.c (scan_xcoff_symtab): Ignore symbols beginning with "@". Tested on powerpc-ibm-aix4.3.3.0. Okay to apply? Nicholas Duffek [patch follows] Index: gdb/xcoffread.c =================================================================== diff -up gdb/xcoffread.c gdb/xcoffread.c --- gdb/xcoffread.c Thu Apr 12 14:39:21 2001 +++ gdb/xcoffread.c Thu Apr 12 14:39:09 2001 @@ -2243,8 +2243,14 @@ scan_xcoff_symtab (struct objfile *objfi else csect_aux = main_aux[0]; - /* If symbol name starts with ".$" or "$", ignore it. */ - if (namestring[0] == '$' + /* If symbol name starts with ".$" or "$", ignore it. + + A symbol like "@FIX1" introduces a section for -bbigtoc jump + tables, which contain anonymous linker-generated code. + Ignore those sections to avoid "pc 0x... in read in psymtab, + but not in symtab" warnings from find_pc_sect_symtab. */ + + if (namestring[0] == '$' || namestring[0] == '@' || (namestring[0] == '.' && namestring[1] == '$')) break;