[committed v5] libstdc++: Implement C++26 <debugging> features [PR119670]

Iain Sandoe idsandoe@googlemail.com
Fri Aug 29 18:45:22 GMT 2025



> On 29 Aug 2025, at 15:55, Jonathan Wakely <jwakely@redhat.com> wrote:
> 
> On Fri, 29 Aug 2025 at 15:19, Rainer Orth <ro@cebitec.uni-bielefeld.de> 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:
>> 
>> it also broke bootstrap on macOS 11, 10.11:
> 
> I'll test a patch for both issues.

r16-3446 bootstrapped OK on x86_64  macOS12, but adding the header will be harmless there (my weekly tests across a wider range of OS versions will pick up whatever is committed before end of Sat).

----

I will look into implementing the is_debugger_present () as per the Apple Developer suggested mechanism (and also consider the mechanism you’ve documented for Linux).

thanks
Iain


>> In file included from /vol/gcc/src/hg/master/darwin/libstdc++-v3/src/c++26/debugging.cc:36:
>> /Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk/usr/include/sys/ptrace.h:99:42: error: 'caddr_t' has not been declared
>>   99 | int     ptrace(int _request, pid_t _pid, caddr_t _addr, int _data);
>>      |                                          ^~~
>> 
>> caddr_t is defined in <sys/types.h>, and ptrace(2) documents
>> 
>> SYNOPSIS
>>     #include <sys/types.h>
>>     #include <sys/ptrace.h>
>> 
>>     int
>>     ptrace(int request, pid_t pid, caddr_t addr, int data);
>> 
>>        Rainer
>> 
>> --
>> -----------------------------------------------------------------------------
>> Rainer Orth, Center for Biotechnology, Bielefeld University
>> 
> 



More information about the Libstdc++ mailing list