base: Check the context ID when replacing a ThreadContext in GDB.

This says *which* thread context you're replacing. Right now it's
implied that you're replacing the only thread context, but once we
support having multiple threads in the same GDB endpoint, that will no
longer be implied.

Change-Id: I5a789d12bbe195e019d5ccd8a005b5a6f16b9299
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/44610
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br>
This commit is contained in:
Gabe Black
2021-04-12 06:30:52 -07:00
parent 14f2a031c6
commit d7d549408f
2 changed files with 10 additions and 1 deletions

View File

@@ -141,6 +141,7 @@
#include "base/cprintf.hh"
#include "base/intmath.hh"
#include "base/logging.hh"
#include "base/socket.hh"
#include "base/trace.hh"
#include "cpu/base.hh"
@@ -436,6 +437,14 @@ BaseRemoteGDB::detach()
DPRINTFN("remote gdb detached\n");
}
void
BaseRemoteGDB::replaceThreadContext(ThreadContext *_tc)
{
ContextID id = _tc->contextId();
panic_if(id != tc->contextId(), "No context with ID %d found.", id);
tc = _tc;
}
// This function does all command processing for interfacing to a
// remote gdb. Note that the error codes are ignored by gdb at
// present, but might eventually become meaningful. (XXX) It might

View File

@@ -163,7 +163,7 @@ class BaseRemoteGDB
void detach();
bool isAttached() { return attached; }
void replaceThreadContext(ThreadContext *_tc) { tc = _tc; }
void replaceThreadContext(ThreadContext *_tc);
bool trap(int type);