|
From: Philippe W. <phi...@sk...> - 2012-06-16 06:54:07
|
On Sat, 2012-06-16 at 01:28 +0200, Roland Mainz wrote:
> Or short: Each time a variable name is printed it's address should be
> printed, too. That helps a lot in finding the right place to look
> _and_ it helps if the code has multiple variables with the same name
> but different addresses (yeah... I had this specific kind of hell this
> week).
At least for global arrays, adding the address looks easy.
Index: exp-sgcheck/sg_main.c
===================================================================
--- exp-sgcheck/sg_main.c (revision 12643)
+++ exp-sgcheck/sg_main.c (working copy)
@@ -966,8 +966,9 @@
break;
case Inv_Global:
str = "array";
- VG_(sprintf)(buf, "global %s \"%s\" of size %'lu in object with soname \"%s\"",
+ VG_(sprintf)(buf, "global %s \"%s\" of address %p size %'lu in object with soname \"%s\"",
str, inv->Inv.Global.nd->descr->name,
+ inv->Inv.Global.nd->addr,
inv->Inv.Global.nd->descr->szB,
inv->Inv.Global.nd->descr->soname );
break;
The new output is:
==24431== Invalid read of size 2
==24431== at 0x4004B3: main (globalerr.c:12)
==24431== Address 0x60089e expected vs actual:
==24431== Expected: global array "b" of address 0x600890 size 14 in object with soname "NONE"
==24431== Actual: unknown
==24431== Actual: is 0 after Expected
Note however that 0x60089e = 0x600890 + size 14 + 'is 0 after Expected'
In this, the current error msg gives all elements but one.
So, the last one can be derived from the others.
The above patch is trivial (would need to update the doc and the tests).
I would prefer to have feedback from Julian on this before working further.
The best is to put a wishlist in bugzilla.
Philippe
|