access variables in canned command sequences

vb vb@vsbe.com
Tue Apr 10 19:05:00 GMT 2007


On 4/9/07, Nick Roberts <nickrob@snap.net.nz> wrote:
>  > > 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.


No, this I did not know, and it probably will do what I need, let me look.

Thanks a lot for the hint, Nick!

cheers
vadim
>  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
>



More information about the Gdb mailing list