[patch] varobj.c c_describe_child

Aleksandar Ristovski aristovski@qnx.com
Mon Mar 22 19:42:00 GMT 2010


Hello,

When printing children of a variable created with a pointer 
type, gdb generates a copy of value of target type for each 
child. This quickly exhausts memory in certain cases.

In my case, customer has a struct with 1600+ fields and of 
size approx 900K. Listing children of such struct via a 
variable created with a pointer to it, crashes gdb (gdb 
version 6.8) due to running out of memory. The patch fixes 
this by removing intermediate value and freeing it.

Note that with latest gdb from HEAD it doesn't crash, I 
believe due to recent changes in lazy allocating the values, 
but it still seems wrong to keep all these intermediate 
values generated by 'adjust_value_for_child_access' in 
'all_values' list.


Thanks,

-- 
Aleksandar Ristovski
QNX Software Systems


ChangeLog:

2010-03-22  Aleksandar Ristovski  <aristovski@qnx.com>

	* varobj.c (c_describe_child): Do not keep temporary parent 
value
	while fetching child's value.

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: varobj-removetempvalue-20100322-ChangeLog.patch
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20100322/27b64f45/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: varobj-removetempvalue-20100322.patch
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20100322/27b64f45/attachment-0001.ksh>


More information about the Gdb-patches mailing list