From: "André Pönitz" <andre.poenitz@nokia.com>
To: gdb@sourceware.org
Subject: Re: About the "info locals" command of gdb and python pretty printer
Date: Mon, 21 Jun 2010 07:48:00 -0000 [thread overview]
Message-ID: <201006210948.12939.andre.poenitz@nokia.com> (raw)
In-Reply-To: <4C1DDBB0.9010202@gmail.com>
On Sunday 20 June 2010 11:13:20 asmwarrior wrote:
> Hi, I have some problems to show some uninitialized local variables.
>
> For example, here is the test code:
>
> void test()
> {
> int aaaa = 1;
> int bbbb = 2;
> int cccc = 3;
> }
>
> int main()
> {
> test();
> return 0;
> }
>
> Here, if I set a breakpoint at the first statement of the "test()", then
> run "info locals" command. gdb will plot all the information about both
> "aaaa, bbbb and cccc".
>
> Things becomes more complex when bbbb and cccc are not simple type, but
> instead, they are stl containers like vector<int> or maps.
> like:
>
> void test()
> {
> int aaaa = 1;
> vector <int> bbbb;
> map<int,string>cccc;
> }
>
> At this time, if we run the "info locals" with python stl pretty printer
> enabled, as you see, if you breakpoint is still at the first line "int
> aaa = 1;", then bbbb and cccc are not initialized, this may cause the
> python script to plot random values, some times, gdb or python will get
> crashed.
As data "damaged" after the initialization can look pretty much like
uninitialized data, taking the scope information into account would
not solve the problem, only reduce the likelihood of running into it.
Andre'
next prev parent reply other threads:[~2010-06-21 7:48 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-20 9:13 asmwarrior
2010-06-21 7:48 ` André Pönitz [this message]
2010-06-21 20:08 ` Tom Tromey
2010-06-22 0:29 ` asmwarrior
2010-06-22 2:18 ` Tom Tromey
2010-06-23 12:30 ` asmwarrior
[not found] ` <4C21FCDC.5050503__12891.7291098789$1277296251$gmane$org@gmail.com>
2010-06-23 20:28 ` Tom Tromey
2010-06-24 1:16 ` asmwarrior
2010-07-02 10:57 ` Matthias Klose
2010-06-21 3:02 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=201006210948.12939.andre.poenitz@nokia.com \
--to=andre.poenitz@nokia.com \
--cc=gdb@sourceware.org \
/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).