Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Surya Kiran Gullapalli <suryakiran.gullapalli@gmail.com>
To: gdb@sourceware.org
Subject: gdb command output in python script
Date: Thu, 14 Apr 2011 07:48:00 -0000	[thread overview]
Message-ID: <BANLkTi=LsV1KD=hiw6fUASQhsEEUc9Zf3g@mail.gmail.com> (raw)
In-Reply-To: <BANLkTinuSmy6eTW=0afTZ75Ne5+9u59QRQ@mail.gmail.com>

On Thu, Apr 14, 2011 at 09:44, Surya Kiran Gullapalli
<suryakiran.gullapalli@gmail.com> wrote:
>
> Hello all,
> I'm trying to implement some pretty-printers for my C++ classes and I want two types of outputs in debug. verbose and concise. User can turn on/off the verbosity levels on gdb command prompt like this
>
> (gdb) set gs-verbose on
> or
> (gdb) set gs-verbose off
>
> where gs-verbose is the custom command (sets a boolean flag to true/false). Now In pretty printer I want to do something like this
>
> define to_string():
>     if_less_verbose:
>         return concise_string
>     else:
>         return string
>
> My question is, how can i get the value of verbosity in python code. I can use gdb.execute to get the output of the gdb command, but it will be stored in a string. Is string comparison is the only option. Can I get a boolean value from
> custom command ?
>
> Thanks in advance,
> Surya

Hi,

I've achieved this using custom parameter (derived from gdb.Parameter)
and calling gdb.parameter() function from python to fetch the
parameter value.

Thanks,
Surya


       reply	other threads:[~2011-04-14  7:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <BANLkTikJ2EL53+czXAZmG-w4itXgso=27Q@mail.gmail.com>
     [not found] ` <BANLkTinuSmy6eTW=0afTZ75Ne5+9u59QRQ@mail.gmail.com>
2011-04-14  7:48   ` Surya Kiran Gullapalli [this message]
2011-04-14  8:08     ` Kevin Pouget

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='BANLkTi=LsV1KD=hiw6fUASQhsEEUc9Zf3g@mail.gmail.com' \
    --to=suryakiran.gullapalli@gmail.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