> On Sep 25, 2025, at 12:34 AM, Xi Ruoyao <[email protected]> wrote:
> 
> On Thu, 2025-09-25 at 11:17 +0800, Huacai Chen wrote:
>> Hi, Ruoyao,
>> 
>> On Tue, Sep 23, 2025 at 8:34 PM Xi Ruoyao <[email protected]> wrote:
>>> 
>>> In some applications (notably the Linux kernel), "break 0" is used as a
>>> trap that a handler may be able to recover.  But in GCC the "trap"
>>> pattern is meant to make the program rightfully die instead.
>>> 
>>> As [1] describes, sometimes it's vital to distinguish between the two
>>> cases.
>>> 
>>> Use the "documented illegal instruction" amswap.w $r0,$r1,$r0 for "trap"
>>> instead.  This also aligns the behavior with x86_64 GCC and LoongArch
>>> clang.
>> Can we use "break 1" instead?
> 
> AFAIK the break codes are allocated nowhere except in a Linux header so
> I don't want to use it in compiler which may target some different
> operating system.

Ideally the ABI would define this, but I don't know how many do.  VAX/VMS comes 
to mind as one that does (via the "BUGx" opcode).

        paul

Reply via email to