* gdb command output in python script [not found] ` <BANLkTinuSmy6eTW=0afTZ75Ne5+9u59QRQ@mail.gmail.com> @ 2011-04-14 7:48 ` Surya Kiran Gullapalli 2011-04-14 8:08 ` Kevin Pouget 0 siblings, 1 reply; 2+ messages in thread From: Surya Kiran Gullapalli @ 2011-04-14 7:48 UTC (permalink / raw) To: gdb 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 ^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: gdb command output in python script 2011-04-14 7:48 ` gdb command output in python script Surya Kiran Gullapalli @ 2011-04-14 8:08 ` Kevin Pouget 0 siblings, 0 replies; 2+ messages in thread From: Kevin Pouget @ 2011-04-14 8:08 UTC (permalink / raw) To: Surya Kiran Gullapalli; +Cc: gdb another way would be not to use >> (gdb) set gs-verbose on but rather >> (gdb) set_gs-verbose on where `set_gs-verbose' is a python command you defined. In this function, you can set your (global/class variable) verbosity level according to the `args', so that's is directly available from your `to_string()' Kevin On Thu, Apr 14, 2011 at 3:48 AM, Surya Kiran Gullapalli <suryakiran.gullapalli@gmail.com> wrote: > 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 > ^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-04-14 8:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <BANLkTikJ2EL53+czXAZmG-w4itXgso=27Q@mail.gmail.com>
[not found] ` <BANLkTinuSmy6eTW=0afTZ75Ne5+9u59QRQ@mail.gmail.com>
2011-04-14 7:48 ` gdb command output in python script Surya Kiran Gullapalli
2011-04-14 8:08 ` Kevin Pouget
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox