This is the mail archive of the gdb@sources.redhat.com 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: Processing of convenience variables for scripts ...


On Fri, 6 Dec 2002, Daniel Jacobowitz wrote:

> On Fri, Dec 06, 2002 at 08:57:07AM -0800, Richard Sharpe wrote:
> > Hi,
> > 
> > In looking at this issue, it seems that much of the existing code that 
> > deals with variables is centered around printing:
> > 
> >    value_print (var->value, gdb_stdout, 0, Val_pretty_default);
> > 
> > While it seems that I could mess with providing new functions for a stream 
> > structure that I could retrieve strings from, is there a simpler way.
> > 
> > I envision something like 
> > 
> >   var1 = value_to_string (var->value);
> > 
> > And then construct a new command, and pass it through the standard routine 
> > that processes commands. 
> > 
> > However, it seems that things are not that simple :-)
> 
> You're looking in the wrong place, I'd say.  Look in parse.c for the
> call to:
>  lookup_internalvar (copy_name (str) + 1)

OK, but the problem there is that lookup_internalvar returns a struct 
internalvar *. While there is a function value_of_internal var (also in 
values.c), it returns a struct value *.

I need the value of an internal var as something approximating a C 
string, and the only functions that deal with displaying the value of an 
internal variable (or any variable, it seems) is value_print, which wants 
a struct ui_file *. Or so it seems?

Have the recreational drugs finally proven too much, or have I got it 
right here?

Regards
-----
Richard Sharpe, rsharpe[at]ns.aus.com, rsharpe[at]samba.org, 
sharpe[at]ethereal.com, http://www.richardsharpe.com


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