From 48bd656b6dd172cd03b7d0e789b936acf333d190 Mon Sep 17 00:00:00 2001 From: Nav Date: Wed, 28 Aug 2024 19:24:41 +0100 Subject: [PATCH] Handle bad conversion in `wr` GDB monitor command handler --- .../Gdb/CommandPackets/WriteRegisterMonitor.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/DebugServer/Gdb/CommandPackets/WriteRegisterMonitor.cpp b/src/DebugServer/Gdb/CommandPackets/WriteRegisterMonitor.cpp index 8476903a..41fda760 100644 --- a/src/DebugServer/Gdb/CommandPackets/WriteRegisterMonitor.cpp +++ b/src/DebugServer/Gdb/CommandPackets/WriteRegisterMonitor.cpp @@ -131,6 +131,16 @@ namespace DebugServer::Gdb::CommandPackets debugSession.connection.writePacket(ResponsePacket{StringService::toHex("Register written\n")}); + } catch (const std::invalid_argument& exception) { + debugSession.connection.writePacket(ResponsePacket{ + StringService::toHex( + StringService::applyTerminalColor( + "Error: Invalid register value given\n", + StringService::TerminalColor::DARK_RED + ) + ) + }); + } catch (const Exception& exception) { debugSession.connection.writePacket(ResponsePacket{ StringService::toHex(