|
From: Matthias S. <zz...@ge...> - 2015-07-02 19:13:07
|
Compiling for x86 on amd64 needs -m32. --- none/tests/Makefile.am | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/none/tests/Makefile.am b/none/tests/Makefile.am index dd5959e..3ce7a45 100644 --- a/none/tests/Makefile.am +++ b/none/tests/Makefile.am @@ -258,10 +258,10 @@ else nestedfns_CFLAGS = $(AM_CFLAGS) mq_LDADD = -lrt endif -libvex_test_CFLAGS = @FLAG_FSANITIZE@ +libvex_test_CFLAGS = $(AM_CFLAGS) @FLAG_FSANITIZE@ libvex_test_LDADD = ../../VEX/libvex-@VGCONF_ARCH_PRI@-@VGCONF_OS@.a \ @LIB_UBSAN@ -libvexmultiarch_test_CFLAGS= @FLAG_FSANITIZE@ +libvexmultiarch_test_CFLAGS= $(AM_CFLAGS) @FLAG_FSANITIZE@ libvexmultiarch_test_LDADD = \ ../../VEX/libvexmultiarch-@VGCONF_ARCH_PRI@-@VGCONF_OS@.a \ ../../VEX/libvex-@VGCONF_ARCH_PRI@-@VGCONF_OS@.a @LIB_UBSAN@ -- 2.4.3 |
|
From: Matthias S. <zz...@ge...> - 2015-07-02 19:13:11
|
There were different events using the same numbers
---
memcheck/mc_main.c | 70 +++++++++++++++++++++++++++---------------------------
1 file changed, 35 insertions(+), 35 deletions(-)
diff --git a/memcheck/mc_main.c b/memcheck/mc_main.c
index 0d6ebcd..73778fa 100644
--- a/memcheck/mc_main.c
+++ b/memcheck/mc_main.c
@@ -3386,19 +3386,19 @@ static void VG_REGPARM(1) mc_die_mem_stack_160(Addr new_SP)
static void mc_new_mem_stack_w_ECU ( Addr a, SizeT len, UInt ecu )
{
UInt otag = ecu | MC_OKIND_STACK;
- PROF_EVENT(115, "new_mem_stack_w_otag");
+ PROF_EVENT(130, "new_mem_stack_w_otag");
MC_(make_mem_undefined_w_otag) ( -VG_STACK_REDZONE_SZB + a, len, otag );
}
static void mc_new_mem_stack ( Addr a, SizeT len )
{
- PROF_EVENT(115, "new_mem_stack");
+ PROF_EVENT(119, "new_mem_stack");
make_mem_undefined ( -VG_STACK_REDZONE_SZB + a, len );
}
static void mc_die_mem_stack ( Addr a, SizeT len )
{
- PROF_EVENT(125, "die_mem_stack");
+ PROF_EVENT(129, "die_mem_stack");
MC_(make_mem_noaccess) ( -VG_STACK_REDZONE_SZB + a, len );
}
@@ -4392,7 +4392,7 @@ VG_REGPARM(2) void MC_(helperc_LOADV128le) ( /*OUT*/V128* res, Addr a )
static INLINE
ULong mc_LOADV64 ( Addr a, Bool isBigEndian )
{
- PROF_EVENT(200, "mc_LOADV64");
+ PROF_EVENT(210, "mc_LOADV64");
#ifndef PERF_FAST_LOADV
return mc_LOADVn_slow( a, 64, isBigEndian );
@@ -4402,7 +4402,7 @@ ULong mc_LOADV64 ( Addr a, Bool isBigEndian )
SecMap* sm;
if (UNLIKELY( UNALIGNED_OR_HIGH(a,64) )) {
- PROF_EVENT(201, "mc_LOADV64-slow1");
+ PROF_EVENT(211, "mc_LOADV64-slow1");
return (ULong)mc_LOADVn_slow( a, 64, isBigEndian );
}
@@ -4419,7 +4419,7 @@ ULong mc_LOADV64 ( Addr a, Bool isBigEndian )
return V_BITS64_UNDEFINED;
} else {
/* Slow case: the 8 bytes are not all-defined or all-undefined. */
- PROF_EVENT(202, "mc_LOADV64-slow2");
+ PROF_EVENT(212, "mc_LOADV64-slow2");
return mc_LOADVn_slow( a, 64, isBigEndian );
}
}
@@ -4439,7 +4439,7 @@ VG_REGPARM(1) ULong MC_(helperc_LOADV64le) ( Addr a )
static INLINE
void mc_STOREV64 ( Addr a, ULong vbits64, Bool isBigEndian )
{
- PROF_EVENT(210, "mc_STOREV64");
+ PROF_EVENT(220, "mc_STOREV64");
#ifndef PERF_FAST_STOREV
// XXX: this slow case seems to be marginally faster than the fast case!
@@ -4451,7 +4451,7 @@ void mc_STOREV64 ( Addr a, ULong vbits64, Bool isBigEndian )
SecMap* sm;
if (UNLIKELY( UNALIGNED_OR_HIGH(a,64) )) {
- PROF_EVENT(211, "mc_STOREV64-slow1");
+ PROF_EVENT(221, "mc_STOREV64-slow1");
mc_STOREVn_slow( a, 64, vbits64, isBigEndian );
return;
}
@@ -4470,7 +4470,7 @@ void mc_STOREV64 ( Addr a, ULong vbits64, Bool isBigEndian )
((UShort*)(sm->vabits8))[sm_off16] = (UShort)VA_BITS16_DEFINED;
return;
}
- PROF_EVENT(232, "mc_STOREV64-slow2");
+ PROF_EVENT(222, "mc_STOREV64-slow2");
mc_STOREVn_slow( a, 64, vbits64, isBigEndian );
return;
}
@@ -4482,12 +4482,12 @@ void mc_STOREV64 ( Addr a, ULong vbits64, Bool isBigEndian )
((UShort*)(sm->vabits8))[sm_off16] = (UShort)VA_BITS16_UNDEFINED;
return;
}
- PROF_EVENT(232, "mc_STOREV64-slow3");
+ PROF_EVENT(223, "mc_STOREV64-slow3");
mc_STOREVn_slow( a, 64, vbits64, isBigEndian );
return;
}
- PROF_EVENT(212, "mc_STOREV64-slow4");
+ PROF_EVENT(224, "mc_STOREV64-slow4");
mc_STOREVn_slow( a, 64, vbits64, isBigEndian );
}
#endif
@@ -4508,7 +4508,7 @@ VG_REGPARM(1) void MC_(helperc_STOREV64le) ( Addr a, ULong vbits64 )
static INLINE
UWord mc_LOADV32 ( Addr a, Bool isBigEndian )
{
- PROF_EVENT(220, "mc_LOADV32");
+ PROF_EVENT(230, "mc_LOADV32");
#ifndef PERF_FAST_LOADV
return (UWord)mc_LOADVn_slow( a, 32, isBigEndian );
@@ -4518,7 +4518,7 @@ UWord mc_LOADV32 ( Addr a, Bool isBigEndian )
SecMap* sm;
if (UNLIKELY( UNALIGNED_OR_HIGH(a,32) )) {
- PROF_EVENT(221, "mc_LOADV32-slow1");
+ PROF_EVENT(231, "mc_LOADV32-slow1");
return (UWord)mc_LOADVn_slow( a, 32, isBigEndian );
}
@@ -4537,7 +4537,7 @@ UWord mc_LOADV32 ( Addr a, Bool isBigEndian )
return ((UWord)0xFFFFFFFF00000000ULL | (UWord)V_BITS32_UNDEFINED);
} else {
/* Slow case: the 4 bytes are not all-defined or all-undefined. */
- PROF_EVENT(222, "mc_LOADV32-slow2");
+ PROF_EVENT(232, "mc_LOADV32-slow2");
return (UWord)mc_LOADVn_slow( a, 32, isBigEndian );
}
}
@@ -4598,7 +4598,7 @@ VG_REGPARM(1) UWord MC_(helperc_LOADV32le) ( Addr a )
static INLINE
void mc_STOREV32 ( Addr a, UWord vbits32, Bool isBigEndian )
{
- PROF_EVENT(230, "mc_STOREV32");
+ PROF_EVENT(240, "mc_STOREV32");
#ifndef PERF_FAST_STOREV
mc_STOREVn_slow( a, 32, (ULong)vbits32, isBigEndian );
@@ -4608,7 +4608,7 @@ void mc_STOREV32 ( Addr a, UWord vbits32, Bool isBigEndian )
SecMap* sm;
if (UNLIKELY( UNALIGNED_OR_HIGH(a,32) )) {
- PROF_EVENT(231, "mc_STOREV32-slow1");
+ PROF_EVENT(241, "mc_STOREV32-slow1");
mc_STOREVn_slow( a, 32, (ULong)vbits32, isBigEndian );
return;
}
@@ -4627,7 +4627,7 @@ void mc_STOREV32 ( Addr a, UWord vbits32, Bool isBigEndian )
sm->vabits8[sm_off] = (UInt)VA_BITS8_DEFINED;
return;
}
- PROF_EVENT(232, "mc_STOREV32-slow2");
+ PROF_EVENT(242, "mc_STOREV32-slow2");
mc_STOREVn_slow( a, 32, (ULong)vbits32, isBigEndian );
return;
}
@@ -4639,12 +4639,12 @@ void mc_STOREV32 ( Addr a, UWord vbits32, Bool isBigEndian )
sm->vabits8[sm_off] = (UInt)VA_BITS8_UNDEFINED;
return;
}
- PROF_EVENT(233, "mc_STOREV32-slow3");
+ PROF_EVENT(243, "mc_STOREV32-slow3");
mc_STOREVn_slow( a, 32, (ULong)vbits32, isBigEndian );
return;
}
- PROF_EVENT(234, "mc_STOREV32-slow4");
+ PROF_EVENT(244, "mc_STOREV32-slow4");
mc_STOREVn_slow( a, 32, (ULong)vbits32, isBigEndian );
}
#endif
@@ -4665,7 +4665,7 @@ VG_REGPARM(2) void MC_(helperc_STOREV32le) ( Addr a, UWord vbits32 )
static INLINE
UWord mc_LOADV16 ( Addr a, Bool isBigEndian )
{
- PROF_EVENT(240, "mc_LOADV16");
+ PROF_EVENT(250, "mc_LOADV16");
#ifndef PERF_FAST_LOADV
return (UWord)mc_LOADVn_slow( a, 16, isBigEndian );
@@ -4675,7 +4675,7 @@ UWord mc_LOADV16 ( Addr a, Bool isBigEndian )
SecMap* sm;
if (UNLIKELY( UNALIGNED_OR_HIGH(a,16) )) {
- PROF_EVENT(241, "mc_LOADV16-slow1");
+ PROF_EVENT(251, "mc_LOADV16-slow1");
return (UWord)mc_LOADVn_slow( a, 16, isBigEndian );
}
@@ -4695,7 +4695,7 @@ UWord mc_LOADV16 ( Addr a, Bool isBigEndian )
else if (vabits4 == VA_BITS4_UNDEFINED) { return V_BITS16_UNDEFINED; }
else {
/* Slow case: the two bytes are not all-defined or all-undefined. */
- PROF_EVENT(242, "mc_LOADV16-slow2");
+ PROF_EVENT(252, "mc_LOADV16-slow2");
return (UWord)mc_LOADVn_slow( a, 16, isBigEndian );
}
}
@@ -4786,7 +4786,7 @@ Bool accessible_vabits4_in_vabits8 ( Addr a, UChar vabits8 )
static INLINE
void mc_STOREV16 ( Addr a, UWord vbits16, Bool isBigEndian )
{
- PROF_EVENT(250, "mc_STOREV16");
+ PROF_EVENT(260, "mc_STOREV16");
#ifndef PERF_FAST_STOREV
mc_STOREVn_slow( a, 16, (ULong)vbits16, isBigEndian );
@@ -4796,7 +4796,7 @@ void mc_STOREV16 ( Addr a, UWord vbits16, Bool isBigEndian )
SecMap* sm;
if (UNLIKELY( UNALIGNED_OR_HIGH(a,16) )) {
- PROF_EVENT(251, "mc_STOREV16-slow1");
+ PROF_EVENT(261, "mc_STOREV16-slow1");
mc_STOREVn_slow( a, 16, (ULong)vbits16, isBigEndian );
return;
}
@@ -4817,7 +4817,7 @@ void mc_STOREV16 ( Addr a, UWord vbits16, Bool isBigEndian )
&(sm->vabits8[sm_off]) );
return;
}
- PROF_EVENT(232, "mc_STOREV16-slow2");
+ PROF_EVENT(262, "mc_STOREV16-slow2");
mc_STOREVn_slow( a, 16, (ULong)vbits16, isBigEndian );
}
if (V_BITS16_UNDEFINED == vbits16) {
@@ -4830,12 +4830,12 @@ void mc_STOREV16 ( Addr a, UWord vbits16, Bool isBigEndian )
&(sm->vabits8[sm_off]) );
return;
}
- PROF_EVENT(233, "mc_STOREV16-slow3");
+ PROF_EVENT(263, "mc_STOREV16-slow3");
mc_STOREVn_slow( a, 16, (ULong)vbits16, isBigEndian );
return;
}
- PROF_EVENT(234, "mc_STOREV16-slow4");
+ PROF_EVENT(264, "mc_STOREV16-slow4");
mc_STOREVn_slow( a, 16, (ULong)vbits16, isBigEndian );
}
#endif
@@ -4909,7 +4909,7 @@ __asm__( /* Derived from NCode template */
VG_REGPARM(1)
UWord MC_(helperc_LOADV8) ( Addr a )
{
- PROF_EVENT(260, "mc_LOADV8");
+ PROF_EVENT(270, "mc_LOADV8");
#ifndef PERF_FAST_LOADV
return (UWord)mc_LOADVn_slow( a, 8, False/*irrelevant*/ );
@@ -4919,7 +4919,7 @@ UWord MC_(helperc_LOADV8) ( Addr a )
SecMap* sm;
if (UNLIKELY( UNALIGNED_OR_HIGH(a,8) )) {
- PROF_EVENT(261, "mc_LOADV8-slow1");
+ PROF_EVENT(271, "mc_LOADV8-slow1");
return (UWord)mc_LOADVn_slow( a, 8, False/*irrelevant*/ );
}
@@ -4939,7 +4939,7 @@ UWord MC_(helperc_LOADV8) ( Addr a )
else if (vabits2 == VA_BITS2_UNDEFINED) { return V_BITS8_UNDEFINED; }
else {
/* Slow case: the byte is not all-defined or all-undefined. */
- PROF_EVENT(262, "mc_LOADV8-slow2");
+ PROF_EVENT(272, "mc_LOADV8-slow2");
return (UWord)mc_LOADVn_slow( a, 8, False/*irrelevant*/ );
}
}
@@ -4952,7 +4952,7 @@ UWord MC_(helperc_LOADV8) ( Addr a )
VG_REGPARM(2)
void MC_(helperc_STOREV8) ( Addr a, UWord vbits8 )
{
- PROF_EVENT(270, "mc_STOREV8");
+ PROF_EVENT(280, "mc_STOREV8");
#ifndef PERF_FAST_STOREV
mc_STOREVn_slow( a, 8, (ULong)vbits8, False/*irrelevant*/ );
@@ -4962,7 +4962,7 @@ void MC_(helperc_STOREV8) ( Addr a, UWord vbits8 )
SecMap* sm;
if (UNLIKELY( UNALIGNED_OR_HIGH(a,8) )) {
- PROF_EVENT(271, "mc_STOREV8-slow1");
+ PROF_EVENT(281, "mc_STOREV8-slow1");
mc_STOREVn_slow( a, 8, (ULong)vbits8, False/*irrelevant*/ );
return;
}
@@ -5018,7 +5018,7 @@ void MC_(helperc_STOREV8) ( Addr a, UWord vbits8 )
&(sm->vabits8[sm_off]) );
return;
}
- PROF_EVENT(232, "mc_STOREV8-slow2");
+ PROF_EVENT(282, "mc_STOREV8-slow2");
mc_STOREVn_slow( a, 8, (ULong)vbits8, False/*irrelevant*/ );
return;
}
@@ -5034,13 +5034,13 @@ void MC_(helperc_STOREV8) ( Addr a, UWord vbits8 )
&(sm->vabits8[sm_off]) );
return;
}
- PROF_EVENT(233, "mc_STOREV8-slow3");
+ PROF_EVENT(283, "mc_STOREV8-slow3");
mc_STOREVn_slow( a, 8, (ULong)vbits8, False/*irrelevant*/ );
return;
}
// Partially defined word
- PROF_EVENT(234, "mc_STOREV8-slow4");
+ PROF_EVENT(284, "mc_STOREV8-slow4");
mc_STOREVn_slow( a, 8, (ULong)vbits8, False/*irrelevant*/ );
}
#endif
--
2.4.3
|
|
From: Matthias S. <zz...@ge...> - 2015-07-23 17:36:47
|
An additional comment to memcheck profiling.
The counter values should be printed unsigned. For same cases it might
even be useful to have 64bit counters instead.
--- a/memcheck/mc_main.c
+++ b/memcheck/mc_main.c
@@ -6363,7 +6363,7 @@ static void done_prof_mem ( void )
}
if (MC_(event_ctr)[i] > 0) {
spaced = False;
- VG_(printf)( "prof mem event %3d: %9d %s\n",
+ VG_(printf)( "prof mem event %3d: %9u %s\n",
i, MC_(event_ctr)[i],
MC_(event_ctr_name)[i]
? MC_(event_ctr_name)[i] : "unnamed");
Regards
Matthias
|
|
From: John R. <jr...@bi...> - 2015-07-31 13:24:09
|
> The option -Wformat-signedness should do what is needed here. > Did I say *many* places? A build on x86-64 produces 5131 warnings. > Good grief! About as many as running memcheck for the first time on a program of similar size ;-) |
|
From: Florian K. <fl...@ei...> - 2015-08-09 20:57:34
|
On 23.07.2015 19:36, Matthias Schwarzott wrote: > An additional comment to memcheck profiling. > > The counter values should be printed unsigned. For same cases it might > even be useful to have 64bit counters instead. Event counters are now 64-bit wide entities (r15516) and are printed as unsigned numbers. Florian |
|
From: Florian K. <fl...@ei...> - 2015-07-30 21:46:49
|
On 23.07.2015 19:36, Matthias Schwarzott wrote:
> An additional comment to memcheck profiling.
>
> The counter values should be printed unsigned.
How did you find this? There are *many* places in valgrind where an
incorrect format is used to print unsigned values. It would be good to
clean that up. But neither gcc nor clang is of any help here even though
VG_(printf) has a printf-like attribute and we compile with -Wformat and
what not...
Florian
> --- a/memcheck/mc_main.c
> +++ b/memcheck/mc_main.c
> @@ -6363,7 +6363,7 @@ static void done_prof_mem ( void )
> }
> if (MC_(event_ctr)[i] > 0) {
> spaced = False;
> - VG_(printf)( "prof mem event %3d: %9d %s\n",
> + VG_(printf)( "prof mem event %3d: %9u %s\n",
> i, MC_(event_ctr)[i],
> MC_(event_ctr_name)[i]
> ? MC_(event_ctr_name)[i] : "unnamed");
>
|
|
From: Matthias S. <zz...@ge...> - 2015-07-31 04:12:13
|
Am 30.07.2015 um 23:46 schrieb Florian Krohm:
> On 23.07.2015 19:36, Matthias Schwarzott wrote:
>> An additional comment to memcheck profiling.
>>
>> The counter values should be printed unsigned.
>
> How did you find this? There are *many* places in valgrind where an
> incorrect format is used to print unsigned values. It would be good to
> clean that up. But neither gcc nor clang is of any help here even though
> VG_(printf) has a printf-like attribute and we compile with -Wformat and
> what not...
Just as experiment I executed a small subset of the tests (around
2minutes) of an internal test-application (that originally has a
memcheck runtime of 4.5h).
Then I saw negative values being reported for these profiling counter
values.
In my case I am not even sure if there were wraparounds for some counters.
Regards
Matthias
>
> Florian
>
>> --- a/memcheck/mc_main.c
>> +++ b/memcheck/mc_main.c
>> @@ -6363,7 +6363,7 @@ static void done_prof_mem ( void )
>> }
>> if (MC_(event_ctr)[i] > 0) {
>> spaced = False;
>> - VG_(printf)( "prof mem event %3d: %9d %s\n",
>> + VG_(printf)( "prof mem event %3d: %9u %s\n",
>> i, MC_(event_ctr)[i],
>> MC_(event_ctr_name)[i]
>> ? MC_(event_ctr_name)[i] : "unnamed");
>>
>
>
|
|
From: Matthias S. <zz...@ge...> - 2015-07-31 04:26:32
|
Am 30.07.2015 um 23:46 schrieb Florian Krohm: > On 23.07.2015 19:36, Matthias Schwarzott wrote: >> An additional comment to memcheck profiling. >> >> The counter values should be printed unsigned. > > How did you find this? There are *many* places in valgrind where an > incorrect format is used to print unsigned values. It would be good to > clean that up. But neither gcc nor clang is of any help here even though > VG_(printf) has a printf-like attribute and we compile with -Wformat and > what not... > I googled for this and found this set of options for gcc: # -Wformat=2 # Enable -Wformat plus additional format checks. Currently equivalent to -Wformat -Wformat-nonliteral -Wformat-security -Wformat-y2k. # -Wformat-nonliteral # If -Wformat is specified, also warn if the format string is not a string literal and so cannot be checked, unless the format function takes its format arguments as a va_list. # -Wformat-security # If -Wformat is specified, also warn about uses of format functions that represent possible security problems. At present, this warns about calls to printf and scanf functions where the format string is not a string literal and there are no format arguments, as in printf (foo);. This may be a security hole if the format string came from untrusted input and contains ‘%n’. (This is currently a subset of what -Wformat-nonliteral warns about, but in future warnings may be added to -Wformat-security that are not included in -Wformat-nonliteral.) # -Wformat-signedness # If -Wformat is specified, also warn if the format string requires an unsigned argument and the argument is signed and vice versa. The option -Wformat-signedness should do what is needed here. Regards Matthias |
|
From: Florian K. <fl...@ei...> - 2015-07-31 07:36:09
|
On 31.07.2015 06:26, Matthias Schwarzott wrote: > Am 30.07.2015 um 23:46 schrieb Florian Krohm: >> On 23.07.2015 19:36, Matthias Schwarzott wrote: >>> An additional comment to memcheck profiling. >>> >>> The counter values should be printed unsigned. >> > Am 30.07.2015 um 23:46 schrieb Florian Krohm: >> How did you find this? There are *many* places in valgrind where an >> incorrect format is used to print unsigned values. rsa. > On 31.07.2015 06:26, Matthias Schwarzott wrote: > The option -Wformat-signedness should do what is needed here. > Yes, that option does the trick. Something like gcc 5.1 is needed. I use 4.8.4 be default so did not realise that option existed. Thanks for letting me know. Did I say *many* places? A build on x86-64 produces 5131 warnings. Good grief! Florian |
|
From: Florian K. <fl...@ei...> - 2015-07-31 13:53:05
|
On 31.07.2015 15:24, John Reiser wrote:
>> The option -Wformat-signedness should do what is needed here.
>
>> Did I say *many* places? A build on x86-64 produces 5131 warnings.
>> Good grief!
>
> About as many as running memcheck for the first time on a program of similar size ;-)
:)
To valgrind's rescue I should say that this was a build with primary and
secondary platform. So the actual number is about half. Which is, like,
nothing :)
I couldn't resist and looked at a few of those warnings. Nice stuff:
unsigned char c;
...
printf("%u\n", c);
No warning here. Good !
I did not stress-test the range-analysis but we do something like the
above quite a bit in the insn decoders.
Florian
|
|
From: Julian S. <js...@ac...> - 2015-07-31 13:59:43
|
> I did not stress-test the range-analysis but we do something like the > above quite a bit in the insn decoders. If the DIP macros contain some kind of error then we are going to get a zillion complaints from gcc, as you observe, since there's essentially one DIP usage per instruction-decoding clause. J |