[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gdb-patches
Subject:    [PATCH] Initialise data to appease valgrind
From:       andrew.stubbs () st ! com (Andrew STUBBS)
Date:       2006-06-23 13:09:00
Message-ID: 449BD7F5.5090604 () st ! com
[Download RAW message or body]

When 'set debug expression 1' is used the debug code prints the full
contents of the expression 'elts' as a hex/ASCII dump. Unfortunately
this is a union so parts of it are potentially uninitialised.

This is not normally a problem (although displaying random data doesn't
sound like a good idea to me - especially for autotester etc.), but when
run under valgrind it causes a lot of output which hides the real problems.

The attached patch initialises the union before using it to ensure that
the whole thing is initialised. I suppose that it is not necessary to
initialise it in all the cases I have covered - the data fills the union
anyway, but it is safer this way and I imagine the compiler will do the
right thing in any case.

Tested with no regressions.

Andrew Stubbs

:ADDPATCH parse.c:
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: debug-expression.patch
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20060623/49fac8b7/attachment.ksh>

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic