[PATCH 2/2] gdb: fall back on sigpending + sigwait if sigtimedwait is not available
Simon Marchi
simon.marchi@polymtl.ca
Mon Jul 5 13:57:09 GMT 2021
On 2021-07-05 9:03 a.m., Pedro Alves wrote:
> On 2021-06-27 8:13 p.m., Simon Marchi via Gdb-patches wrote:
>> The macOS platform does not provide sigtimedwait, so we get:
>>
>> CXX compile/compile.o
>> In file included from /Users/smarchi/src/binutils-gdb/gdb/compile/compile.c:46:
>> /Users/smarchi/src/binutils-gdb/gdb/../gdbsupport/scoped_ignore_signal.h:69:4: error: use of undeclared identifier 'sigtimedwait'
>> sigtimedwait (&set, nullptr, &zero_timeout);
>> ^
>>
>> An alternative to sigtimedwait with a timeout of 0 is to use sigpending,
>> to first check which signals are pending, and then sigwait, to consume
>> them. Since that's slightly more expensive (2 syscalls instead of 1),
>> keep using sigtimedwait for the platforms that provide it, and fall back
>> to sigpending + sigwait for the others.
>>
>> gdbsupport/ChangeLog:
>>
>> * scoped_ignore_signal.h (struct scoped_ignore_signal)
>> <~scoped_ignore_signal>: Use sigtimedwait if HAVE_SIGTIMEDWAIT
>> is defined, else use sigpending + sigwait.
>
> OK. Thanks for doing this.
Thanks, pushed to master and to gdb-11-branch (with ChangeLog entries).
Simon
More information about the Gdb-patches
mailing list