Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@mvista.com>
To: Roland McGrath <roland@redhat.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [PATCH] add-symbol-file-from-memory command
Date: Mon, 02 Feb 2004 15:02:00 -0000	[thread overview]
Message-ID: <20040202150254.GA7529@nevyn.them.org> (raw)
In-Reply-To: <200402020447.i124lfMl023809@magilla.sf.frob.com>

On Sun, Feb 01, 2004 at 08:47:41PM -0800, Roland McGrath wrote:
> > I can't approve this patch, but I have some comments anyway.
> 
> Much appreciated.
> 
> > There also was a segfault when the objfile is released.  To reproduce,
> > I could just say "file\n" after loading one.  GDB will try to
> > xfree("<in-memory>").  I see that this is fixed in the patch below, so
> > if the bits were unchanged from your last post then I must have come up
> > with the wrong copy.
> 
> I won't testify to not having noticed and fixed (and since forgotten) some
> small bug like this between the last time I posted and today.  Probably I did.
> 
> > I can tell you one problem with this patch, based on my backport of it:
> > there's an annoying/incorrect message when a program is re-run, saying:
> >    "<in-memory>" has disappeared; keeping its symbols
> > 
> > This is merely an annoyance, the message is harmless but should be
> > fixed.
> 
> I don't see this.  AFAICT it just loses the symbols, like it should.  What
> exactly is the recipe for seeing this?  This may be something else I forgot
> I changed.  It sets the OBJF_SHARED flag, which means the objfile is
> dropped by objfile_purge_solibs for "run".

Both of these are changes since the last time you posted the patch, so
please do not insist it was unchanged.

> > Mind doing this in some way that isn't gratuitously quadratic?
> 
> Sure.  I only used bfd_map_over_sections since it was said to be preferred.

Thanks.

> > Please remove the check and the !from_tty branch.  An error is fine in
> > either case, and internal errors are not appropriate for user input.
> > Further down you have different error behavior on !from_tty also.  Is
> > there a particular inspiration for this?
> 
> My thinking was that when there are later internal calls to this function
> from target code, it would be an indication of a bug in the target code if
> it ever got called for a non-ELF target, and those would be the called with
> from_tty==0, hence the gdb_assert.  The other errors indicate that the
> thing was reasonable to attempt, but failed.  I think I copied the from_tty
> conditional for those errors from some other code I found similar, but I
> may be misremembering.  I am more than happy to have you tell me a clear
> policy on what from_tty should or shouldn't affect.

from_tty should generally only affect verbosity.  If the user puts
commands in a .gdbinit, they will be run with from_tty == 0, and should
still trigger an error () when necessary.

> > > +  reinit_frame_cache ();	/* ??? */
> > 
> > Yes, this is necessary if the current cached backtrace would pass
> > through the newly loaded object.
> 
> I appreciate the explanation.  I've added a comment.  
> I'm appending my current version of the symfile.c part of the patch.

> +  if (!bfd_check_format (nbfd, bfd_object))
> +    {
> +      /* FIXME: should be checking for errors from bfd_close (for one thing,
> +         on error it does not free all the storage associated with the
> +         bfd).  */
> +      bfd_close (nbfd);
> +      if (from_tty)
> +	error ("Got object file from memory but can't read symbols: %s.",
> +	       bfd_errmsg (bfd_get_error ()));
> +      return NULL;
> +    }

Same thing...

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer


  reply	other threads:[~2004-02-02 15:02 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-02-02  3:38 Roland McGrath
2004-02-02  4:06 ` Daniel Jacobowitz
2004-02-02  4:47   ` Roland McGrath
2004-02-02 15:02     ` Daniel Jacobowitz [this message]
2004-02-02 23:31       ` Roland McGrath
2004-02-02 23:34         ` Daniel Jacobowitz
2004-02-02  6:19 ` Eli Zaretskii
2004-02-02  7:35   ` Roland McGrath
2004-02-02 17:29     ` Eli Zaretskii
  -- strict thread matches above, loose matches on Subject: below --
2004-04-08 22:38 Roland McGrath
2004-04-15 18:11 ` Jim Blandy
2004-04-15 18:49   ` Andrew Cagney
2004-04-15 21:42   ` Roland McGrath
2004-04-08 20:47 Roland McGrath
2004-04-08 22:13 ` Jim Blandy
2004-04-08 22:28   ` Roland McGrath
2004-04-08 22:32     ` Daniel Jacobowitz
2004-04-08 22:35   ` Andrew Cagney
2004-04-08 22:42     ` Roland McGrath
2004-04-15 18:52       ` Andrew Cagney
2004-02-12  0:34 Roland McGrath
2004-02-13 15:54 ` Andrew Cagney
2004-02-13 19:13   ` Roland McGrath
2003-10-03  4:27 Roland McGrath
2003-10-03 21:41 ` Jim Blandy
2003-10-03 21:45   ` Daniel Jacobowitz
2003-10-03 22:08   ` Roland McGrath
2003-10-03 22:19   ` Elena Zannoni
2003-10-03 23:00     ` Roland McGrath
2003-10-04 12:57       ` Elena Zannoni
2003-10-04 20:14         ` Roland McGrath
2003-10-07  1:42           ` Andrew Cagney
2003-10-03 22:34   ` Andrew Cagney
2003-10-03 23:02     ` Roland McGrath
2003-10-04 14:39       ` Andrew Cagney
2003-10-06 15:30   ` Jim Blandy
2003-10-06 15:43     ` Daniel Jacobowitz
2003-10-06 19:57       ` Roland McGrath
2003-10-07 23:32       ` Michael Snyder
2003-05-20  7:01 Roland McGrath

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=20040202150254.GA7529@nevyn.them.org \
    --to=drow@mvista.com \
    --cc=gdb-patches@sources.redhat.com \
    --cc=roland@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