eb9d945afa
- Fix rereading of the main executable on its change.
123 lines
4.6 KiB
Diff
123 lines
4.6 KiB
Diff
Fix i386-on-x86_64 debugging giving the warning:
|
|
warning: Lowest section in system-supplied DSO at 0xffffe000 is .hash at ffffe0b4
|
|
|
|
[base]
|
|
|
|
2007-10-16 Jan Kratochvil <jan.kratochvil@redhat.com>
|
|
|
|
Port to GDB-6.7.
|
|
|
|
Index: gdb-6.7/gdb/symfile.c
|
|
===================================================================
|
|
--- gdb-6.7.orig/gdb/symfile.c 2007-10-16 16:46:30.000000000 +0200
|
|
+++ gdb-6.7/gdb/symfile.c 2007-10-16 20:08:42.000000000 +0200
|
|
@@ -717,6 +717,38 @@ default_symfile_segments (bfd *abfd)
|
|
return data;
|
|
}
|
|
|
|
+/* Find lowest loadable section to be used as starting point for continguous
|
|
+ sections. FIXME!! won't work without call to find .text first, but this
|
|
+ assumes text is lowest section. vDSO was seen for i386-on-amd64 processes
|
|
+ to have no `.text' as it has `.text.vsyscall', `.text.sigreturn' etc.
|
|
+ instead. Execution of this function has been delayed till it is really
|
|
+ needed as it is broken for vDSOs, fortunately it is never needed on
|
|
+ GNU/Linux. */
|
|
+
|
|
+static CORE_ADDR
|
|
+find_lower_offset (struct objfile *objfile)
|
|
+{
|
|
+ asection *lower_sect;
|
|
+
|
|
+ lower_sect = bfd_get_section_by_name (objfile->obfd, ".text");
|
|
+ if (lower_sect == NULL)
|
|
+ bfd_map_over_sections (objfile->obfd, find_lowest_section,
|
|
+ &lower_sect);
|
|
+ if (lower_sect == NULL)
|
|
+ warning (_("no loadable sections found in added symbol-file %s"),
|
|
+ objfile->name);
|
|
+ else
|
|
+ if ((bfd_get_section_flags (objfile->obfd, lower_sect) & SEC_CODE) == 0)
|
|
+ warning (_("Lowest section in %s is %s at %s"),
|
|
+ objfile->name,
|
|
+ bfd_section_name (objfile->obfd, lower_sect),
|
|
+ paddr (bfd_section_vma (objfile->obfd, lower_sect)));
|
|
+ if (lower_sect != NULL)
|
|
+ return bfd_section_vma (objfile->obfd, lower_sect);
|
|
+ else
|
|
+ return 0;
|
|
+}
|
|
+
|
|
/* Process a symbol file, as either the main file or as a dynamically
|
|
loaded file.
|
|
|
|
@@ -815,32 +847,11 @@ syms_from_objfile (struct objfile *objfi
|
|
happens for the PA64 port. */
|
|
if (/*!mainline &&*/ addrs && addrs->other[0].name)
|
|
{
|
|
- asection *lower_sect;
|
|
asection *sect;
|
|
- CORE_ADDR lower_offset;
|
|
+ CORE_ADDR lower_offset = 0; /* Shut up the GCC warning. */
|
|
+ int lower_offset_set = 0;
|
|
int i;
|
|
|
|
- /* Find lowest loadable section to be used as starting point for
|
|
- continguous sections. FIXME!! won't work without call to find
|
|
- .text first, but this assumes text is lowest section. */
|
|
- lower_sect = bfd_get_section_by_name (objfile->obfd, ".text");
|
|
- if (lower_sect == NULL)
|
|
- bfd_map_over_sections (objfile->obfd, find_lowest_section,
|
|
- &lower_sect);
|
|
- if (lower_sect == NULL)
|
|
- warning (_("no loadable sections found in added symbol-file %s"),
|
|
- objfile->name);
|
|
- else
|
|
- if ((bfd_get_section_flags (objfile->obfd, lower_sect) & SEC_CODE) == 0)
|
|
- warning (_("Lowest section in %s is %s at %s"),
|
|
- objfile->name,
|
|
- bfd_section_name (objfile->obfd, lower_sect),
|
|
- paddr (bfd_section_vma (objfile->obfd, lower_sect)));
|
|
- if (lower_sect != NULL)
|
|
- lower_offset = bfd_section_vma (objfile->obfd, lower_sect);
|
|
- else
|
|
- lower_offset = 0;
|
|
-
|
|
/* Calculate offsets for the loadable sections.
|
|
FIXME! Sections must be in order of increasing loadable section
|
|
so that contiguous sections can use the lower-offset!!!
|
|
@@ -862,6 +873,7 @@ syms_from_objfile (struct objfile *objfi
|
|
addrs->other[i].addr
|
|
-= bfd_section_vma (objfile->obfd, sect);
|
|
lower_offset = addrs->other[i].addr;
|
|
+ lower_offset_set = 1;
|
|
/* This is the index used by BFD. */
|
|
addrs->other[i].sectindex = sect->index ;
|
|
}
|
|
@@ -874,7 +886,17 @@ syms_from_objfile (struct objfile *objfi
|
|
}
|
|
}
|
|
else
|
|
- addrs->other[i].addr = lower_offset;
|
|
+ {
|
|
+ /* Delay finding LOWER_OFFSET only if it is needed. Otherwise
|
|
+ we would print a warning to detect a values never used. */
|
|
+ if (!lower_offset_set)
|
|
+ {
|
|
+ lower_offset = find_lower_offset (objfile);
|
|
+ lower_offset_set = 1;
|
|
+ }
|
|
+
|
|
+ addrs->other[i].addr = lower_offset;
|
|
+ }
|
|
}
|
|
}
|
|
|
|
@@ -1174,7 +1196,6 @@ symbol_file_add_from_bfd (bfd *abfd, int
|
|
mainline, flags);
|
|
}
|
|
|
|
-
|
|
/* Process a symbol file, as either the main file or as a dynamically
|
|
loaded file. See symbol_file_add_with_addrs_or_offsets's comments
|
|
for details. */
|