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: Convenience variable for filename in add-symbol-file not expanded


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) ?

Thanks,
David



> I wanted to do much the same thing a while back.
>
> Unless I am very much mistaken, there is no way to assign a string to a
> convenience variable. The nearest you can get is to place it in the
> inferior program's memory somewhere (perhaps using malloc, or some fixed
> location) and then assign a pointer to the variable. Obviously you can't
> do this until there is some memory to write to. However, you could
> extend the patch to expect a 'char *' variable for the name.
>
> Also, all convenience variables are wiped by the file and symbol-file
> commands (because their types disappear along with the old symbol
> table), so they aren't that convenient for scripting this kind of thing.
>
> Andrew
>


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