/* * SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 *//* ... */#pragmaonce#include<stdint.h>#include<stddef.h>#include<stdbool.h>#include"esp_gdbstub_arch.h"#include"sdkconfig.h"5 includes#ifdefCONFIG_ESP_GDBSTUB_SUPPORT_TASKS#include"freertos/FreeRTOS.h"#include"freertos/task.h"#include"esp_private/freertos_debug.h"/* ... */#endif// CONFIG_ESP_GDBSTUB_SUPPORT_TASKS/* Internal error codes used by the routines that parse the incoming gdb packet */#defineGDBSTUB_ST_ENDPACKET-1#defineGDBSTUB_ST_ERR-2#defineGDBSTUB_ST_OK-3#defineGDBSTUB_ST_CONT-4/* Special task index values */#defineGDBSTUB_CUR_TASK_INDEX_UNKNOWN-15 defines#ifndefGDBSTUB_CMD_BUFLEN#defineGDBSTUB_CMD_BUFLEN512#endif#ifCONFIG_ESP_GDBSTUB_SUPPORT_TASKStypedefenum{GDBSTUB_NOT_STARTED,GDBSTUB_STARTED,GDBSTUB_TASK_SUPPORT_DISABLED}{ ... }esp_gdbstub_state_t;#defineGDBSTUB_TASKS_NUMCONFIG_ESP_GDBSTUB_MAX_TASKS/* ... */#endif// CONFIG_ESP_GDBSTUB_SUPPORT_TASKS/* gdbstub temporary run-time data, stored in .bss to reduce stack usage */typedefstruct{esp_gdbstub_gdb_regfile_tregfile;intsignal;#ifCONFIG_ESP_GDBSTUB_SUPPORT_TASKSesp_gdbstub_state_tstate;inttask_count;intpaniced_task_index;intcurrent_task_index;intthread_info_index;//!< index of the last task passed to qsThreadInfoesp_gdbstub_frame_tpaniced_frame;TaskSnapshot_ttasks[GDBSTUB_TASKS_NUM];// TODO: add an API to get snapshots one by one/* ... */#endif// CONFIG_ESP_GDBSTUB_SUPPORT_TASKS}{ ... }esp_gdbstub_scratch_t;externesp_gdbstub_scratch_ts_scratch;/**** Functions provided by the architecture specific part ****//** * @param frame exception frame pointer * @return the appropriate "signal" number for the given exception cause *//* ... */intesp_gdbstub_get_signal(constesp_gdbstub_frame_t*frame);/** * Write registers from the exception frame to the GDB register file * @param frame exception frame to parse * @param dst pointer to the GDB register file *//* ... */voidesp_gdbstub_frame_to_regfile(constesp_gdbstub_frame_t*frame,esp_gdbstub_gdb_regfile_t*dst);/** * Signal handler for debugging interrupts of the application. *//* ... */voidesp_gdbstub_int(void*frame);/** * Signal handler for transport protocol interrupts. *//* ... */voidgdbstub_handle_uart_int(esp_gdbstub_frame_t*regs_frame);#ifCONFIG_ESP_GDBSTUB_SUPPORT_TASKS/** * Write registers from the saved frame of a given task to the GDB register file * @param tcb pointer to the TCB of the task * @param dst pointer to the GDB register file *//* ... */voidesp_gdbstub_tcb_to_regfile(TaskHandle_ttcb,esp_gdbstub_gdb_regfile_t*dst);/* ... */#endif// CONFIG_ESP_GDBSTUB_SUPPORT_TASKS/**** UART related functions ****//** * Receive a byte from the GDB client. Blocks until a byte is available. * @return received byte *//* ... */intesp_gdbstub_getchar(void);/** * Send a byte to the GDB client * @param c byte to send *//* ... */voidesp_gdbstub_putchar(intc);/** * Make sure all bytes sent using putchar() end up at the host. * (Usually stubbed for UART, but can be useful for other channels) *//* ... */voidesp_gdbstub_flush(void);#ifdefCONFIG_ESP_SYSTEM_GDBSTUB_RUNTIME/** * Read a data from fifo and detect start symbol * @return 1 if break symbol was detected, or 0 if not *//* ... */intesp_gdbstub_getfifo(void);/* ... */#endif// CONFIG_ESP_SYSTEM_GDBSTUB_RUNTIME/**** GDB packet related functions ****//** Begin a packet */voidesp_gdbstub_send_start(void);/** Send a character as part of the packet */voidesp_gdbstub_send_char(charc);/** Send a string as part of the packet */voidesp_gdbstub_send_str(constchar*s);/** Send a hex value as part of the packet */voidesp_gdbstub_send_hex(intval,intbits);/** Finish sending the packet */voidesp_gdbstub_send_end(void);/** Send a packet with a string as content */voidesp_gdbstub_send_str_packet(constchar*str);/** Get a hex value from the gdb packet */uint32_tesp_gdbstub_gethex(constunsignedchar**ptr,intbits);/** Read, unescape, and validate the incoming GDB command */intesp_gdbstub_read_command(unsignedchar**out_cmd,size_t*out_size);/** Handle a command received from gdb */intesp_gdbstub_handle_command(unsignedchar*cmd,intlen);voidesp_gdbstub_init_dports(void);voidesp_gdbstub_stall_other_cpus_start(void);voidesp_gdbstub_stall_other_cpus_end(void);voidesp_gdbstub_clear_step(void);voidesp_gdbstub_do_step(esp_gdbstub_frame_t*regs_frame);voidesp_gdbstub_trigger_cpu(void);/** * Write a value to register in frame * @param frame gdbstub frame * @param reg_index register index, depends on architecture * @param value 32 bit data value *//* ... */voidesp_gdbstub_set_register(esp_gdbstub_frame_t*frame,uint32_treg_index,uint32_tvalue);
Details
Show: from
Types: Columns:
All items filtered out
All items filtered out
This file uses the notable symbols shown below. Click anywhere in the file to view more details.