[Ltrace-devel] nested library calls and right-hand params

Petr Machata pmachata at redhat.com
Tue Nov 9 13:15:04 UTC 2010


09.11.2010 03:27, Joe Damato wrote:
> On Mon, Nov 8, 2010 at 5:18 PM, Petr Machata<pmachata at redhat.com>  wrote:
>> 09.11.2010 01:08, Joe Damato wrote:
>>>
>>> On Wed, Nov 3, 2010 at 11:00 AM, Petr Machata<pmachata at redhat.com>    wrote:
>>>>
>>>> 02.11.2010 17:49, Petr Machata wrote:
>>>>>
>>>>> The problem
>>>>> here is that the register set is preserved in struct Process, not in
>>>>> struct callstack_element, and so is overwritten when nested call appears
>>>>> which has right-hand parameters too.
>>>>
>>>> This is now fixed here:
>>>>   https://github.com/pmachata/ltrace/tree/nested
>>>>
>>>> That branch forks off this branch:
>>>>   https://github.com/pmachata/ltrace/tree/float
>>>> which fixes a problem with passing doubles in arguments and return values
>>>> on
>>>> x86_64, and simplifies the whole argument-preserving scenario a bit.
>>>>
>>>> Both add test cases for bugs that they fix.
>>>
>>> I tried these changes on an x86 ubuntu VM and two tests failed:
>>>
>>> FAIL: func_double(3.40*, -3.40*).*= -3.40* in
>>> /home/joe/code/ltrace/testsuite/ltrace.main/parameters.ltrace for 0
>>> times ,should be 1
>>> FAIL:<... func_call resumed>    \"x\", \"y\") in
>>> /home/joe/code/ltrace/testsuite/ltrace.main/parameters.ltrace for 0
>>> times ,should be 1
>>
>> Hmm, these are the new tests.
>>
>>> The .ltrace output is below.
>>> func_double(0.000000, 0.000000)                  = 0.000000
>>
>>> func_call(<unfinished ...>
>>> func_work("x")                                   =<void>
>>> <... func_call resumed>    "y", "Z\213\014$\211\004$\213D$\004\302\014")
>>> =<void>
>>> +++ exited (status 0) +++
>>
>> Yep, it's broken.  The question is why :)  That's how it looked before I
>> fixed it, are you sure that you rebuilt ltrace?
>
> I just did a make clean and a make and reran make check. git log shows
> your patches in the tree I am building.
>
>> If yes, can you send me the
>> binaries?  That is the files "parameters" and "libparameters.so" from
>> testsuite/ltrace.main.  I'll need to look inside.

Ah, right, x86, that's not supposed to work.  On x86_64 yes, on x86 
that's still broken, because on x86, double doesn't fit into long.

Higher up above the "nested" branch, there are patches that change the 
return value of gimme_arg to union { long, double }.  That's here to fix 
the problem that you are seeing with the double test.

I've made a new branch called "x86" out of this.  (As you can see, I've 
entirely given up any semblance of independence of branches at this 
point.  I could just convert all the branches to tags.)  That contains 
all the fixes for double arguments for x86, x86_64, and x86-on-x86_64, 
while still avoiding the alignof and sizeof changes.

The problem with nested call is unfixed on x86 as of yet.  The fact that 
the test suite is failing shouldn't really be an obstacle of release, 
the problem has always been there, it's just that now we have tests for 
it and it's fixed on some arches.

PM



More information about the Ltrace-devel mailing list