This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: recursive user-defined commands and


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]