[RFC] Let "gcore" command accept a suffix argument
Thu Dec 10 17:08:00 GMT 2009
>>>>> ">" == Hui Zhu <email@example.com> writes:
>> I make a patch to make gdb support "eval gcore foo.$a" command.
>> +#define CMDSIZE 1024
>> + char cmd[CMDSIZE + 1];
Don't use a fixed-size buffer. Allocate on the heap and use a cleanup.
>> + value = parse_and_eval (eval_begin);
This is going to give an error if anything appears after "$foo".
Try something like:
eval echo $foo $bar
You have multiple choices here.
You could make it only support convenience variables. Then you would
just have to extract the name and then look up the value.
Or you could try to introduce syntax allowing arbitrary expressions.
One idea that comes to mind is to reuse some code and make eval work
eval "echo %s %d", $foo, $bar + 87
Now that I write it that seems weird :-)
>> + add_com ("eval", no_class, eval_command, _("\
>> +Call command with variable."));
Exactly what to write depends on how it is implemented.
This also needs a documentation change, a NEWS entry, and test cases.
More information about the Gdb-patches