public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@redhat.com>
To: Kevin Pouget <kevin.pouget@gmail.com>
Cc: gdb@sourceware.org
Subject: Re: GDB crashing because of Python
Date: Mon, 27 Aug 2012 16:36:00 -0000	[thread overview]
Message-ID: <87wr0kgumi.fsf@fleche.redhat.com> (raw)
In-Reply-To: <CAPftXUKCVRbBQ1FH0y48mT1Y4Ze6hLJw8G2RM6cTFZV7o+6ogQ@mail.gmail.com>	(Kevin Pouget's message of "Mon, 27 Aug 2012 18:04:38 +0200")

>>>>> "Kevin" == Kevin Pouget <kevin.pouget@gmail.com> writes:

Kevin> so based on `git bisect`, it looks like the errors were introduced by
Kevin> this commit:

Can you please try the appended patch?

I think the bug here is that this code assumes that
objfile_to_objfile_object returns a new reference, but in fact it does
not.

While looking at this I think I found even more reference counting bugs.
Despair.

Tom

diff --git a/gdb/python/py-newobjfileevent.c b/gdb/python/py-newobjfileevent.c
index 3059ae4..d014be6 100644
--- a/gdb/python/py-newobjfileevent.c
+++ b/gdb/python/py-newobjfileevent.c
@@ -25,7 +25,7 @@ static PyObject *
 create_new_objfile_event_object (struct objfile *objfile)
 {
   PyObject *objfile_event;
-  PyObject *py_objfile = NULL;
+  PyObject *py_objfile;
 
   objfile_event = create_event_object (&new_objfile_event_object_type);
   if (!objfile_event)
@@ -36,12 +36,10 @@ create_new_objfile_event_object (struct objfile *objfile)
                                          "new_objfile",
                                          py_objfile) < 0)
     goto fail;
-  Py_DECREF (py_objfile);
 
   return objfile_event;
 
  fail:
-  Py_XDECREF (py_objfile);
   Py_XDECREF (objfile_event);
   return NULL;
 }

  reply	other threads:[~2012-08-27 16:36 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-23 13:21 Kevin Pouget
2012-08-23 13:56 ` Tom Tromey
2012-08-23 14:30   ` Kevin Pouget
2012-08-23 18:52     ` Tom Tromey
2012-08-27 16:05       ` Kevin Pouget
2012-08-27 16:36         ` Tom Tromey [this message]
2012-08-27 16:39           ` Tom Tromey
2012-08-28 19:45           ` Tom Tromey
2012-08-29  8:14             ` Kevin Pouget
2012-09-06 19:27               ` Tom Tromey

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=87wr0kgumi.fsf@fleche.redhat.com \
    --to=tromey@redhat.com \
    --cc=gdb@sourceware.org \
    --cc=kevin.pouget@gmail.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).