diff options
author | Spencer Low <CompareAndSwap@gmail.com> | 2018-08-25 23:34:33 -0700 |
---|---|---|
committer | Spencer Low <CompareAndSwap@gmail.com> | 2018-08-25 23:46:48 -0700 |
commit | 84fc27159a60e439f391e439c923cdf393f522f6 (patch) | |
tree | 80a3a4df121ca895d7d3aa0d16d6c2240f004339 /debuggerd/handler/debuggerd_handler.cpp | |
parent | 6d2ace3684a06ea81d853657cbc6f5f0682667bc (diff) |
adb: win32: fix Ctrl-C of adb server nodaemon
On Windows, when running adb server nodaemon and pressing Ctrl-C,
adb_server_cleanup (an atexit handler) would call kick_all_transports()
which would eventually fail a CHECK because the current thread was not
equal to the main thread. This is because Ctrl-C is implemented in
Windows by the OS creating a new thread in the process and calling the
Ctrl-C handler from there.
The CHECK fail would print out the CHECK expression and call abort()
which would record a crash in the Windows Event Log, plus would
potentially upload a crashdump to Microsoft's Watson service.
This might be a regression from d51c6df1ef98f2b57916ddefc80afda5f1eecb59.
The fix is to share more code between platforms, removing the call to
Win32 SetConsoleCtrlHandler() and just use the C Runtime's signal()
implementation which is built upon SetConsoleCtrlHandler(). The signal
handler still ends up being called from another thread, but the handler
is thread-safe enough so this seems to work.
Test: On Win10 and Vista, run adb server nodaemon and then try Ctrl-C,
Ctrl-Break and close console window.
Change-Id: I6603970616098d2b3ce68f2a3d4e5515ec859811
Signed-off-by: Spencer Low <CompareAndSwap@gmail.com>
Diffstat (limited to 'debuggerd/handler/debuggerd_handler.cpp')
0 files changed, 0 insertions, 0 deletions