|
From: Maynard J. <may...@us...> - 2010-01-11 22:10:56
Attachments:
vg-clear-caller-saved-regs.patch
|
The attached patch addresses a problem that I reported to this list on Jan 4. Julian suggested the fix, so my patch integrates his suggestion into the failing testcases' source files. Problem description: Upon a call to a function, some architectures store pointers into into registers. Valgrind may consider these registers when determining whether an address is reachable, so we need to zero-out these registers as needed. This patch addresses the problem only for PowerPC, but the implementation for other architectures can be easily added when necessary. Thanks. -Maynard |
|
From: Maynard J. <may...@us...> - 2010-01-20 19:50:04
|
Maynard Johnson wrote:
> The attached patch addresses a problem that I reported to this list on
> Jan 4. Julian suggested the fix, so my patch integrates his suggestion
> into the failing testcases' source files.
>
> Problem description: Upon a call to a function, some architectures
> store pointers into into registers. Valgrind may consider these
> registers when determining whether an address is reachable, so we need
> to zero-out these registers as needed. This patch addresses the problem
> only for PowerPC, but the implementation for other architectures can be
> easily added when necessary.
Julian, any comments on this patch?
Thanks.
-Maynard
_______________________________________________________________
> diff -paur valgrind-3.5.0/memcheck/tests/leak-cases.c valg-350-fix/memcheck/tests/leak-cases.c
> --- valgrind-3.5.0/memcheck/tests/leak-cases.c 2009-08-19 08:37:00.000000000 -0500
> +++ valg-350-fix/memcheck/tests/leak-cases.c 2010-01-11 15:53:43.000000000 -0600
> @@ -106,6 +106,7 @@ int main(void)
> // counting in main() avoids the problem.
> f();
>
> + clear_caller_saved_regs();
> GET_FINAL_LEAK_COUNTS;
>
> PRINT_LEAK_COUNTS(stderr);
> diff -paur valgrind-3.5.0/memcheck/tests/leak-cycle.c valg-350-fix/memcheck/tests/leak-cycle.c
> --- valgrind-3.5.0/memcheck/tests/leak-cycle.c 2009-08-19 08:37:00.000000000 -0500
> +++ valg-350-fix/memcheck/tests/leak-cycle.c 2010-01-11 15:51:52.000000000 -0600
> @@ -68,6 +68,8 @@ int main()
>
> c1 = c2 = 0;
>
> + clear_caller_saved_regs();
> +
> GET_FINAL_LEAK_COUNTS;
>
> PRINT_LEAK_COUNTS(stderr);
> diff -paur valgrind-3.5.0/memcheck/tests/leak.h valg-350-fix/memcheck/tests/leak.h
> --- valgrind-3.5.0/memcheck/tests/leak.h 2009-08-19 08:36:59.000000000 -0500
> +++ valg-350-fix/memcheck/tests/leak.h 2010-01-11 15:51:32.000000000 -0600
> @@ -41,3 +41,30 @@
> S_bytes,S_blocks); \
> } while (0)
>
> +/* Upon a call to a function, some architectures store pointers into
> + * into registers. Valgrind may consider these registers when determining
> + * whether an address is reachable, so we need to zero-out these registers
> + * as needed.
> + */
> +
> +#if defined __powerpc__
> +void inline clear_caller_saved_regs(void)
> +{
> + __asm__ __volatile__( "li 3, 0" : : :/*trash*/"r3" );
> + __asm__ __volatile__( "li 4, 0" : : :/*trash*/"r4" );
> + __asm__ __volatile__( "li 5, 0" : : :/*trash*/"r5" );
> + __asm__ __volatile__( "li 6, 0" : : :/*trash*/"r6" );
> + __asm__ __volatile__( "li 7, 0" : : :/*trash*/"r7" );
> + __asm__ __volatile__( "li 8, 0" : : :/*trash*/"r8" );
> + __asm__ __volatile__( "li 9, 0" : : :/*trash*/"r9" );
> + __asm__ __volatile__( "li 10, 0" : : :/*trash*/"r10" );
> + __asm__ __volatile__( "li 11, 0" : : :/*trash*/"r11" );
> + __asm__ __volatile__( "li 12, 0" : : :/*trash*/"r12" );
> +}
> +#else
> +void inline clear_caller_saved_regs(void)
> +{
> +}
> +#endif
> +
> +
>
>
|
|
From: Maynard J. <may...@us...> - 2010-08-12 15:20:24
|
On 01/20/2010 1:49 PM, Maynard Johnson wrote:
> Maynard Johnson wrote:
>> The attached patch addresses a problem that I reported to this list on Jan 4.
>> Julian suggested the fix, so my patch integrates his suggestion into the
>> failing testcases' source files.
>>
>> Problem description: Upon a call to a function, some architectures store
>> pointers into into registers. Valgrind may consider these registers when
>> determining whether an address is reachable, so we need to zero-out these
>> registers as needed. This patch addresses the problem only for PowerPC, but
>> the implementation for other architectures can be easily added when necessary.
>
> Julian, any comments on this patch?
Julian,
Since this patch submission seems to have fallen through the cracks, would you
like me to open a bug report for this?
-Maynard
>
> Thanks.
> -Maynard
> _______________________________________________________________
>
>> diff -paur valgrind-3.5.0/memcheck/tests/leak-cases.c
>> valg-350-fix/memcheck/tests/leak-cases.c
>> --- valgrind-3.5.0/memcheck/tests/leak-cases.c 2009-08-19 08:37:00.000000000
>> -0500
>> +++ valg-350-fix/memcheck/tests/leak-cases.c 2010-01-11 15:53:43.000000000 -0600
>> @@ -106,6 +106,7 @@ int main(void)
>> // counting in main() avoids the problem.
>> f();
>>
>> + clear_caller_saved_regs();
>> GET_FINAL_LEAK_COUNTS;
>>
>> PRINT_LEAK_COUNTS(stderr);
>> diff -paur valgrind-3.5.0/memcheck/tests/leak-cycle.c
>> valg-350-fix/memcheck/tests/leak-cycle.c
>> --- valgrind-3.5.0/memcheck/tests/leak-cycle.c 2009-08-19 08:37:00.000000000
>> -0500
>> +++ valg-350-fix/memcheck/tests/leak-cycle.c 2010-01-11 15:51:52.000000000 -0600
>> @@ -68,6 +68,8 @@ int main()
>>
>> c1 = c2 = 0;
>>
>> + clear_caller_saved_regs();
>> +
>> GET_FINAL_LEAK_COUNTS;
>>
>> PRINT_LEAK_COUNTS(stderr);
>> diff -paur valgrind-3.5.0/memcheck/tests/leak.h
>> valg-350-fix/memcheck/tests/leak.h
>> --- valgrind-3.5.0/memcheck/tests/leak.h 2009-08-19 08:36:59.000000000 -0500
>> +++ valg-350-fix/memcheck/tests/leak.h 2010-01-11 15:51:32.000000000 -0600
>> @@ -41,3 +41,30 @@
>> S_bytes,S_blocks); \
>> } while (0)
>>
>> +/* Upon a call to a function, some architectures store pointers into
>> + * into registers. Valgrind may consider these registers when determining
>> + * whether an address is reachable, so we need to zero-out these registers
>> + * as needed.
>> + */
>> +
>> +#if defined __powerpc__
>> +void inline clear_caller_saved_regs(void)
>> +{
>> + __asm__ __volatile__( "li 3, 0" : : :/*trash*/"r3" );
>> + __asm__ __volatile__( "li 4, 0" : : :/*trash*/"r4" );
>> + __asm__ __volatile__( "li 5, 0" : : :/*trash*/"r5" );
>> + __asm__ __volatile__( "li 6, 0" : : :/*trash*/"r6" );
>> + __asm__ __volatile__( "li 7, 0" : : :/*trash*/"r7" );
>> + __asm__ __volatile__( "li 8, 0" : : :/*trash*/"r8" );
>> + __asm__ __volatile__( "li 9, 0" : : :/*trash*/"r9" );
>> + __asm__ __volatile__( "li 10, 0" : : :/*trash*/"r10" );
>> + __asm__ __volatile__( "li 11, 0" : : :/*trash*/"r11" );
>> + __asm__ __volatile__( "li 12, 0" : : :/*trash*/"r12" );
>> +}
>> +#else
>> +void inline clear_caller_saved_regs(void)
>> +{
>> +}
>> +#endif
>> +
>> +
>>
>>
>
|
|
From: Julian S. <js...@ac...> - 2010-08-12 15:54:05
|
On Thursday, August 12, 2010, Maynard Johnson wrote:
> On 01/20/2010 1:49 PM, Maynard Johnson wrote:
> > Maynard Johnson wrote:
> >> The attached patch addresses a problem that I reported to this list on
> >> Jan 4. Julian suggested the fix, so my patch integrates his suggestion
> >> into the failing testcases' source files.
> >>
> >> Problem description: Upon a call to a function, some architectures store
> >> pointers into into registers. Valgrind may consider these registers when
> >> determining whether an address is reachable, so we need to zero-out
> >> these registers as needed. This patch addresses the problem only for
> >> PowerPC, but the implementation for other architectures can be easily
> >> added when necessary.
> >
> > Julian, any comments on this patch?
>
> Julian,
> Since this patch submission seems to have fallen through the cracks, would
> you like me to open a bug report for this?
Yes. Please do.
J
>
> -Maynard
>
> > Thanks.
> > -Maynard
> > _______________________________________________________________
> >
> >> diff -paur valgrind-3.5.0/memcheck/tests/leak-cases.c
> >> valg-350-fix/memcheck/tests/leak-cases.c
> >> --- valgrind-3.5.0/memcheck/tests/leak-cases.c 2009-08-19
> >> 08:37:00.000000000 -0500
> >> +++ valg-350-fix/memcheck/tests/leak-cases.c 2010-01-11
> >> 15:53:43.000000000 -0600 @@ -106,6 +106,7 @@ int main(void)
> >> // counting in main() avoids the problem.
> >> f();
> >>
> >> + clear_caller_saved_regs();
> >> GET_FINAL_LEAK_COUNTS;
> >>
> >> PRINT_LEAK_COUNTS(stderr);
> >> diff -paur valgrind-3.5.0/memcheck/tests/leak-cycle.c
> >> valg-350-fix/memcheck/tests/leak-cycle.c
> >> --- valgrind-3.5.0/memcheck/tests/leak-cycle.c 2009-08-19
> >> 08:37:00.000000000 -0500
> >> +++ valg-350-fix/memcheck/tests/leak-cycle.c 2010-01-11
> >> 15:51:52.000000000 -0600 @@ -68,6 +68,8 @@ int main()
> >>
> >> c1 = c2 = 0;
> >>
> >> + clear_caller_saved_regs();
> >> +
> >> GET_FINAL_LEAK_COUNTS;
> >>
> >> PRINT_LEAK_COUNTS(stderr);
> >> diff -paur valgrind-3.5.0/memcheck/tests/leak.h
> >> valg-350-fix/memcheck/tests/leak.h
> >> --- valgrind-3.5.0/memcheck/tests/leak.h 2009-08-19 08:36:59.000000000
> >> -0500 +++ valg-350-fix/memcheck/tests/leak.h 2010-01-11
> >> 15:51:32.000000000 -0600 @@ -41,3 +41,30 @@
> >> S_bytes,S_blocks); \
> >> } while (0)
> >>
> >> +/* Upon a call to a function, some architectures store pointers into
> >> + * into registers. Valgrind may consider these registers when
> >> determining + * whether an address is reachable, so we need to zero-out
> >> these registers + * as needed.
> >> + */
> >> +
> >> +#if defined __powerpc__
> >> +void inline clear_caller_saved_regs(void)
> >> +{
> >> + __asm__ __volatile__( "li 3, 0" : : :/*trash*/"r3" );
> >> + __asm__ __volatile__( "li 4, 0" : : :/*trash*/"r4" );
> >> + __asm__ __volatile__( "li 5, 0" : : :/*trash*/"r5" );
> >> + __asm__ __volatile__( "li 6, 0" : : :/*trash*/"r6" );
> >> + __asm__ __volatile__( "li 7, 0" : : :/*trash*/"r7" );
> >> + __asm__ __volatile__( "li 8, 0" : : :/*trash*/"r8" );
> >> + __asm__ __volatile__( "li 9, 0" : : :/*trash*/"r9" );
> >> + __asm__ __volatile__( "li 10, 0" : : :/*trash*/"r10" );
> >> + __asm__ __volatile__( "li 11, 0" : : :/*trash*/"r11" );
> >> + __asm__ __volatile__( "li 12, 0" : : :/*trash*/"r12" );
> >> +}
> >> +#else
> >> +void inline clear_caller_saved_regs(void)
> >> +{
> >> +}
> >> +#endif
> >> +
> >> +
>
> ---------------------------------------------------------------------------
> --- This SF.net email is sponsored by
>
> Make an app they can't live without
> Enter the BlackBerry Developer Challenge
> http://p.sf.net/sfu/RIM-dev2dev
> _______________________________________________
> Valgrind-developers mailing list
> Val...@li...
> https://lists.sourceforge.net/lists/listinfo/valgrind-developers
|