Re: [PATCH] testsuite: asm-source.exp: use 'sys_exit' on powerpc.inc

Edjunior Barbosa Machado
2010-11-25T13:56:30Z

On 11/25/2010 09:23 AM, Mark Kettenis wrote:
>> From: Edjunior Barbosa Machado<emachado@linux.vnet.ibm.com>
>> Date: Tue, 23 Nov 2010 16:45:39 -0200
>>
>> With this patch, ppc32 uses 'sys_exit' sequence on gdbasm_exit0 macro.
>
> Isn't this somewhat OS-dependent? It'll work on OpenBSD since the
> exit system call is indeed #1 there, but there is no guarantee that's
> true on all OSes isn't it?

Good point, you might be right, unfortunately I didn't have the chance to test it against other OSes than linux.

>
> And doesn't this pass random garbage as the argument to the exit system call?

Right, I think we could add 'li 3,0' before calling 'sc', but I'm not sure if this is a problem since we're not checking the exit code on the testcase.

Thanks,
--
Edjunior
>
>> gdb/testsuite/
>> 2010-11-23 Edjunior Machado<emachado@br.ibm.com>
>>
>> * powerpc.inc: Use 'sys_exit' on gdbasm_exit0 macro.
>>
>> diff --git a/gdb/testsuite/gdb.asm/powerpc.inc b/gdb/testsuite/gdb.asm/powerpc.inc
>> index a0797bf..ab700c2 100644
>> --- a/gdb/testsuite/gdb.asm/powerpc.inc
>> +++ b/gdb/testsuite/gdb.asm/powerpc.inc
>> @@ -29,9 +29,9 @@
>>
>> comment "exit (0)"
>> .macro gdbasm_exit0
>> - comment "Don't know how to exit, but this will certainly halt..."
>> - li 0, 0
>> - lwz 0, 0(0)
>> + comment "sys_exit"
>> + li 0, 1
>> + sc
>> .endm
>>
>> comment "crt0 startup"
>> --
>> 1.7.1
>>
>>
>