Zephyr Project API 3.7.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
gdbstub.h File Reference

Go to the source code of this file.

Data Structures

struct  gdb_mem_region
 Describe one memory region. More...
 

Macros

#define GDB_EXCEPTION_INVALID_INSTRUCTION   4UL
 
#define GDB_EXCEPTION_BREAKPOINT   5UL
 
#define GDB_EXCEPTION_MEMORY_FAULT   7UL
 
#define GDB_EXCEPTION_DIVIDE_ERROR   8UL
 
#define GDB_EXCEPTION_INVALID_MEMORY   11UL
 
#define GDB_EXCEPTION_OVERFLOW   16UL
 
#define GDB_MEM_REGION_NO_ACCESS   0UL
 
#define GDB_MEM_REGION_READ   BIT(0)
 
#define GDB_MEM_REGION_WRITE   BIT(1)
 
#define GDB_MEM_REGION_RO    (GDB_MEM_REGION_READ)
 
#define GDB_MEM_REGION_RW    (GDB_MEM_REGION_READ | GDB_MEM_REGION_WRITE)
 

Enumerations

enum  gdb_loop_state { GDB_LOOP_RECEIVING , GDB_LOOP_CONTINUE , GDB_LOOP_ERROR }
 State of the packet processing loop. More...
 

Functions

size_t gdb_bin2hex (const uint8_t *buf, size_t buflen, char *hex, size_t hexlen)
 Convert a binary array into string representation.
 
bool gdb_mem_can_read (const uintptr_t addr, const size_t len, uint8_t *align)
 Check if a memory block can be read.
 
bool gdb_mem_can_write (const uintptr_t addr, const size_t len, uint8_t *align)
 Check if a memory block can be written into.
 

Variables

const struct gdb_mem_region gdb_mem_region_array []
 Memory region descriptions used for GDB memory access.
 
const size_t gdb_mem_num_regions
 Number of Memory Regions.
 

Macro Definition Documentation

◆ GDB_EXCEPTION_BREAKPOINT

#define GDB_EXCEPTION_BREAKPOINT   5UL

◆ GDB_EXCEPTION_DIVIDE_ERROR

#define GDB_EXCEPTION_DIVIDE_ERROR   8UL

◆ GDB_EXCEPTION_INVALID_INSTRUCTION

#define GDB_EXCEPTION_INVALID_INSTRUCTION   4UL

◆ GDB_EXCEPTION_INVALID_MEMORY

#define GDB_EXCEPTION_INVALID_MEMORY   11UL

◆ GDB_EXCEPTION_MEMORY_FAULT

#define GDB_EXCEPTION_MEMORY_FAULT   7UL

◆ GDB_EXCEPTION_OVERFLOW

#define GDB_EXCEPTION_OVERFLOW   16UL

◆ GDB_MEM_REGION_NO_ACCESS

#define GDB_MEM_REGION_NO_ACCESS   0UL

◆ GDB_MEM_REGION_READ

#define GDB_MEM_REGION_READ   BIT(0)

◆ GDB_MEM_REGION_RO

#define GDB_MEM_REGION_RO    (GDB_MEM_REGION_READ)

◆ GDB_MEM_REGION_RW

#define GDB_MEM_REGION_RW    (GDB_MEM_REGION_READ | GDB_MEM_REGION_WRITE)

◆ GDB_MEM_REGION_WRITE

#define GDB_MEM_REGION_WRITE   BIT(1)

Enumeration Type Documentation

◆ gdb_loop_state

State of the packet processing loop.

Enumerator
GDB_LOOP_RECEIVING 
GDB_LOOP_CONTINUE 
GDB_LOOP_ERROR 

Function Documentation

◆ gdb_bin2hex()

size_t gdb_bin2hex ( const uint8_t buf,
size_t  buflen,
char *  hex,
size_t  hexlen 
)

Convert a binary array into string representation.

Note that this is similar to bin2hex() but does not force a null character at the end of the hexadecimal output buffer.

Parameters
bufThe binary array to convert
buflenThe length of the binary array to convert
hexAddress of where to store the string representation.
hexlenSize of the storage area for string representation.
Returns
The length of the converted string, or 0 if an error occurred.

◆ gdb_mem_can_read()

bool gdb_mem_can_read ( const uintptr_t  addr,
const size_t  len,
uint8_t align 
)

Check if a memory block can be read.

This checks if the specified memory block can be read.

Parameters
[in]addrStarting address of the memory block
[in]lenSize of memory block
[out]alignRead alignment of region
Returns
True if memory block can be read, false otherwise.

◆ gdb_mem_can_write()

bool gdb_mem_can_write ( const uintptr_t  addr,
const size_t  len,
uint8_t align 
)

Check if a memory block can be written into.

This checks if the specified memory block can be written into.

Parameters
[in]addrStarting address of the memory block
[in]lenSize of memory block
[out]alignWrite alignment of region
Returns
True if GDB stub can write to the block, false otherwise.

Variable Documentation

◆ gdb_mem_num_regions

const size_t gdb_mem_num_regions
extern

Number of Memory Regions.

Number of elements in gdb_mem_region_array[];

◆ gdb_mem_region_array

const struct gdb_mem_region gdb_mem_region_array[]
extern

Memory region descriptions used for GDB memory access.

This array specifies which region of memory GDB can access with read/write attributes. This is used to restrict memory read/write in GDB stub to memory that can be legally accessed without resulting in memory faults.