Convenience variable for filename in add-symbol-file not expanded
Andrew STUBBS
andrew.stubbs@st.com
Thu Sep 29 14:04:00 GMT 2005
David Lamy-Charrier wrote:
> Thanks Andrew,
>
> I already have a static buffer in the inferior program containing the
> path to the file I want to use.
> You mean that I should declare a pointer to the variable in the
> inferior program too ?
> And then how can I access the pointed value in gdb, using
> value_of_internalvar() or parse_and_eval_address() or anything else) ?
No, I mean you can create a convenience variable with type char*. The
command language can be made to substitute convenience variables
starting with $, but it seems a little much to expect it to unpick
program variables as well.
So, if your string were referenced by an inferior variable 'filename',
it would look like:
(gdb) set $name = filename
(gdb) set $address = 0x.....
(gdb) add-symbol-file $name $address
You can then use lookup_internalvar() to get the address and then read
the string from memory somehow, get_target_memory() probably (look in
target.h for the various options). Of course, there may be a better way
... anyone?
HTH
Andrew
More information about the Gdb
mailing list