Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Selcuk Kopru <selcuk.kopru@tyazilimevi.com>
To: gdb@sourceware.org
Subject: Re: recursive user-defined commands and
Date: Sat, 05 Sep 2009 00:13:00 -0000	[thread overview]
Message-ID: <1252109601.3667.47.camel@selcuk-laptop> (raw)
In-Reply-To: <m3my5aa4m6.fsf@fleche.redhat.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


  reply	other threads:[~2009-09-05  0:13 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
2009-09-04 19:31     ` Tom Tromey
2009-09-05  0:13       ` Selcuk Kopru [this message]
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=1252109601.3667.47.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