> On 29 Aug 2025, at 15:12, Rainer Orth <[email protected]> wrote:
> 
> Hi Jonathan,
> 
>> The src/c++26/debugging.cc file defines a global volatile int which can
>> be set by debuggers to indicate when they are attached and detached from
>> a running process. This allows std::is_debugger_present() to give a
>> reliable answer, and additionally allows a debugger to choose how
>> std::breakpoint() should behave. Setting the global to a positive value
>> will cause std::breakpoint() to use that value as an argument to
>> std::raise, so debuggers that prefer SIGABRT for breakpoints can select
>> that. By default std::breakpoint() will use a platform-specific action
>> such as the INT3 instruction on x86, or GCC's __builtin_trap().
> 
> this patch broke Solaris/x86 bootstrap with /bin/as:
> 
> Assembler: debugging.cc
>        "libstdc++-v3/src/c++26/debugging.cc", line 141 : Illegal mnemonic
>        Near line: "    int3"
>        "libstdc++-v3/src/c++26/debugging.cc", line 141 : Syntax error
>        Near line: "    int3"
> 
> I found that both int $0x3 and .byte 0xcc work instead and are also
> understood by gas, dis and objdump confirming that they produce the same
> results.

I wonder if the long-term maintenance of this feature would be made easier
(and a small amount of impl. divergence removed) by adding a
` __builtin_debugtrap()` to GCC lowered on a target hook, with a fallback to 
`__builtin_trap()` ?

Iain

Reply via email to