[Ltrace-devel] Compilation error with dwarf code

Petr Machata pmachata at redhat.com
Thu May 15 10:13:11 UTC 2014


"Thierry Fauck ( thierry @ linux.vnet.ibm.com )"
<thierry at linux.vnet.ibm.com> writes:

> On 05/14/14 13:45, Thierry Fauck ( thierry @ linux.vnet.ibm.com ) wrote:
>> and as source is :     atomic_add(&a, 5);
>>     atomic_add(&a, 10);
>>     atomic_add(&a, 15);
>>     return a;
>>
>> why do we expect : a different prototype
>>
>> like atomic_add(.*, 5,.*) as result.
>>
>> So it sounds you have fixed issues in your recent code and for me the test must be corrected ?
>> Peter, what do you think ?

I think what might be happening is that the test case was built with -g
and ltrace gets the correct prototype from Dwarf.  Previously this
wouldn't be the case and ltrace would use the default prototype of
long(long, long, long, long).  ",.*" would then skip over the remaining
two arguments.

> So definitely patch sounds good to me - can you check on other platforms ?

This is only ever run on Power PC's.

> diff --git a/testsuite/ltrace.torture/ppc-lwarx.exp
> b/testsuite/ltrace.torture/p
> index bc2eba4..ec0b4de 100644
> --- a/testsuite/ltrace.torture/ppc-lwarx.exp
> +++ b/testsuite/ltrace.torture/ppc-lwarx.exp
> @@ -46,10 +46,10 @@ if { [istarget powerpc*-*] } then {
>             return
>      }
>  
> -    set pattern "atomic_add(.*, 5,.*)"
> +    set pattern "atomic_add(.*, 5)"
>      ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
> -    set pattern "atomic_add(.*, 10,.*)"
> +    set pattern "atomic_add(.*, 10)"
>      ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
> -    set pattern "atomic_add(.*, 15,.*)"
> +    set pattern "atomic_add(.*, 15)"
>      ltrace_verify_output ${objdir}/${subdir}/${testfile}.ltrace $pattern 1
>  }

Unfortunately we can't do that, the libdw backend may not be compiled
in, and then we will see the default prototype.  I'm somewhat suprised
we don't see this more often.

So, the easiest way to fix this is probably to do something like:

> -    set pattern "atomic_add(.*, 15,.*)"
> +    set pattern "atomic_add(.*, 15\\b.*"

but I haven't tested this (I'm especially unsure about the amount of
escaping that I should apply).  The idea is that \b matches on edges of
words, and we don't care about the rest, whether it's followed by a
comma and more arguments, or directly by a closing paren.

Thierry, could you please verify that the above works as expected?

Thank you,
PM



More information about the Ltrace-devel mailing list