recursive user-defined commands and
Selcuk Kopru
selcuk.kopru@tyazilimevi.com
Fri Sep 4 19:29:00 GMT 2009
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
More information about the Gdb
mailing list