This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] printcmd.c (ui_printf): make internalvar string can be printf and eval when inferior cannot alloc memory
- From: Tom Tromey <tromey at redhat dot com>
- To: Hui Zhu <teawater at gmail dot com>
- Cc: gdb-patches ml <gdb-patches at sourceware dot org>
- Date: Thu, 21 Jul 2011 14:38:20 -0600
- Subject: Re: [PATCH] printcmd.c (ui_printf): make internalvar string can be printf and eval when inferior cannot alloc memory
- References: <CANFwon0RttecHT1BrVx886NC6yCsojHm-MWfr7ttS8=CjoNEzg@mail.gmail.com>
>>>>> ">" == 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