This is the mail archive of the gdb@sourceware.org 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: access variables in canned command sequences


 > > define xyz
 > >   printf "offset is %d\n", $offs
 > > end
 > >
 > 
 > Yeah, this works as we know, but is there any way of passing an
 > internal variable value to the shell?

It's not clear to me what you want to do but you could write the data to a
file and read that file from the shell script:

 set logging file input.dat

 define xyz
   set logging on
   printf "offset is %d\n", $offs
   set logging off
 end

However, perhaps we know that too.  AFAIK convenience variables are handled in
GDB just like ordinary program variables.  I don't think you can currently
regard the GDB command line as a program language but Daniel Jacobowitz is
working on something more powerful.

 > Somebody mentioned setting up an environment variable - this seems
 > interesting, I tried
 > 
 > set environment offset 0x1000
 > shell env | grep offset
 > 
 > `offset' does not get set for the shell started from within gdb....

(gdb) help set environment
Set environment variable value to give the program.
                                  ^^^^
-- 
Nick                                           http://www.inet.net.nz/~nickrob


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