[lldb] Improve assert in GDBRemoteCommunicationReplayServer
While investigating an issue where a different packet was sent during replay I noticed how annoying it is that the existing assert doesn't specify what packet is actually different. It's printed to the log, but enabling logging has the potential to change LLDB's behavior. The same is true when debugging LLDB while it's replaying the reproducer. I replaced the assert with a printf of the unexpected packet followed by a fatal_error wrapped in ifndef NDEBUG. The behavior is the same as the previous assert, just with more/better context.
This commit is contained in:
parent
96119586c9
commit
c62a9f180c
|
@ -143,7 +143,14 @@ GDBRemoteCommunicationReplayServer::GetPacketAndSendResponse(
|
|||
entry.packet.data);
|
||||
LLDB_LOG(log, "GDBRemoteCommunicationReplayServer actual packet: '{0}'",
|
||||
packet.GetStringRef());
|
||||
assert(false && "Encountered unexpected packet during replay");
|
||||
#ifndef NDEBUG
|
||||
// This behaves like a regular assert, but prints the expected and
|
||||
// received packet before aborting.
|
||||
printf("Reproducer expected packet: '%s'\n", entry.packet.data.c_str());
|
||||
printf("Reproducer received packet: '%s'\n",
|
||||
packet.GetStringRef().data());
|
||||
llvm::report_fatal_error("Encountered unexpected packet during replay");
|
||||
#endif
|
||||
return PacketResult::ErrorSendFailed;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue