Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Sergio Durigan Junior <sergiodj@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFC] Make solib_add regex-free
Date: Tue, 09 Aug 2011 20:41:00 -0000	[thread overview]
Message-ID: <20110809204050.GA18379@host1.jankratochvil.net> (raw)
In-Reply-To: <m38vr2a231.fsf@redhat.com>

On Tue, 09 Aug 2011 20:09:54 +0200, Sergio Durigan Junior wrote:
> Jan Kratochvil <jan.kratochvil@redhat.com> 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


      reply	other threads:[~2011-08-09 20:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-09  0:53 Sergio Durigan Junior
2011-08-09  9:59 ` Jan Kratochvil
2011-08-09 11:10   ` Pedro Alves
2011-08-09 18:10   ` Sergio Durigan Junior
2011-08-09 20:41     ` Jan Kratochvil [this message]

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=20110809204050.GA18379@host1.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=sergiodj@redhat.com \
    /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