Zephyr Project API 4.0.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
gdbstub.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2020 Intel Corporation
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7#ifndef ZEPHYR_INCLUDE_DEBUG_GDBSTUB_H_
8#define ZEPHYR_INCLUDE_DEBUG_GDBSTUB_H_
9
10/* Map from CPU exceptions to GDB */
11#define GDB_EXCEPTION_INVALID_INSTRUCTION 4UL
12#define GDB_EXCEPTION_BREAKPOINT 5UL
13#define GDB_EXCEPTION_MEMORY_FAULT 7UL
14#define GDB_EXCEPTION_DIVIDE_ERROR 8UL
15#define GDB_EXCEPTION_INVALID_MEMORY 11UL
16#define GDB_EXCEPTION_OVERFLOW 16UL
17
18/* Access permissions for memory regions */
19#define GDB_MEM_REGION_NO_ACCESS 0UL
20#define GDB_MEM_REGION_READ BIT(0)
21#define GDB_MEM_REGION_WRITE BIT(1)
22
23#define GDB_MEM_REGION_RO \
24 (GDB_MEM_REGION_READ)
25
26#define GDB_MEM_REGION_RW \
27 (GDB_MEM_REGION_READ | GDB_MEM_REGION_WRITE)
28
43
52
61extern const struct gdb_mem_region gdb_mem_region_array[];
62
68extern const size_t gdb_mem_num_regions;
69
83size_t gdb_bin2hex(const uint8_t *buf, size_t buflen,
84 char *hex, size_t hexlen);
85
86
98bool gdb_mem_can_read(const uintptr_t addr, const size_t len, uint8_t *align);
99
111bool gdb_mem_can_write(const uintptr_t addr, const size_t len, uint8_t *align);
112
113#endif
const size_t gdb_mem_num_regions
Number of Memory Regions.
const struct gdb_mem_region gdb_mem_region_array[]
Memory region descriptions used for GDB memory access.
gdb_loop_state
State of the packet processing loop.
Definition gdbstub.h:47
@ GDB_LOOP_ERROR
Definition gdbstub.h:50
@ GDB_LOOP_CONTINUE
Definition gdbstub.h:49
@ GDB_LOOP_RECEIVING
Definition gdbstub.h:48
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.
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.
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
__UINTPTR_TYPE__ uintptr_t
Definition stdint.h:105
__UINT16_TYPE__ uint16_t
Definition stdint.h:89
Describe one memory region.
Definition gdbstub.h:30
uintptr_t end
End address of a memory region.
Definition gdbstub.h:35
uintptr_t start
Start address of a memory region.
Definition gdbstub.h:32
uint8_t alignment
Read/write alignment, 0 if using default alignment.
Definition gdbstub.h:41
uint16_t attributes
Memory region attributes.
Definition gdbstub.h:38