Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Pedro Alves" <pedro_alves@portugalmail.pt>
To: gdb-patches@sourceware.org, insight@sourceware.org
Subject: Re: syms_from_objfile() warnings and win32-nat.c IO redirection (Was: suppress annoying warnings about cygwin1.dbg)
Date: Mon, 29 Oct 2007 12:33:00 -0000	[thread overview]
Message-ID: <4053daab0710290203q5aa79bam6a8e87e5c6a837ba@mail.gmail.com> (raw)
In-Reply-To: <4725378D.5010800@portugalmail.pt>

Pedro Alves wrote:
> -       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.
>

> >> -                    warning (_("section %s not found in %s"),
> >> -                             addrs->other[i].name,
> >> -                             objfile->name);

> >
> > 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?
>

I failed to mention that this patch wouldn't remove the need to the
safe_symbol_file_add stderr redirection hack in win32-nat.c, as
will that warning will be hit when using  the dll_symbol_command
or add-symbol-file to load dll symbols from an object with seperate
debug info manually, but should be seen as an "incremental" fix
as a more correct solution is devised.

OK, so, on to fix this properly to remove that hack completelly.

Can anyone point me into why the non-debug sections are
preserved (as NOBITS) in the seperate debug file?
Could it be so support the case where the section headers
were stripped in the main file?
To help if there are relocs against section symbols in
the debug info?  Not sure if that makes sense in
a NOBITS section.
Or, are they added so to keep tools that currently expect
them there happy?

If they're really needed, we should then be fixing the
format instead.  If it isn't possible to emulate the NOBITS
funcionality with real sections, I think we can add a new
section to the seperate debug info file, that bfd parses
to make fake NOBITS pseudo sections (much like core file
pseudo sections).  Or maybe special casing PE/coff
support in gdb would be easier, but I don't know if other
tools expect them.

If they're not really needed, then the shortest change would be to
not pass orig_addrs to symbol_file_add
in symfile.c:symbol_file_add_with_addrs_or_offsets.

static struct objfile *
symbol_file_add_with_addrs_or_offsets (bfd *abfd, int from_tty,
                                       struct section_addr_info *addrs,
                                       struct section_offsets *offsets,
                                       int num_offsets,
                                       int mainline, int flags)
{

 struct section_addr_info *orig_addrs = NULL;

(...)

 if (addrs)
    {
      orig_addrs = copy_section_addr_info (addrs);
      make_cleanup_free_section_addr_info (orig_addrs);
    }

(...)

  if (objfile->psymtabs == NULL)
    debugfile = find_separate_debug_file (objfile);
  if (debugfile)
    {
      if (addrs != NULL)
        {
          objfile->separate_debug_objfile
            = symbol_file_add (debugfile, from_tty, orig_addrs, 0, flags);
        }
      else
        {
          objfile->separate_debug_objfile
            = symbol_file_add (debugfile, from_tty, NULL, 0, flags);
        }
      objfile->separate_debug_objfile->separate_debug_objfile_backlink
        = objfile;

(...)
}

I'm sure the sections are preserved for a reason, but what is it?

Cheers,
Pedro Alves


  reply	other threads:[~2007-10-29  9:03 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <46262D3A.8B1A0D15@dessent.net>
     [not found] ` <20070418150137.GA7338@trixie.casa.cgf.cx>
     [not found]   ` <46263710.D9755DAD@dessent.net>
     [not found]     ` <462639F3.FBCF4675@dessent.net>
     [not found]       ` <46264A56.BA86EED7@dessent.net>
2007-05-02 15:19         ` [patch ping] suppress annoying warnings about cygwin1.dbg Brian Dessent
2007-06-25 23:20           ` [patch ping^2] " Brian Dessent
2007-06-25 23:40             ` Pedro Alves
2007-06-25 23:52               ` Daniel Jacobowitz
2007-06-26  0:59                 ` Brian Dessent
2007-06-26  7:37                   ` Daniel Jacobowitz
2007-06-28  6:11                 ` syms_from_objfile() warnings and win32-nat.c IO redirection (Was: suppress annoying warnings about cygwin1.dbg) Brian Dessent
2007-06-28 12:44                   ` Daniel Jacobowitz
2007-10-11 20:26                     ` Daniel Jacobowitz
2007-10-13  0:09                       ` Brian Dessent
2007-10-13  1:44                         ` Pedro Alves
2007-10-13  2:49                           ` Brian Dessent
2007-10-13  3:33                             ` Pedro Alves
2007-10-13  6:03                               ` Brian Dessent
2007-10-24 19:06                           ` Daniel Jacobowitz
2007-10-29  3:06                             ` Pedro Alves
2007-10-29 12:33                               ` Pedro Alves [this message]
2007-10-29 12:57                                 ` Daniel Jacobowitz
2007-10-29 22:54                                   ` Pedro Alves
2007-10-30  4:05                                     ` Christopher Faylor
2007-10-30  9:02                                       ` Pedro Alves
2007-10-30  1:27                                   ` Christopher Faylor
2007-11-08 23:56                                     ` Pedro Alves
2007-11-09  1:35                                       ` Pedro Alves
2007-11-09 13:34                                         ` Christopher Faylor
2007-11-09 13:59                                           ` Daniel Jacobowitz
2007-11-09 13:59                                           ` Pedro Alves

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4053daab0710290203q5aa79bam6a8e87e5c6a837ba@mail.gmail.com \
    --to=pedro_alves@portugalmail.pt \
    --cc=gdb-patches@sourceware.org \
    --cc=insight@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox