Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: "Brendan Doherty" <brendand@gentrack.com>
To: <gdb@sources.redhat.com>
Subject: Type identification within a user defined commands
Date: Wed, 20 Oct 2004 22:22:00 -0000	[thread overview]
Message-ID: <7D8E31C9DCC5204AB4AA23315B352F5B2F0DE6@exchange.talgentra.co.nz> (raw)

Is it possible to identify the type of a variable passed to a user
defined command.

I'm trying to create a prettier print that displays information about
the various classes that we use.
I want to use the type to access attributes specific to that class.

What I am trying to do is considerable more complex than the example
below, bug it demostrates what I want to do.

EXAMPLE
======= 

define myprint
  set $classtype = (whatis $arg0)
  if $classtype = dog then
    printf "Dog:\n"
    printf "Name: %s\n", $arg0->name->str
    printf "Number of holes dug: %d\n, $arg0->numholes    
  else 
    if $classtype = bird
      printf "Bird:\n"
      printf "Name: %s\n", $arg0->name->str
      printf "Number of worms: %d\n, $arg0->numworms
    end
  end
end


             reply	other threads:[~2004-10-20 21:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-20 22:22 Brendan Doherty [this message]
2004-10-20 23:48 ` Daniel Jacobowitz

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=7D8E31C9DCC5204AB4AA23315B352F5B2F0DE6@exchange.talgentra.co.nz \
    --to=brendand@gentrack.com \
    --cc=gdb@sources.redhat.com \
    /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