From: Selcuk Kopru <selcuk.kopru@tyazilimevi.com>
To: gdb@sourceware.org
Subject: Re: recursive user-defined commands and
Date: Fri, 04 Sep 2009 19:29:00 -0000 [thread overview]
Message-ID: <1252092562.3662.8.camel@selcuk-laptop> (raw)
In-Reply-To: <m33a7vpuwd.fsf@fleche.redhat.com>
Hi,
A late follow-up question:
How can we allocate an array type convenience variable?
Using $dlist[$depth] without any prior declaration results in the
following error:
"cannot subscript something of type `void'"
Regards,
selcuk
On Thu, 2009-08-13 at 09:59 -0600, Tom Tromey wrote:
> >>>>> ">" == Selcuk Kopru <selcuk.kopru@tyazilimevi.com> writes:
>
> >> I'm trying to write user-defined commands to view some
> >> nested/embedded classes which form a huge data hierarchy.
>
> My advice is to switch to CVS GDB and use the new Python-based
> pretty-printing feature.
>
> With this feature you can write Python code to customize the display of
> various objects in your program. This is mostly transparent to the user
> -- "print" will print them prettily, so will stack traces, so will MI
> (soon), etc.
>
> >> define show_string
> >> wchar_print ((CMyString*)$arg0).m_Value
> >> end
>
> CVS GDB also has direct support for wide characters.
>
> >> If the "show_dag" command is being hit for the second time in the same
> >> call sequence then the "$dlist" variable becomes invalid at the time the
> >> control returns back to the first instance of the "show_dag" command and
> >> resulting in a "Cannot access memory at address 0x.." error message. How
> >> can I prevent this error?
>
> I suppose you could allocate an array and then manage the recursion
> manually by using $dlist[$depth].
>
> Otherwise, yeah, this seems like a limitation of gdb's scripting
> language. It seems like it would nice to let user-defined commands
> define local variables.
>
> Tom
next prev parent reply other threads:[~2009-09-04 19:29 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-12 23:10 Selcuk Kopru
2009-08-13 15:59 ` Tom Tromey
2009-09-04 19:29 ` Selcuk Kopru [this message]
2009-09-04 19:31 ` Tom Tromey
2009-09-05 0:13 ` Selcuk Kopru
2009-09-09 22:38 ` 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=1252092562.3662.8.camel@selcuk-laptop \
--to=selcuk.kopru@tyazilimevi.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