[debugserver] Fix that debugserver's stop reply packets always return signal code 0
authorRaphael Isemann <teemperor@gmail.com>
Thu, 3 Sep 2020 07:17:03 +0000 (09:17 +0200)
committerRaphael Isemann <teemperor@gmail.com>
Thu, 3 Sep 2020 07:47:03 +0000 (09:47 +0200)
commitf0699d9109143754088c26604c58f5ab3e9d4678
tree519d5410bb955f8abbc69c8c6049a5d6384adbf6
parent2878ecc90f1f22cf0b96c04a4124122db008a2a9
[debugserver] Fix that debugserver's stop reply packets always return signal code 0

If our process terminates due to an unhandled signal, we are supposed to get the
signal code via WTERMSIG. However, we instead try to get the exit status via
WEXITSTATUS which just ends up always calculating signal code 0 (at least on the
macOS implementation where it just shifts the signal code bits away and we're
left with only 0 bits).

The exit status calculation on the LLDB side also seems a bit off as it claims
an exit status that is just the signal code (instead of for example 128 + signal
code), but that will be another patch.

Reviewed By: jasonmolenda

Differential Revision: https://reviews.llvm.org/D86336
lldb/test/Shell/Process/Inputs/abort.c [new file with mode: 0644]
lldb/test/Shell/Process/TestAbortExitCode.test [new file with mode: 0644]
lldb/tools/debugserver/source/RNBRemote.cpp