Re: [PATCH] printcmd.c (ui_printf): make internalvar string can be printf and eval when inferior cannot alloc memory

Tom Tromey
2011-07-21T20:38:37Z

>>>>> ">" == Hui Zhu <teawater@gmail.com> writes:

>> So I make a patch to handle the error from value_as_address. If
>> value_as_address get error and this is a internalvar, call
>> value_contents to get the address of the val.

I don't think this is the best approach to solve this problem.

It seems to me that if the value is already an array, the data might
already exist in gdb, and then you don't have to even try to coerce it
to memory. (However, for a pointer or integer value, using
value_as_address is still the best thing.)

I would suggest looking to see how valprint handles this situation, then
do the same thing here.

Tom