Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@redhat.com>
To: Joachim Protze <joachim.protze@wh2.tu-dresden.de>
Cc: gdb@sourceware.org
Subject: Re: Crashing gdb with python-prettyprinting
Date: Fri, 30 Jul 2010 19:12:00 -0000	[thread overview]
Message-ID: <m3k4oc6ayc.fsf@fleche.redhat.com> (raw)
In-Reply-To: <4C4EFC98.7080105@wh2.tu-dresden.de> (Joachim Protze's message of	"Tue, 27 Jul 2010 17:34:48 +0200")

>>>>> "Joachim" == Joachim Protze <joachim.protze@wh2.tu-dresden.de> writes:

Joachim> i am writing on a python-prettyprinter for an quite complex
Joachim> datastructure. It runs quite stable. But sometimes i get the appended
Joachim> segfault. I can reproduce it by calling "info locals" and pressing
Joachim> enter-key. I appended also the contents of the frame_info at the end of
Joachim> the mail. For some reason at one point the frame_info gets corrupted.
Joachim> Possibly overwritten by my python extension?

It could be.  A frame_info is a transient object, it will be overwritten
whenever the frame cache is cleared.  See reinit_frame_cache.

If you want a more stable handle on a frame, you must use a frame_id.

If there is code in the python layer that gets this wrong, please let us
know about it, that would definitely be a bug.

Joachim> Is it right, that the content of frame_info should not change
Joachim> while the program is halted and i just call a series of "info
Joachim> locals"?

Aha.  If a pretty-printer causes the frame cache to be invalidated, then
the frame_info passed to print_frame_local_vars will be no good.  That
may be what you are seeing.  You could verify this by putting a
breakpoint on reinit_frame_cache and then doing "info locals".  If it
triggers, that is bad.

Joachim> I'm new in debuging gdb by gdb. Can someone give me a hint, how
Joachim> i can set a breakpoint in the outer gdb while the inner gdb is
Joachim> running?

What I do is use C-c to go back to the top gdb, then set my breakpoints,
then "cont" to resume the inner gdb.

Joachim> Or which way can i check the proper contents of frame_info
Joachim> before the crash?

Sometimes "frame" is useful, and there are various debug and verbose
settings that can be handy.  E.g., "set debug frame on".

Joachim> I also tried to run gdb with duma to find the memory failure,
Joachim> where the frame_info is overwritten, but with running duma each
Joachim> step and each function call of gdb gets damn slow.

I don't know what duma is.  I tend to use valgrind for this sort of
thing.  That is slower than running native, but for most things, not
unbearably so.

Tom


  reply	other threads:[~2010-07-30 19:12 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-27 15:35 Joachim Protze
2010-07-30 19:12 ` Tom Tromey [this message]
2010-07-30 19:53   ` Petr Hluzín
2010-08-09 12:19   ` Joachim Protze
2010-08-10 10:57     ` Joachim Protze

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=m3k4oc6ayc.fsf@fleche.redhat.com \
    --to=tromey@redhat.com \
    --cc=gdb@sourceware.org \
    --cc=joachim.protze@wh2.tu-dresden.de \
    /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