syms_from_objfile() warnings and win32-nat.c IO redirection (Was: suppress annoying warnings about cygwin1.dbg)

Pedro Alves pedro_alves@portugalmail.pt
Mon Oct 29 03:06:00 GMT 2007


Daniel Jacobowitz wrote:
> On Sat, Oct 13, 2007 at 02:21:56AM +0100, Pedro Alves wrote:
>>        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
> 
> Removing these warnings seems reasonable.  I'll be glad to be rid of
> them on GNU/Linux too:
> 
> warning: Lowest section in system-supplied DSO at 0xffffe000 is .hash at ffffe0b4
> 
>> +      else
>> +	{
>> +	  int flags = bfd_get_section_flags (objfile->obfd, lower_sect);
>> +	  if (flags == 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)));
>> +
>> +	  lower_offset = bfd_section_vma (objfile->obfd, lower_sect);
>> +	}
> 
> But why are you keeping this warning?  I'm not sure what flags == 0
> checks, but it's very unlikely to be true; most sections will have
> SEC_READONLY set.
> 

Blunder, it should have been:
+	  if ((flags & SEC_CODE)== 0)

to match this bit above:

-	if ((bfd_get_section_flags (objfile->obfd, lower_sect) & SEC_CODE) == 0)

which means I was trying to remove this warning:

-	warning (_("no loadable sections found in added symbol-file %s"),
-		 objfile->name);

but not touch that one:

> warning: Lowest section in system-supplied DSO at 0xffffe000 is .hash at ffffe0b4

as it doesn't affect the cygwin1.dbg case, because there are no
code sections there.  Somehow I lost the '& SEC_CODE' in the
process.

>> @@ -860,12 +860,7 @@ syms_from_objfile (struct objfile *objfi
>>                      addrs->other[i].sectindex = sect->index ;
>>                    }
>>                  else
>> -                  {
>> -                    warning (_("section %s not found in %s"),
>> -                             addrs->other[i].name,
>> -                             objfile->name);
>> -                    addrs->other[i].addr = 0;
>> -                  }
>> +		  addrs->other[i].addr = 0;
>>                }
>>              else
>>                addrs->other[i].addr = lower_offset;
> 
> I know you needed this one before because win32-nat.c specified an
> offset for .text manually.  I don't think it does so any more, though.
> This one's useful, since you can provoke it with a typo:
> 
> (gdb) add-symbol-file cat 1000 -s .dataz 24
> add symbol table from file "cat" at
>         .text_addr = 0x3e8
>         .dataz_addr = 0x18
> (y or n) y
> Reading symbols from /bin/cat...warning: section .dataz not found in /bin/cat
> 

Ah, right, I clearly see that now.  I just more or less blindly
removed the warnings that were being output.

We do get that warning today, because the cygwin1.dbg file only
contains the debug info sections, but ADDRS is filled with
every SEC_ALLOC | SEC_LOAD section of cygwin1.dll.  Would it be
OK to only do the warning if VERBO (it is set to from_tty in
the case you mentioned) or info_verbose are on?

Cheers,
Pedro Alves
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sepdebug_warnings.diff
Type: text/x-diff
Size: 1903 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20071029/a38fb59b/attachment.bin>


More information about the Gdb-patches mailing list