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