public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@redhat.com>
To: Pedro Alves <palves@redhat.com>
Cc: Doug Evans <dje@google.com>, Hui Zhu <hui_zhu@mentor.com>,
	       Sergio Durigan Junior <sergiodj@redhat.com>,
	       gdb-patches ml <gdb-patches@sourceware.org>,
	       Edjunior Barbosa Machado <emachado@linux.vnet.ibm.com>,
	       Nick Clifton <nickc@redhat.com>,
	       Binutils Development <binutils@sourceware.org>
Subject: Re: [PATCH] Remove gdb_bfd_stash_filename to fix crash with fix of binutils/11983
Date: Tue, 07 Jan 2014 17:41:00 -0000	[thread overview]
Message-ID: <87k3ebheqh.fsf@fleche.redhat.com> (raw)
In-Reply-To: <52CBF47C.9010002@redhat.com> (Pedro Alves's message of "Tue, 07	Jan 2014 12:35:08 +0000")

>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:

Pedro> gdb has been confused and went in circles, with bfd's filename
Pedro> ownership.  In some places, it ended up xmalloc/xstrdup'ing the
Pedro> filename instead of allocating it in the bfd's memory.
Pedro> That resulted in the invention of gdb_bfd_stash_filename
Pedro> https://sourceware.org/ml/gdb-patches/2012-07/msg00291.html
Pedro> as a workaround.

Yeah, in retrospect I should have tried to fix up BFD at that time.

Pedro> I think it'd be better to allocate the filename
Pedro> in the bfd's memory, like it used to be.

I agree.  I think your patch is better due to keeping the same
error-handling approach as the rest of BFD.

Pedro> WDYT?

If you don't mind I think it would be good -- and easy -- to also
implement Doug's suggestion, say a "bfd_set_filename" macro.

Pedro> +/* A wrapper for bfd_strdup that never returns NULL.  */
Pedro> +
Pedro> +char *gdb_bfd_strdup (bfd *abfd, const char *str);

This can be marked ATTRIBUTE_RETURNS_NONNULL.

Tom

  parent reply	other threads:[~2014-01-07 17:41 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-04 16:23 Hui Zhu
2014-01-05 15:06 ` Sergio Durigan Junior
2014-01-05 15:48   ` Hui Zhu
2014-01-06  8:25     ` Tom Tromey
2014-01-06 10:50       ` Hui Zhu
2014-01-06 16:14         ` Tom Tromey
2014-01-06 17:12         ` Doug Evans
2014-01-06 21:07           ` Tom Tromey
2014-01-07 12:35             ` Pedro Alves
2014-01-07 13:55               ` Pedro Alves
2014-01-07 17:41               ` Tom Tromey [this message]
2014-01-07 19:54                 ` Pedro Alves

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=87k3ebheqh.fsf@fleche.redhat.com \
    --to=tromey@redhat.com \
    --cc=binutils@sourceware.org \
    --cc=dje@google.com \
    --cc=emachado@linux.vnet.ibm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=hui_zhu@mentor.com \
    --cc=nickc@redhat.com \
    --cc=palves@redhat.com \
    --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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).