Re: MI testsuite fix

Pedro Alves
2008-04-21T11:36:21Z

[-- Attachment #1: Type: text/plain, Size: 2275 bytes --]

A Monday 14 April 2008 19:21:31, Daniel Jacobowitz wrote:
> On Thu, Apr 10, 2008 at 09:02:07PM +0100, Pedro Alves wrote:
> > It is also arguable if that warning has any value, but in any case,
> > we should be filtering warnings.
>
> I am not sure this is true. Warning the user about this sort of
> thing should imply something really wrong; otherwise, bothering
> the user (who probably can not do anything about it except report it
> to us) is not very helpful. And during the testsuite there shouldn't
> be anything wrong that the user (i.e. the testsuite harness) can't
> fix.
>

Fair enough.

> As for the warning itself, I'd approve a patch to remove it.

Ok, that's what the attached does. Regtested on
x86_64-unknown-linux-gnu, and confirmed that is also fixes the
async MI testsuite on x86 due to the gate page warning.

BTW, What is it that won't work with the look for .text first?

/* 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,

> I'd also
> approve a patch to reuse some of the qOffsets machinery for this, but
> that would take more testing... if you want to look at that,
> keep in mind that SEC_LOAD doesn't mean the VMA is useful; you
> also need to check !SEC_THREAD_LOCAL.

Now you've lost me. This is mapping absolute section addresses
to section offsets. It doesn't seem symfile_map_offsets_to_segments
or objfile_relocate would give any help here?

I could see passing OFFSETS instead ADDRS in more cases where we
want to pass addresses/offsets for all sections so we wouldn't have
to rely on sections names for addr->offset mapping. There's the
unfortunaty that xcoff_symfile_offsets ignores ADDRS, but I'm sure
something could be done about it.

(While I was looking at it, I've reorganized the code to use
objfile_relocate after reading the symbols, instead of setting
the section offsets before reading them, but it didn't
give any simplification, so I dropped it.)

What machinery do you mean exactly?

--
Pedro Alves

[-- Attachment #2: remove_warning.diff --]
[-- Type: text/x-diff, Size: 1433 bytes --]

2008-04-21 Pedro Alves <pedro@codesourcery.com>

* symfile.c (syms_from_objfile): Don't warn if lowest loadable
section is not a code section.

---
gdb/symfile.c | 17 ++++++-----------
1 file changed, 6 insertions(+), 11 deletions(-)

Index: src/gdb/symfile.c
===================================================================
--- src.orig/gdb/symfile.c 2008-04-18 22:12:58.000000000 +0100
+++ src/gdb/symfile.c 2008-04-18 22:14:02.000000000 +0100
@@ -821,18 +821,13 @@ syms_from_objfile (struct objfile *objfi
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);
+ {
+ warning (_("no loadable sections found in added symbol-file %s"),
+ objfile->name);
+ lower_offset = 0;
+ }
else
- lower_offset = 0;
+ lower_offset = bfd_section_vma (objfile->obfd, lower_sect);

/* Calculate offsets for the loadable sections.
FIXME! Sections must be in order of increasing loadable section