This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC/PATCH] New convenience variable $_exitsignal


>>>>> "Sergio" == Sergio Durigan Junior <sergiodj@redhat.com> writes:

Sergio> To the extent of my knowledge, this is a shell feature.  It sets $? (the
Sergio> variable which contains the exit code of the program) to 128 + signal
Sergio> number.

No, it's actually how things work under the hood.
When you call 'wait' (or one of its many equivalent APIs), the result
you get is an integer that encodes whether the program exited normally
or via signal; if normally, the exit code; or if via signal, which signal.

This touches on Doug's question of how to use these variables
generically.  There's no nice way for a script to use this right now,
partly because gdb's scripting is so limited, but also because the two
values are put into two separate variables.

Just having a variable that is "the exit status as the OS reports it"
seems nice, but then it means reimplementing WIFEXITED and friends.  Not
perhaps the friendliest.

Tom


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]