From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 324 invoked by alias); 9 Aug 2011 20:41:16 -0000 Received: (qmail 304 invoked by uid 22791); 9 Aug 2011 20:41:15 -0000 X-SWARE-Spam-Status: No, hits=-6.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 09 Aug 2011 20:40:55 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p79KetNr006265 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 9 Aug 2011 16:40:55 -0400 Received: from host1.jankratochvil.net (ovpn-116-17.ams2.redhat.com [10.36.116.17]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p79KeqgO028903 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 9 Aug 2011 16:40:54 -0400 Received: from host1.jankratochvil.net (localhost [127.0.0.1]) by host1.jankratochvil.net (8.14.4/8.14.4) with ESMTP id p79KepuE021586; Tue, 9 Aug 2011 22:40:51 +0200 Received: (from jkratoch@localhost) by host1.jankratochvil.net (8.14.4/8.14.4/Submit) id p79KepmJ021527; Tue, 9 Aug 2011 22:40:51 +0200 Date: Tue, 09 Aug 2011 20:41:00 -0000 From: Jan Kratochvil To: Sergio Durigan Junior Cc: gdb-patches@sourceware.org Subject: Re: [RFC] Make solib_add regex-free Message-ID: <20110809204050.GA18379@host1.jankratochvil.net> References: <20110809095838.GA32172@host1.jankratochvil.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) 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: 2011-08/txt/msg00211.txt.bz2 On Tue, 09 Aug 2011 20:09:54 +0200, Sergio Durigan Junior wrote: > Jan Kratochvil writes: > >> /* Walk the list of currently loaded shared libraries, and read > >> symbols for any that match the pattern --- or any whose symbols > >> aren't already loaded, if no pattern was given. */ > >> { > >> - int any_matches = 0; > > > > Removal of this variable/functionality is a regression, discussed below. > > I'm not sure I understood why, after reading the entire message. Is it > because of the `(null)' string being printed in the error message? Yes, it is related to the error message with `(null)' (although it is not related to the `(null)' problem itself), I think one can skip this variable, the problem was described enough with the error message. > Ok, I was just studying how `update_solib_list' does, and decided to do > the same. I will update it then. Yes but this is really a different case. > >> - if (from_tty && pattern && ! any_matches) > >> - printf_unfiltered > >> - ("No loaded shared libraries match the pattern `%s'.\n", pattern); > > > > This useful error message is no longer ever produced, maybe solib_add_1 could > > have some return value. > > I decided to drop this error message because, the way it's written, it > only makes sense when using regex. That may be true but still the final GDB as whole should print it IMO. > Also, I couldn't come up with a decent replacement for it. Now > `solib_add' uses a so_list in order to decided what to load. So IMO the > error message should contain which shared libraries are present in the > so_list. I don't know if I'm overcomplicating things here... I guess I suggest it in the last paragraph. > >> @@ -1285,8 +1371,19 @@ in_solib_dynsym_resolve_code (CORE_ADDR pc) > >> static void > >> sharedlibrary_command (char *args, int from_tty) > >> { > >> + struct cleanup *c; > >> + VEC(so_list_p) *solist; > >> + > >> dont_repeat (); > >> - solib_add (args, from_tty, (struct target_ops *) 0, 1); > >> + > >> + solist = solib_match_regex_solist (args, (struct target_ops *) 0, > >> + from_tty); > >> + if (!solist) > >> + error (_("No shared library matched the pattern `%s'."), args); > > > > If you do with FSF GDB `nosharedlibrary' symbols for libraries are unloaded, > > then `sharedlibrary' loads symbols for all the libraries. Your patches GDB > > writes an error message. > > > > Also `args' can be NULL which prints: > > No shared library matched the pattern `(null)'. > > But NULL %s is not portable. > > Ok, I'll fix that. Just changing it to: if (from_tty && args && !solist) error (_("No shared library matched the pattern `%s'."), args); should do the right - no behavior change (I hope). Thanks, Jan