Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: ATF tests hanging



On 27.12.2017 19:58, Martin Husemann wrote:
> On Wed, Dec 27, 2017 at 07:53:50PM +0100, Martin Husemann wrote:
>> I must be missing something, or the test works on alpha and x86 due to a
>> bug, but correctly fails on other architectures.
> 
> The same difference can be seen very simply by running the attached
> program under gdb:
> 
> (gdb) run
> Starting program: /tmp/a.out 
> hello, before break
> 
> Program received signal SIGTRAP, Trace/breakpoint trap.
> 0x000000000040087f in main ()
> (gdb) c
> Continuing.
> and after...
> [Inferior 1 (process 3001) exited normally]
> 
> 
> But on sparc* instead you see it hit the same breakpoint instruction
> again after continuing. The interpretation of (void*)1 for new %pc
> value must be different.
> 
> From our man page, I'd claim x86 is wrong and sparc* is right.
> 
> Martin
> 

This test verifies that blocked SIGTRAP in a child does not mute crash
signals - in this particular case SIGTRAP and TRAP_BRKPT. This is a
mandatory behavior expected from the kernel.

The breakpoint behavior is MD specific. On x86 we execute the
instruction first and next report it in case of software breakpoint
(int3). On sparc we need to manually ADVANCE the Instruction Pointer.

We have a dedicated macro for this in src/sys/arch/sparc/sparc/trap.c

    236 	/* This steps the PC over the trap. */
    237 #define	ADVANCE (n = tf->tf_npc, tf->tf_pc = n, tf->tf_npc = n + 4)

We call it for many kinds of traps.

I cannot confirm now whether we should adjust it for the x86 behavior or
not, I would need to check it with existing debuggers, developers and
kernels for sparc to make sure.

This is on my TODO list in my plans in ptrace(2) fixes.

In the worst case, we will need to add sparc specific handling and
implement ADVANCE directly in the test.

Attachment: signature.asc
Description: OpenPGP digital signature



Home | Main Index | Thread Index | Old Index