[Lldb-commits] [PATCH] D158017: [lldb][NFCI] Rewrite error-handling code in ProcessGDBRemote::MonitorDebugserverProcess
Alex Langford via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Thu Aug 17 10:32:47 PDT 2023
This revision was automatically updated to reflect the committed changes.
Closed by commit rG90c5675a3db2: [lldb][NFCI] Rewrite error-handling code in ProcessGDBRemote… (authored by bulbazord).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D158017/new/
https://reviews.llvm.org/D158017
Files:
lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
Index: lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
===================================================================
--- lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -3379,23 +3379,20 @@
if (state != eStateInvalid && state != eStateUnloaded &&
state != eStateExited && state != eStateDetached) {
- char error_str[1024];
- if (signo) {
- const char *signal_cstr =
+ StreamString stream;
+ if (signo == 0)
+ stream.Format(DEBUGSERVER_BASENAME " died with an exit status of {0:x8}",
+ exit_status);
+ else {
+ const char *signal_name =
process_sp->GetUnixSignals()->GetSignalAsCString(signo);
- if (signal_cstr)
- ::snprintf(error_str, sizeof(error_str),
- DEBUGSERVER_BASENAME " died with signal %s", signal_cstr);
+ const char *format_str = DEBUGSERVER_BASENAME " died with signal {0}";
+ if (signal_name)
+ stream.Format(format_str, signal_name);
else
- ::snprintf(error_str, sizeof(error_str),
- DEBUGSERVER_BASENAME " died with signal %i", signo);
- } else {
- ::snprintf(error_str, sizeof(error_str),
- DEBUGSERVER_BASENAME " died with an exit status of 0x%8.8x",
- exit_status);
+ stream.Format(format_str, signo);
}
-
- process_sp->SetExitStatus(-1, error_str);
+ process_sp->SetExitStatus(-1, stream.GetString());
}
// Debugserver has exited we need to let our ProcessGDBRemote know that it no
// longer has a debugserver instance
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D158017.551185.patch
Type: text/x-patch
Size: 1655 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20230817/806b0b9f/attachment.bin>
More information about the lldb-commits
mailing list