debug: gdbstub: remove start argument from z_gdb_main_loop()
Storing the state where this is the first GDB break can be done in the main GDB stub code. There is no need to store the state in architecture layer. Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This commit is contained in:
parent
6eaaaa9acc
commit
650a629b08
3 changed files with 11 additions and 7 deletions
|
@ -12,7 +12,6 @@
|
|||
|
||||
|
||||
static struct gdb_ctx ctx;
|
||||
static bool start;
|
||||
|
||||
/**
|
||||
* Currently we just handle vectors 1 and 3 but lets keep it generic
|
||||
|
@ -100,8 +99,7 @@ static void z_gdb_interrupt(unsigned int vector, z_arch_esf_t *esf)
|
|||
ctx.registers[GDB_FS] = esf->fs;
|
||||
ctx.registers[GDB_GS] = esf->gs;
|
||||
|
||||
z_gdb_main_loop(&ctx, start);
|
||||
start = false;
|
||||
z_gdb_main_loop(&ctx);
|
||||
|
||||
esf->eax = ctx.registers[GDB_EAX];
|
||||
esf->ecx = ctx.registers[GDB_ECX];
|
||||
|
@ -230,7 +228,6 @@ static __used void z_gdb_break_isr(z_arch_esf_t *esf)
|
|||
|
||||
void arch_gdb_init(void)
|
||||
{
|
||||
start = true;
|
||||
__asm__ volatile ("int3");
|
||||
}
|
||||
|
||||
|
|
|
@ -188,7 +188,7 @@ struct gdb_ctx;
|
|||
/* Should be called by the arch layer. This is the gdbstub main loop
|
||||
* and synchronously communicate with gdb on host.
|
||||
*/
|
||||
extern int z_gdb_main_loop(struct gdb_ctx *ctx, bool start);
|
||||
extern int z_gdb_main_loop(struct gdb_ctx *ctx);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_INSTRUMENT_THREAD_SWITCHING
|
||||
|
|
|
@ -33,6 +33,8 @@ LOG_MODULE_REGISTER(gdbstub);
|
|||
#define GDB_ERROR_MEMORY "E14"
|
||||
#define GDB_ERROR_OVERFLOW "E22"
|
||||
|
||||
static bool not_first_start;
|
||||
|
||||
size_t gdb_bin2hex(const uint8_t *buf, size_t buflen, char *hex, size_t hexlen)
|
||||
{
|
||||
if ((hexlen + 1) < buflen * 2) {
|
||||
|
@ -229,7 +231,7 @@ static int gdb_send_exception(uint8_t *buf, size_t len, uint8_t exception)
|
|||
/**
|
||||
* Synchronously communicate with gdb on the host
|
||||
*/
|
||||
int z_gdb_main_loop(struct gdb_ctx *ctx, bool start)
|
||||
int z_gdb_main_loop(struct gdb_ctx *ctx)
|
||||
{
|
||||
/* 'static' modifier is intentional so the buffer
|
||||
* is not declared inside running stack, which may
|
||||
|
@ -245,8 +247,13 @@ int z_gdb_main_loop(struct gdb_ctx *ctx, bool start)
|
|||
|
||||
state = RECEIVING;
|
||||
|
||||
if (start == false) {
|
||||
/* Only send exception if this is not the first
|
||||
* GDB break.
|
||||
*/
|
||||
if (not_first_start) {
|
||||
gdb_send_exception(buf, sizeof(buf), ctx->exception);
|
||||
} else {
|
||||
not_first_start = true;
|
||||
}
|
||||
|
||||
#define CHECK_ERROR(condition) \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue