Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Metzger, Markus T" <markus.t.metzger@intel.com>
To: Tom Tromey <tromey@redhat.com>
Cc: "palves@redhat.com" <palves@redhat.com>,
	"gdb-patches@sourceware.org"	<gdb-patches@sourceware.org>
Subject: RE: [PATCH v2 1/3] make_corefile_notes: have caller free returned memory
Date: Tue, 24 Jun 2014 14:18:00 -0000	[thread overview]
Message-ID: <A78C989F6D9628469189715575E55B231E5BF73F@IRSMSX104.ger.corp.intel.com> (raw)
In-Reply-To: <87ionq4e2l.fsf@fleche.redhat.com>

> -----Original Message-----
> From: gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] On Behalf Of Tom Tromey
> Sent: Tuesday, June 24, 2014 3:45 PM
> To: Metzger, Markus T
> Cc: palves@redhat.com; gdb-patches@sourceware.org
> Subject: Re: [PATCH v2 1/3] make_corefile_notes: have caller free returned
> memory
> 
> >>>>> "Markus" == Markus Metzger <markus.t.metzger@intel.com> writes:
> 
> Markus>    if (note_data == NULL || note_size == 0)
> Markus>      error (_("Target does not support core file generation."));
> 
> Markus> +  cleanup = make_cleanup (xfree, note_data);
> 
> I wonder if it is possible for note_data!=NULL but note_size==0.

I don't know.  I have not found such a case, but that only means
that I have not looked hard enough.

I found a case where note_data == NULL but note_size could be > 0
in linux_spu_make_corefile_notes in linux-tdep.c, which is similarly
odd.

Other code in the same file is only checking note_data, not note_size.


> If it is possible, then the cleanup ought to be moved earlier.
> (FWIW it's ok to have an xfree cleanup with a NULL argument.)

I'll do that.  Thanks for pointing out this bug.


> Or if it is not possible, then I suppose the code just above is in
> error... not your problem but if you happen to know, I would like to fix
> it up.

Replacing note_data and note_size with struct buffer would be nice,
but the change would be quite big, I'm afraid.

Regards,
Markus.
Intel GmbH
Dornacher Strasse 1
85622 Feldkirchen/Muenchen, Deutschland
Sitz der Gesellschaft: Feldkirchen bei Muenchen
Geschaeftsfuehrer: Christian Lamprechter, Hannes Schwaderer, Douglas Lusk
Registergericht: Muenchen HRB 47456
Ust.-IdNr./VAT Registration No.: DE129385895
Citibank Frankfurt a.M. (BLZ 502 109 00) 600119052


      reply	other threads:[~2014-06-24 14:18 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-24  8:51 Markus Metzger
2014-06-24  8:51 ` [PATCH v2 2/3] gcore, target: allow target to prepare/cleanup for/after core file generation Markus Metzger
2014-06-24 13:11   ` Pedro Alves
2014-06-24  8:52 ` [PATCH v2 3/3] btrace: pretend we're not replaying when generating a core file Markus Metzger
2014-06-24 13:19   ` Pedro Alves
2014-06-24 12:58 ` [PATCH v2 1/3] make_corefile_notes: have caller free returned memory Pedro Alves
2014-06-24 13:44 ` Tom Tromey
2014-06-24 14:18   ` Metzger, Markus T [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=A78C989F6D9628469189715575E55B231E5BF73F@IRSMSX104.ger.corp.intel.com \
    --to=markus.t.metzger@intel.com \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.com \
    --cc=tromey@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