2007-10-08 19:12:38 +00:00
|
|
|
Fix i386-on-x86_64 debugging giving the warning:
|
|
|
|
warning: Lowest section in system-supplied DSO at 0xffffe000 is .hash at ffffe0b4
|
|
|
|
|
2007-11-01 20:24:20 +00:00
|
|
|
[base]
|
2007-10-08 19:12:38 +00:00
|
|
|
|
2007-11-01 20:24:20 +00:00
|
|
|
2007-10-16 Jan Kratochvil <jan.kratochvil@redhat.com>
|
|
|
|
|
|
|
|
Port to GDB-6.7.
|
|
|
|
|
2008-07-14 09:09:04 +00:00
|
|
|
Index: gdb-6.8/gdb/symfile.c
|
2007-11-01 20:24:20 +00:00
|
|
|
===================================================================
|
2008-07-14 09:09:04 +00:00
|
|
|
--- gdb-6.8.orig/gdb/symfile.c 2008-07-14 10:28:15.000000000 +0200
|
|
|
|
+++ gdb-6.8/gdb/symfile.c 2008-07-14 10:28:21.000000000 +0200
|
|
|
|
@@ -715,6 +715,38 @@ default_symfile_segments (bfd *abfd)
|
2007-11-01 20:24:20 +00:00
|
|
|
return data;
|
2007-10-08 19:12:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
+/* 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;
|
|
|
|
+}
|
2007-11-01 20:24:20 +00:00
|
|
|
+
|
2007-10-08 19:12:38 +00:00
|
|
|
/* Process a symbol file, as either the main file or as a dynamically
|
|
|
|
loaded file.
|
2007-11-01 20:24:20 +00:00
|
|
|
|
2008-07-14 09:09:04 +00:00
|
|
|
@@ -813,32 +845,11 @@ syms_from_objfile (struct objfile *objfi
|
2007-10-08 19:12:38 +00:00
|
|
|
happens for the PA64 port. */
|
2008-07-14 09:09:04 +00:00
|
|
|
if (!mainline && addrs && addrs->other[0].name)
|
2007-10-08 19:12:38 +00:00
|
|
|
{
|
|
|
|
- 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!!!
|
2008-07-14 09:09:04 +00:00
|
|
|
@@ -860,6 +871,7 @@ syms_from_objfile (struct objfile *objfi
|
2007-10-08 19:12:38 +00:00
|
|
|
addrs->other[i].addr
|
|
|
|
-= bfd_section_vma (objfile->obfd, sect);
|
|
|
|
lower_offset = addrs->other[i].addr;
|
2007-11-01 20:24:20 +00:00
|
|
|
+ lower_offset_set = 1;
|
2007-10-08 19:12:38 +00:00
|
|
|
/* This is the index used by BFD. */
|
|
|
|
addrs->other[i].sectindex = sect->index ;
|
|
|
|
}
|
2008-07-14 09:09:04 +00:00
|
|
|
@@ -872,7 +884,17 @@ syms_from_objfile (struct objfile *objfi
|
2007-10-08 19:12:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
- addrs->other[i].addr = lower_offset;
|
2007-11-01 20:24:20 +00:00
|
|
|
+ {
|
|
|
|
+ /* 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;
|
|
|
|
+ }
|
2007-10-08 19:12:38 +00:00
|
|
|
+
|
2007-11-01 20:24:20 +00:00
|
|
|
+ addrs->other[i].addr = lower_offset;
|
|
|
|
+ }
|
2007-10-08 19:12:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|