From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6109 invoked by alias); 29 Oct 2007 09:03:19 -0000 Received: (qmail 6092 invoked by uid 22791); 29 Oct 2007 09:03:16 -0000 X-Spam-Check-By: sourceware.org Received: from nf-out-0910.google.com (HELO nf-out-0910.google.com) (64.233.182.186) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 29 Oct 2007 09:03:12 +0000 Received: by nf-out-0910.google.com with SMTP id b11so1259518nfh for ; Mon, 29 Oct 2007 02:03:08 -0700 (PDT) Received: by 10.86.54.3 with SMTP id c3mr4653516fga.1193648588812; Mon, 29 Oct 2007 02:03:08 -0700 (PDT) Received: by 10.86.71.2 with HTTP; Mon, 29 Oct 2007 02:03:08 -0700 (PDT) Message-ID: <4053daab0710290203q5aa79bam6a8e87e5c6a837ba@mail.gmail.com> Date: Mon, 29 Oct 2007 12:33:00 -0000 From: "Pedro Alves" 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) In-Reply-To: <4725378D.5010800@portugalmail.pt> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <46264A56.BA86EED7@dessent.net> <46804DAD.4020309@portugalmail.pt> <20070625234015.GA17640@caradoc.them.org> <46833EB0.E8ABC8CB@dessent.net> <20070628104601.GA10328@caradoc.them.org> <20071011195327.GB8200@caradoc.them.org> <470FFB00.9909C731@dessent.net> <47101DB4.6010204@portugalmail.pt> <20071024184207.GA10943@caradoc.them.org> <4725378D.5010800@portugalmail.pt> X-Google-Sender-Auth: 93c212fb72e2d9d9 X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2007-10/txt/msg00749.txt.bz2 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