gdb/gdb-6.6-vdso-i386-on-amd64-warning.patch

115 lines
4.3 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.8/gdb/symfile.c
===================================================================
--- 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)
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.
@@ -813,32 +845,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!!!
@@ -860,6 +871,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 ;
}
@@ -872,7 +884,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;
+ }
}
}