From: "André Pönitz" <andre.poenitz@nokia.com>
To: ext asmwarrior <asmwarrior@gmail.com>
Cc: "pmuldoon@redhat.com" <pmuldoon@redhat.com>,
"tromey@redhat.com" <tromey@redhat.com>,
"gdb@sourceware.org" <gdb@sourceware.org>
Subject: Re: gdb with python support still get crash on showing uninitialized local variables
Date: Thu, 14 Oct 2010 18:30:00 -0000 [thread overview]
Message-ID: <201010142029.24092.andre.poenitz@nokia.com> (raw)
In-Reply-To: <4CB66700.3000907@gmail.com>
Hi.
I'll take that direct CC: to me as a hint that I should comment. Not sure
this is a good idea, but here we go:
On Thursday 14 October 2010 04:12:16 ext asmwarrior wrote:
> Hi, I still get gdb crashed when showing local variables. Here is the
> test code:
>
> OS: windows xp
> GDB: clean gdb cvs snapshot weekly 2010 10 12 build with python support
> GCC: TDM-MinGW GCC 4.5.1
> so, the program is build with -g (by default, it use the dwarf-2 format,
> I have just tested by using -gdwarf-3, there's the same crash)
>
> it seems gdb crashed when trying to show the vector :
> std::vector<std::string> v = {"a", "b", "c"}; , this is an uninitialized
> variable.
>
> Tested under codeblocks IDE
Works fine for me using Qt Creator on Linux, gdb 7.1, 7.2 and recent CVS,
including (our non-gdb) Python based pretty printing.
Output in the Locals&Watchers view is something like
Locals
l <not accessible>
m <not accessible>
s <19932 items>
stdStr ""
stdStrRef <not accessible>
v <not accessible>
wxStr
wxStrRef
Watchers
Not nice, but it's uninitialized data after all, and a stack could possibly have
19932 items.
So I think the problem is neither the uninitialized data, nor Python, nor gdb's
use of Python in general.
> File "D:\code\mingw451tdm\bin\libstdcxx\v6\printers.py", line 297, in next
> if node.dereference()['_M_right']:
> RuntimeError: Attempt to dereference a generic pointer.
> stdStrRef =
> s = std::stack wrapping: std::deque with -521291805 elements = {<error
> reading variable s (Cannot access memory at address 0x80)>
> wxStr = UnicodeEncodeError: 'gbk' codec can't encode character u'\uffff'
> in position 0: illegal multibyte sequence
> wxStrRef = @0x40b9c6
> l = std::list = {
> [0] = <error reading variable l (Cannot access memory at address
> 0x50000069)>
> v = std::vector of length -37952, capacity -519864265 = {Traceback (most
> recent call last):
> File "D:\code\mingw451tdm\bin\libstdcxx\v6\printers.py", line 549, in
> to_string
> return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)
> RuntimeError: Cannot access memory at address 0x90000cb6
> , Traceback (most recent call last):
> File "D:\code\mingw451tdm\bin\libstdcxx\v6\printers.py", line 549, in
> to_string
> return self.val['_M_dataplus']['_M_p'].lazy_string (length = len)
> RuntimeError: Cannot access memory at address 0x90909084
> , Traceback (most recent call last):
This looks like gdb's own pretty printers could make more use of
try/except and perhaps a few sanity checks on the contents.
Printing "std::vector of length -37952" does not make much sense.
Andre'
PS:
> andr's post in QT site
> http://labs.qt.nokia.com/2009/06/22/peek-and-poke/#comment-4269
>
> It’s “not ready” yet. The gdb python “pretty-printers” have serious
> problems with uninitialized and/or damaged C++ objects. I understand
> work to fix that is going on, but from my point of view it is not ready
> for shipping yet.
That's over a year old, and has significantly changed in so far as Qt Creator
nowadays uses gdb's Python extensively to do pretty printing. Since 7.0.1
this is really good and usable. However, I do not use the gdb version of the
pretty printers for the stability reason you just encountered, and because they
cannot (easily...) create several layers including possibly "virtual" ones that
do not correspond to actual objects on the inferior side. [And then there are
non-gdb related reasons, like that I need a C++ version of the same code for
Apple's gdb/Mac (no Python there) and CDB on Windows (completely different
beast) and it's easier to keep that in sync if it's structurally similar]
next prev parent reply other threads:[~2010-10-14 18:30 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-14 2:16 asmwarrior
2010-10-14 18:30 ` André Pönitz [this message]
2010-10-15 3:55 ` asmwarrior
2010-10-15 22:38 ` Tom Tromey
2010-11-05 17:14 ` André Pönitz
2010-10-15 22:37 ` Tom Tromey
2010-10-16 1:14 ` asmwarrior
[not found] ` <m3fww2ued0.fsf_-_@fleche.redhat.com>
2010-10-20 5:19 ` asmwarrior
2010-10-20 5:33 ` asmwarrior
2010-10-22 19:13 ` Tom Tromey
2010-10-22 21:22 ` Eli Zaretskii
2010-10-29 19:18 ` Joel Brobecker
2010-10-29 22:01 ` Eli Zaretskii
2010-10-31 2:24 ` asmwarrior
2010-11-09 2:06 ` asmwarrior
2010-11-12 18:07 ` Tom Tromey
[not found] ` <4CE0C149.6090609@gmail.com>
2010-11-15 18:10 ` Tom Tromey
2010-12-14 2:13 ` asmwarrior
[not found] ` <4D06D1DB.1070501@gmail.com>
2010-12-14 15:00 ` Tom Tromey
2010-12-16 8:48 ` asmwarrior
[not found] ` <AANLkTinsJLTZT0ws=LbpYcq85_Z9_R=fcXz+J+kqScJU@mail.gmail.com>
2010-12-17 19:04 ` RFA: add python exception subclasses Tom Tromey
2010-12-18 2:26 ` asmwarrior
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=201010142029.24092.andre.poenitz@nokia.com \
--to=andre.poenitz@nokia.com \
--cc=asmwarrior@gmail.com \
--cc=gdb@sourceware.org \
--cc=pmuldoon@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