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

[patch 01/15] PIE: objfile_relocate() also objfile->psymtabs_addrmap


Hi,

Fix forgotten update of psymtabs_addrmap.

Found by Tom Tromey.

Loading PIE executables with this patchset which depends on objfile_relocate()
did print in some cases:
	warning: (Internal error: pc 0x2005b0 in read in psymtab, but not in symtab.)

And it even FAILs (fixed now) for the PIE run of gdb.dwarf2/dw2-ranges.exp:
	runtest --target_board unix/-fPIE/-pie gdb.dwarf2/dw2-ranges.exp
	info line func
	No line number information available for address 0x7ffff7ffe7b1 <func>
	(gdb) FAIL: gdb.dwarf2/dw2-ranges.exp: info line func


Thanks,
Jan


gdb/
	* objfiles.c (objfile_relocate): Update also the field psymtabs_addrmap.

gdb/testsuite/
	* gdb.dwarf2/dw2-ranges.exp: Call runto_main.

--- a/gdb/objfiles.c
+++ b/gdb/objfiles.c
@@ -680,6 +680,10 @@ objfile_relocate (struct objfile *objfile, struct section_offsets *new_offsets)
     }
   }
 
+  if (objfile->psymtabs_addrmap)
+    addrmap_relocate (objfile->psymtabs_addrmap,
+		      ANOFFSET (delta, SECT_OFF_TEXT (objfile)));
+
   {
     struct partial_symtab *p;
 
--- a/gdb/testsuite/gdb.dwarf2/dw2-ranges.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-ranges.exp
@@ -55,6 +55,12 @@ gdb_start
 gdb_reinitialize_dir $srcdir/$subdir
 gdb_load ${binfile}
 
+# Test also objfile->psymtabs_addrmap relocations for -fPIE -pie builds below.
+# On some targets it may possibly fail but the program is being started only
+# for the PIE build so try it anyway.
+
+runto_main
+
 # Correct output:
 # 	Line 39 of "../.././gdb/testsuite/gdb.dwarf2/dw2-ranges.S" starts at address 0x4 and ends at 0x8.
 # Wrong output:


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