It implements gdb remote protocol to talk with a host gdb during the debug session. The implementation is divided in three layers: 1 - The top layer that is responsible for the gdb remote protocol. 2 - An architecture specific layer responsible to write/read registers, set breakpoints, handle exceptions, ... 3 - A transport layer to be used to communicate with the host The communication with GDB in the host is synchronous and the systems stops execution waiting for instructions and return its execution after a "continue" or "step" command. The protocol has an exception that is when the host sends a packet to cause an interruption, usually triggered by a Ctrl-C. This implementation ignores this instruction though. This initial work supports only X86 using uart as backend. Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
84 lines
1.3 KiB
C
84 lines
1.3 KiB
C
/*
|
|
* Copyright (c) 2020 Intel Corporation.
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
/**
|
|
* @file
|
|
* @brief IA-32 specific gdbstub interface header
|
|
*/
|
|
|
|
#ifndef ZEPHYR_INCLUDE_ARCH_X86_GDBSTUB_SYS_H_
|
|
#define ZEPHYR_INCLUDE_ARCH_X86_GDBSTUB_SYS_H_
|
|
|
|
#ifndef _ASMLANGUAGE
|
|
|
|
#include <stdint.h>
|
|
#include <toolchain.h>
|
|
|
|
/**
|
|
* @brief Number of register used by gdbstub in IA-32
|
|
*/
|
|
#define ARCH_GDB_NUM_REGISTERS 16
|
|
|
|
/**
|
|
* @brief GDB interruption context
|
|
*
|
|
* The exception stack frame contents used by gdbstub. The contents
|
|
* of this struct are used to display information about the current
|
|
* cpu state.
|
|
*/
|
|
|
|
struct gdb_interrupt_ctx {
|
|
uint32_t ss;
|
|
uint32_t gs;
|
|
uint32_t fs;
|
|
uint32_t es;
|
|
uint32_t ds;
|
|
uint32_t edi;
|
|
uint32_t esi;
|
|
uint32_t ebp;
|
|
uint32_t esp;
|
|
uint32_t ebx;
|
|
uint32_t edx;
|
|
uint32_t ecx;
|
|
uint32_t eax;
|
|
uint32_t vector;
|
|
uint32_t error_code;
|
|
uint32_t eip;
|
|
uint32_t cs;
|
|
uint32_t eflags;
|
|
} __packed;
|
|
|
|
/**
|
|
* @brief IA-32 register used in gdbstub
|
|
*/
|
|
|
|
enum GDB_REGISTER {
|
|
GDB_EAX,
|
|
GDB_ECX,
|
|
GDB_EDX,
|
|
GDB_EBX,
|
|
GDB_ESP,
|
|
GDB_EBP,
|
|
GDB_ESI,
|
|
GDB_EDI,
|
|
GDB_PC,
|
|
GDB_EFLAGS,
|
|
GDB_CS,
|
|
GDB_SS,
|
|
GDB_DS,
|
|
GDB_ES,
|
|
GDB_FS,
|
|
GDB_GS
|
|
};
|
|
|
|
struct gdb_ctx {
|
|
unsigned int exception;
|
|
unsigned int registers[ARCH_GDB_NUM_REGISTERS];
|
|
};
|
|
|
|
#endif /* _ASMLANGUAGE */
|
|
|
|
#endif /* ZEPHYR_INCLUDE_ARCH_X86_GDBSTUB_SYS_H_ */
|