Using GNU extension

Masatake YAMATO yamato at
Fri Mar 2 11:28:52 UTC 2018

On Fri, 2 Mar 2018 13:58:52 +0300, "Dmitry V. Levin" <ldv at> wrote:
> Hi,
> On Fri, Mar 02, 2018 at 02:26:46PM +0900, Masatake YAMATO wrote:
>> I found following lines in
>>     /* Enable GNU extensions on systems that have them.  */
>>     #ifndef _GNU_SOURCE
>>     # undef _GNU_SOURCE
>>     #endif
> I think this is result of AC_USE_SYSTEM_EXTENSIONS.
>> Do they mean I can use GNU extension in my patch?
> It depends.  I suppose we might be using already some GNU extensions
> that are portable enough.
> I think it's important to keep strace working on systems still in use.
>> I would like to use optional option arugment(::) in getopt.
> I think it's too ugly to use, but do you have any particular use case
> for strace where it could be more convenient that portable alternatives?

I'm working on code adding libdw as unwinder (-k option that I like).
I'm thinking to utilize libunwind or libdw NON-exclusive way; a
user can choose one of unwinders at runtime (if the both libraries
are available at build-time and run-time.)

Following notation is what I'm imaging now:

-k                (default, choose one automatically)
-klibunwind       (use libunwind as unwinder (if available))
-klibdw           (use libdw as unwinder (if available))

:: in GNU extensions helps me to implement above very easily.

Masatake YAMATO

> -- 
> ldv

More information about the Strace-devel mailing list