From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14685 invoked by alias); 13 Oct 2007 01:24:08 -0000 Received: (qmail 14673 invoked by uid 22791); 13 Oct 2007 01:24:07 -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; Sat, 13 Oct 2007 01:24:04 +0000 Received: by nf-out-0910.google.com with SMTP id b11so946969nfh for ; Fri, 12 Oct 2007 18:24:01 -0700 (PDT) Received: by 10.82.156.12 with SMTP id d12mr7294079bue.1192238638483; Fri, 12 Oct 2007 18:23:58 -0700 (PDT) Received: from ?88.210.64.242? ( [88.210.64.242]) by mx.google.com with ESMTPS id i8sm1881454nfh.2007.10.12.18.23.54 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 12 Oct 2007 18:23:56 -0700 (PDT) Message-ID: <47101DB4.6010204@portugalmail.pt> Date: Sat, 13 Oct 2007 01:44:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; pt-BR; rv:1.8.1.6) Gecko/20070728 Thunderbird/2.0.0.6 Mnenhy/0.7.5.0 MIME-Version: 1.0 To: gdb-patches@sourceware.org CC: Daniel Jacobowitz , insight@sourceware.org Subject: Re: syms_from_objfile() warnings and win32-nat.c IO redirection (Was: suppress annoying warnings about cygwin1.dbg) References: <20070418150137.GA7338@trixie.casa.cgf.cx> <46263710.D9755DAD@dessent.net> <462639F3.FBCF4675@dessent.net> <46264A56.BA86EED7@dessent.net> <4638AB6B.5AA94B26@dessent.net> <46803846.F99470AE@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> In-Reply-To: <470FFB00.9909C731@dessent.net> Content-Type: multipart/mixed; boundary="------------090106060308040609010407" 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/msg00350.txt.bz2 This is a multi-part message in MIME format. --------------090106060308040609010407 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 900 Brian Dessent wrote: > Daniel Jacobowitz wrote: > > Unfortunately, current HEAD is nearly unusable right now on Cygwin. I shook a bit when I read "unusable" :) That's a pretty strong word. > If you do this in insight it's much worse as every one of those warnings > gets its own popup message box, which means twelve annoying things to > dismiss before you can even start to debug. And on top of that, some of > these messages somehow end up spuriously appearing in with the program > display pane in insight (see attached PNG). I guess there's some kind > of filter in the insight code that needs updating, but preferrably these > warnings shouldn't even be generated. > I've had this fixed here for a while. It goes on the direction of removing the warnings, and removing the warning suppressing on win32-nat.c. Could you test it with cygwin1.dbg and with insight? Cheers, Pedro Alves --------------090106060308040609010407 Content-Type: text/x-diff; name="remove_redirect_null.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="remove_redirect_null.diff" Content-length: 4792 2007-10-09 Pedro Alves * symfile.c (syms_from_objfile): Don't warn if loadable sections are not found. --- gdb/symfile.c | 29 +++++++++-------------- gdb/win32-nat.c | 70 -------------------------------------------------------- 2 files changed, 13 insertions(+), 86 deletions(-) Index: src/gdb/symfile.c =================================================================== --- src.orig/gdb/symfile.c 2007-10-08 23:45:50.000000000 +0100 +++ src/gdb/symfile.c 2007-10-13 01:51:40.000000000 +0100 @@ -822,18 +822,18 @@ 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); - else lower_offset = 0; + 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); + } /* Calculate offsets for the loadable sections. FIXME! Sections must be in order of increasing loadable section @@ -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; Index: src/gdb/win32-nat.c =================================================================== --- src.orig/gdb/win32-nat.c 2007-10-13 01:51:10.000000000 +0100 +++ src/gdb/win32-nat.c 2007-10-13 01:51:40.000000000 +0100 @@ -525,19 +525,6 @@ failed: return 0; } -/* Encapsulate the information required in a call to - symbol_file_add_args */ -struct safe_symbol_file_add_args -{ - char *name; - int from_tty; - struct section_addr_info *addrs; - int mainline; - int flags; - struct ui_file *err, *out; - struct objfile *ret; -}; - /* Maintain a linked list of "so" information. */ struct lm_info { @@ -546,61 +533,6 @@ struct lm_info static struct so_list solib_start, *solib_end; -/* Call symbol_file_add with stderr redirected. We don't care if there - are errors. */ -static int -safe_symbol_file_add_stub (void *argv) -{ -#define p ((struct safe_symbol_file_add_args *) argv) - struct so_list *so = &solib_start; - - p->ret = symbol_file_add (p->name, p->from_tty, p->addrs, p->mainline, p->flags); - return !!p->ret; -#undef p -} - -/* Restore gdb's stderr after calling symbol_file_add */ -static void -safe_symbol_file_add_cleanup (void *p) -{ -#define sp ((struct safe_symbol_file_add_args *)p) - gdb_flush (gdb_stderr); - gdb_flush (gdb_stdout); - ui_file_delete (gdb_stderr); - ui_file_delete (gdb_stdout); - gdb_stderr = sp->err; - gdb_stdout = sp->out; -#undef sp -} - -/* symbol_file_add wrapper that prevents errors from being displayed. */ -static struct objfile * -safe_symbol_file_add (char *name, int from_tty, - struct section_addr_info *addrs, - int mainline, int flags) -{ - struct safe_symbol_file_add_args p; - struct cleanup *cleanup; - - cleanup = make_cleanup (safe_symbol_file_add_cleanup, &p); - - p.err = gdb_stderr; - p.out = gdb_stdout; - gdb_flush (gdb_stderr); - gdb_flush (gdb_stdout); - gdb_stderr = ui_file_new (); - gdb_stdout = ui_file_new (); - p.name = name; - p.from_tty = from_tty; - p.addrs = addrs; - p.mainline = mainline; - p.flags = flags; - catch_errors (safe_symbol_file_add_stub, &p, "", RETURN_MASK_ERROR); - - do_cleanups (cleanup); - return p.ret; -} - static struct so_list * win32_make_so (const char *name, DWORD load_addr) { @@ -801,7 +733,7 @@ dll_symbol_command (char *args, int from args = newargs; } - safe_symbol_file_add (args, from_tty, NULL, 0, OBJF_SHARED | OBJF_USERLOADED); + symbol_file_add (args, from_tty, NULL, 0, OBJF_SHARED | OBJF_USERLOADED); } /* Handle DEBUG_STRING output from child process. --------------090106060308040609010407--