This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: recursive user-defined commands and
- From: Selcuk Kopru <selcuk dot kopru at tyazilimevi dot com>
- To: gdb at sourceware dot org
- Date: Fri, 04 Sep 2009 20:13:21 -0400
- Subject: Re: recursive user-defined commands and
- References: <1250118614.3975.43.camel@selcuk-laptop> <m33a7vpuwd.fsf@fleche.redhat.com> <1252092562.3662.8.camel@selcuk-laptop> <m3my5aa4m6.fsf@fleche.redhat.com>
- Reply-to: selcuk dot kopru at tyazilimevi dot com
Hi,
Thanks for the reply. I'm making progress but was not able to solve the
problem yet. The following 3 examples didn't work, all giving "A syntax
error in expression, near `)malloc(..." message:
1) set variable $myvar = (List<CLECSFeatValue>::LNode**)malloc(10 *
sizeof(List<CLECSFeatValue>::LNode*))
2) set variable $myvar = (List<CLECSFeatValue>::LNode*)malloc(10 *
sizeof(List<CLECSFeatValue>::LNode))
3) set variable $myvar = ((struct
List<CLECSFeatValue>::LNode)*)malloc(10 *
sizeof(List<CLECSFeatValue>::LNode))
The following 2 commands work as expected.
4) p sizeof(struct List<CLECSFeatValue>::LNode)
$81 = 12
5) p sizeof(List<CLECSFeatValue>::LNode)
$81 = 12
But the following do not work even if I put parentheses everywhere.
6) p sizeof(struct List<CLECSFeatValue>::LNode*)
7) p sizeof(List<CLECSFeatValue>::LNode*)
Using void* didn't help as it wasn't possible to cast to the LNode*
type.
Thanks,
selcuk
On Fri, 2009-09-04 at 13:31 -0600, Tom Tromey wrote:
> >>>>> ">" == Selcuk Kopru <selcuk.kopru@tyazilimevi.com> writes:
>
> >> How can we allocate an array type convenience variable?
>
> set variable $var = (type *) malloc (count * sizeof (type))
>
> Tom