OpenOCD
|
GDB server implementation. More...
Go to the source code of this file.
Data Structures | |
struct | gdb_connection |
struct | target_desc_format |
Enumerations | |
enum | gdb_output_flag { GDB_OUTPUT_NO , GDB_OUTPUT_NOTIF , GDB_OUTPUT_ALL } |
Functions | |
static | __attribute__ ((format(PRINTF_ATTRIBUTE_FORMAT, 5, 6))) |
static int | check_pending (struct connection *connection, int timeout_s, int *got_data) |
COMMAND_HANDLER (handle_gdb_breakpoint_override_command) | |
COMMAND_HANDLER (handle_gdb_flash_program_command) | |
COMMAND_HANDLER (handle_gdb_memory_map_command) | |
COMMAND_HANDLER (handle_gdb_port_command) | |
COMMAND_HANDLER (handle_gdb_report_data_abort_command) | |
COMMAND_HANDLER (handle_gdb_report_register_access_error) | |
COMMAND_HANDLER (handle_gdb_save_tdesc_command) | |
COMMAND_HANDLER (handle_gdb_sync_command) | |
COMMAND_HANDLER (handle_gdb_target_description_command) | |
static int | compare_bank (const void *a, const void *b) |
static int | decode_xfer_read (char const *buf, char **annex, int *ofs, unsigned int *len) |
static int | fetch_packet (struct connection *connection, int *checksum_ok, int noack, int *len, char *buffer) |
static void | gdb_async_notif (struct connection *connection) |
static int | gdb_breakpoint_watchpoint_packet (struct connection *connection, char const *packet, int packet_size) |
static int | gdb_connection_closed (struct connection *connection) |
static int | gdb_detach (struct connection *connection) |
static int | gdb_error (struct connection *connection, int retval) |
static void | gdb_fileio_reply (struct target *target, struct connection *connection) |
static int | gdb_fileio_response_packet (struct connection *connection, char const *packet, int packet_size) |
static void | gdb_frontend_halted (struct target *target, struct connection *connection) |
static int | gdb_generate_reg_type_description (struct target *target, char **tdesc, int *pos, int *size, struct reg_data_type *type, char const **arch_defined_types_list[], int *num_arch_defined_types) |
static int | gdb_generate_target_description (struct target *target, char **tdesc_out) |
static int | gdb_generate_thread_list (struct target *target, char **thread_list_out) |
int | gdb_get_actual_connections (void) |
static int | gdb_get_char (struct connection *connection, int *next_char) |
static int | gdb_get_char_fast (struct connection *connection, int *next_char, char **buf_p, int *buf_cnt) |
The cool thing about this fn is that it allows buf_p and buf_cnt to be held in registers in the inner loop. More... | |
static int | gdb_get_char_inner (struct connection *connection, int *next_char) |
static int | gdb_get_packet (struct connection *connection, char *buffer, int *len) |
static int | gdb_get_packet_inner (struct connection *connection, char *buffer, int *len) |
static const char * | gdb_get_reg_type_name (enum reg_type type) |
static int | gdb_get_reg_value_as_str (struct target *target, char *tstr, struct reg *reg) |
static int | gdb_get_register_packet (struct connection *connection, char const *packet, int packet_size) |
static int | gdb_get_registers_packet (struct connection *connection, char const *packet, int packet_size) |
static int | gdb_get_target_description_chunk (struct target *target, struct target_desc_format *target_desc, char **chunk, int32_t offset, uint32_t length) |
static int | gdb_get_thread_list_chunk (struct target *target, char **thread_list, char **chunk, int32_t offset, uint32_t length) |
static bool | gdb_handle_vcont_packet (struct connection *connection, const char *packet, __attribute__((unused)) int packet_size) |
static bool | gdb_handle_vrun_packet (struct connection *connection, const char *packet, int packet_size) |
static int | gdb_input (struct connection *connection) |
static int | gdb_input_inner (struct connection *connection) |
static void | gdb_keep_client_alive (struct connection *connection) |
static int | gdb_last_signal (struct target *target) |
static int | gdb_last_signal_packet (struct connection *connection, char const *packet, int packet_size) |
static void | gdb_log_callback (void *priv, const char *file, unsigned int line, const char *function, const char *string) |
static void | gdb_log_incoming_packet (struct connection *connection, const char *packet) |
static void | gdb_log_outgoing_packet (struct connection *connection, const char *packet_buf, unsigned int packet_len, unsigned char checksum) |
static int | gdb_memory_map (struct connection *connection, char const *packet, int packet_size) |
static int | gdb_new_connection (struct connection *connection) |
static int | gdb_output (struct command_context *context, const char *line) |
static int | gdb_output_con (struct connection *connection, const char *line) |
int | gdb_put_packet (struct connection *connection, const char *buffer, int len) |
static int | gdb_put_packet_inner (struct connection *connection, const char *buffer, int len) |
static int | gdb_putback_char (struct connection *connection, int last_char) |
static int | gdb_query_packet (struct connection *connection, char const *packet, int packet_size) |
static int | gdb_read_memory_packet (struct connection *connection, char const *packet, int packet_size) |
static int | gdb_reg_pos (struct target *target, int pos, int len) |
int | gdb_register_commands (struct command_context *cmd_ctx) |
static void | gdb_restart_inferior (struct connection *connection, const char *packet, int packet_size) |
static void | gdb_send_error (struct connection *connection, uint8_t the_error) |
void | gdb_service_free (void) |
static int | gdb_set_register_packet (struct connection *connection, char const *packet, int packet_size) |
static int | gdb_set_registers_packet (struct connection *connection, char const *packet, int packet_size) |
static void | gdb_sig_halted (struct connection *connection) |
static void | gdb_signal_reply (struct target *target, struct connection *connection) |
static int | gdb_step_continue_packet (struct connection *connection, char const *packet, int packet_size) |
static void | gdb_str_to_target (struct target *target, char *tstr, struct reg *reg) |
int | gdb_target_add_all (struct target *target) |
static int | gdb_target_add_one (struct target *target) |
static int | gdb_target_callback_event_handler (struct target *target, enum target_event event, void *priv) |
static int | gdb_target_description_supported (struct target *target, bool *supported) |
static int | gdb_target_start (struct target *target, const char *port) |
static void | gdb_target_to_reg (struct target *target, char const *tstr, int str_len, uint8_t *bin) |
static int | gdb_v_packet (struct connection *connection, char const *packet, int packet_size) |
static int | gdb_write (struct connection *connection, const void *data, int len) |
static int | gdb_write_memory_binary_packet (struct connection *connection, char const *packet, int packet_size) |
static int | gdb_write_memory_packet (struct connection *connection, char const *packet, int packet_size) |
static int | get_reg_features_list (struct target *target, char const **feature_list[], int *feature_list_size, struct reg **reg_list, int reg_list_size) |
static int | lookup_add_arch_defined_types (char const **arch_defined_types_list[], const char *type_id, int *num_arch_defined_types) |
static char * | next_hex_encoded_field (const char **str, char sep) |
static int | smp_reg_list_noread (struct target *target, struct reg **combined_list[], int *combined_list_size, enum target_register_class reg_class) |
Variables | |
static struct gdb_connection * | current_gdb_connection |
static int | gdb_actual_connections |
static int | gdb_breakpoint_override |
static enum breakpoint_type | gdb_breakpoint_override_type |
static const struct command_registration | gdb_command_handlers [] |
static bool | gdb_flash_program = true |
static char * | gdb_port |
static char * | gdb_port_next |
static int | gdb_report_data_abort |
static int | gdb_report_register_access_error |
static char | gdb_running_type |
static const struct service_driver | gdb_service_driver |
static const struct command_registration | gdb_subcommand_handlers [] |
static bool | gdb_use_memory_map = true |
static bool | gdb_use_target_description = true |
GDB server implementation.
This implements the GDB Remote Serial Protocol, over TCP connections, giving GDB access to the JTAG or other hardware debugging facilities found in most modern embedded processors.
Definition in file gdb_server.c.
enum gdb_output_flag |
Enumerator | |
---|---|
GDB_OUTPUT_NO | |
GDB_OUTPUT_NOTIF | |
GDB_OUTPUT_ALL |
Definition at line 53 of file gdb_server.c.
|
static |
Definition at line 1820 of file gdb_server.c.
References ERROR_OK, ERROR_SERVER_REMOTE_CLOSED, and size.
|
static |
Definition at line 178 of file gdb_server.c.
References gdb_connection::buf_cnt, ERROR_GDB_TIMEOUT, ERROR_OK, connection::fd, NULL, connection::priv, socket_select(), timeval::tv_sec, and timeval::tv_usec.
Referenced by gdb_get_char_inner(), and gdb_put_packet_inner().
COMMAND_HANDLER | ( | handle_gdb_breakpoint_override_command | ) |
Definition at line 3987 of file gdb_server.c.
References BKPT_HARD, BKPT_SOFT, CMD_ARGC, CMD_ARGV, ERROR_COMMAND_SYNTAX_ERROR, ERROR_OK, gdb_breakpoint_override, gdb_breakpoint_override_type, and LOG_USER.
COMMAND_HANDLER | ( | handle_gdb_flash_program_command | ) |
Definition at line 3960 of file gdb_server.c.
References CMD_ARGC, CMD_ARGV, COMMAND_PARSE_ENABLE, ERROR_COMMAND_SYNTAX_ERROR, ERROR_OK, and gdb_flash_program.
COMMAND_HANDLER | ( | handle_gdb_memory_map_command | ) |
Definition at line 3951 of file gdb_server.c.
References CMD_ARGC, CMD_ARGV, COMMAND_PARSE_ENABLE, ERROR_COMMAND_SYNTAX_ERROR, ERROR_OK, and gdb_use_memory_map.
COMMAND_HANDLER | ( | handle_gdb_port_command | ) |
Definition at line 3941 of file gdb_server.c.
References CALL_COMMAND_HANDLER, ERROR_OK, gdb_port, and gdb_port_next.
COMMAND_HANDLER | ( | handle_gdb_report_data_abort_command | ) |
Definition at line 3969 of file gdb_server.c.
References CMD_ARGC, CMD_ARGV, COMMAND_PARSE_ENABLE, ERROR_COMMAND_SYNTAX_ERROR, ERROR_OK, and gdb_report_data_abort.
COMMAND_HANDLER | ( | handle_gdb_report_register_access_error | ) |
Definition at line 3978 of file gdb_server.c.
References CMD_ARGC, CMD_ARGV, COMMAND_PARSE_ENABLE, ERROR_COMMAND_SYNTAX_ERROR, ERROR_OK, and gdb_report_register_access_error.
COMMAND_HANDLER | ( | handle_gdb_save_tdesc_command | ) |
Definition at line 4019 of file gdb_server.c.
References alloc_printf(), CMD_CTX, ERROR_FAIL, ERROR_OK, fileio_close(), fileio_open(), FILEIO_TEXT, fileio_write(), FILEIO_WRITE, gdb_generate_target_description(), get_current_target(), LOG_ERROR, and target_type_name().
COMMAND_HANDLER | ( | handle_gdb_sync_command | ) |
Definition at line 3925 of file gdb_server.c.
References CMD, CMD_ARGC, command_print(), current_gdb_connection, ERROR_COMMAND_SYNTAX_ERROR, ERROR_FAIL, ERROR_OK, and gdb_connection::sync.
COMMAND_HANDLER | ( | handle_gdb_target_description_command | ) |
Definition at line 4010 of file gdb_server.c.
References CMD_ARGC, CMD_ARGV, COMMAND_PARSE_ENABLE, ERROR_COMMAND_SYNTAX_ERROR, ERROR_OK, and gdb_use_target_description.
|
static |
Definition at line 1883 of file gdb_server.c.
References flash_bank::base.
Referenced by gdb_memory_map().
|
static |
Definition at line 1856 of file gdb_server.c.
References ERROR_FAIL, ERROR_OK, NULL, and strndup().
Referenced by gdb_query_packet().
|
inlinestatic |
Definition at line 538 of file gdb_server.c.
References gdb_connection::buf_cnt, gdb_connection::buf_p, buffer, count, ERROR_GDB_BUFFER_TOO_SMALL, ERROR_OK, gdb_get_char(), gdb_get_char_fast(), LOG_ERROR, NULL, and connection::priv.
Referenced by gdb_get_packet_inner().
|
static |
Definition at line 3774 of file gdb_server.c.
References count, gdb_write(), and LOG_DEBUG.
Referenced by gdb_keep_client_alive().
|
static |
Definition at line 1731 of file gdb_server.c.
References BKPT_HARD, BKPT_SOFT, breakpoint_add(), breakpoint_remove(), ERROR_NOT_IMPLEMENTED, ERROR_OK, ERROR_SERVER_REMOTE_CLOSED, gdb_breakpoint_override, gdb_breakpoint_override_type, gdb_error(), gdb_put_packet(), get_target_from_connection(), LOG_DEBUG, LOG_ERROR, size, target_name(), type, watchpoint_add(), WATCHPOINT_IGNORE_DATA_VALUE_MASK, watchpoint_remove(), WPT_ACCESS, WPT_READ, and WPT_WRITE.
Referenced by gdb_input_inner().
|
static |
Definition at line 1092 of file gdb_server.c.
References connection::cmd_ctx, delete_debug_msg_receiver(), ERROR_OK, gdb_actual_connections, gdb_log_callback(), gdb_target_callback_event_handler(), get_target_from_connection(), image_close(), log_remove_callback(), LOG_TARGET_DEBUG, NULL, connection::priv, target, target_call_event_callbacks(), TARGET_EVENT_GDB_DETACH, TARGET_EVENT_GDB_END, target_state_name(), target_unregister_event_callback(), gdb_connection::unique_index, and gdb_connection::vflash_image.
|
static |
Definition at line 3413 of file gdb_server.c.
References gdb_put_packet().
Referenced by gdb_input_inner().
|
static |
Definition at line 1491 of file gdb_server.c.
References ERROR_OK, gdb_send_error(), and LOG_DEBUG.
Referenced by gdb_breakpoint_watchpoint_packet(), gdb_get_register_packet(), gdb_get_registers_packet(), gdb_memory_map(), gdb_query_packet(), gdb_read_memory_packet(), gdb_set_register_packet(), gdb_set_registers_packet(), gdb_write_memory_binary_packet(), and gdb_write_memory_packet().
|
static |
Definition at line 841 of file gdb_server.c.
References target::fileio_info, gdb_connection::frontend_state, gdb_put_packet(), gdb_fileio_info::identifier, LOG_DEBUG, gdb_fileio_info::param_1, gdb_fileio_info::param_2, gdb_fileio_info::param_3, gdb_fileio_info::param_4, connection::priv, rtos_update_threads(), TARGET_HALTED, target_resume(), and TARGET_RUNNING.
Referenced by gdb_frontend_halted().
|
static |
Definition at line 3427 of file gdb_server.c.
References ERROR_FAIL, ERROR_OK, gdb_running_type, get_target_from_connection(), LOG_DEBUG, target_gdb_fileio_end(), target_resume(), and target_step().
Referenced by gdb_input_inner().
|
static |
Definition at line 929 of file gdb_server.c.
References ERROR_OK, target::fileio_info, gdb_connection::frontend_state, gdb_fileio_reply(), GDB_OUTPUT_NO, gdb_signal_reply(), gdb_connection::output_flag, connection::priv, target_get_gdb_fileio_info(), and TARGET_RUNNING.
Referenced by gdb_input_inner(), and gdb_target_callback_event_handler().
|
static |
Definition at line 2114 of file gdb_server.c.
References reg_data_type_struct_field::bitfield, reg_data_type_flags_field::bitfield, data_type, reg_data_type_bitfield::end, ERROR_OK, gdb_get_reg_type_name(), reg_data_type::id, lookup_add_arch_defined_types(), reg_data_type_union_field::name, reg_data_type_struct_field::name, reg_data_type_flags_field::name, reg_data_type_union_field::next, reg_data_type_struct_field::next, reg_data_type_flags_field::next, REG_TYPE_ARCH_DEFINED, REG_TYPE_CLASS_FLAGS, REG_TYPE_CLASS_STRUCT, REG_TYPE_CLASS_UNION, REG_TYPE_CLASS_VECTOR, size, reg_data_type_bitfield::start, type, reg_data_type_union_field::type, reg_data_type_bitfield::type, reg_data_type_struct_field::type, reg_data_type::type, and reg_data_type_struct_field::use_bitfields.
Referenced by gdb_generate_target_description().
|
static |
Definition at line 2403 of file gdb_server.c.
References reg::caller_save, ERROR_FAIL, ERROR_OK, reg::exist, feature, gdb_generate_reg_type_description(), gdb_get_reg_type_name(), get_reg_features_list(), group, reg::hidden, reg_data_type::id, LOG_ERROR, lookup_add_arch_defined_types(), name, NULL, number, REG_CLASS_ALL, reg::reg_data_type, REG_TYPE_ARCH_DEFINED, size, smp_reg_list_noread(), target_get_gdb_arch(), and reg_data_type::type.
Referenced by COMMAND_HANDLER(), and gdb_get_target_description_chunk().
|
static |
Definition at line 2642 of file gdb_server.c.
References ERROR_OK, thread_detail::exists, thread_detail::extra_info_str, NULL, target::rtos, size, rtos::thread_count, rtos::thread_details, thread_detail::thread_name_str, and thread_detail::threadid.
Referenced by gdb_get_thread_list_chunk().
int gdb_get_actual_connections | ( | void | ) |
Definition at line 4163 of file gdb_server.c.
References gdb_actual_connections.
Referenced by gdb_timeout_warning(), and semihosting_common().
|
static |
Definition at line 316 of file gdb_server.c.
References gdb_connection::buf_cnt, gdb_connection::buf_p, gdb_get_char_fast(), and connection::priv.
Referenced by fetch_packet(), gdb_get_packet_inner(), gdb_new_connection(), and gdb_put_packet_inner().
|
inlinestatic |
The cool thing about this fn is that it allows buf_p and buf_cnt to be held in registers in the inner loop.
For small caches and embedded systems this is important!
Definition at line 286 of file gdb_server.c.
References gdb_connection::buf_cnt, gdb_connection::buf_p, ERROR_OK, gdb_get_char_inner(), connection::input_pending, LOG_DEBUG, and connection::priv.
Referenced by fetch_packet(), and gdb_get_char().
|
static |
Definition at line 215 of file gdb_server.c.
References gdb_connection::buf_cnt, gdb_connection::buf_p, gdb_connection::buffer, check_pending(), gdb_connection::closed, CONNECTION_TCP, ERROR_OK, ERROR_SERVER_REMOTE_CLOSED, connection::fd, GDB_BUFFER_SIZE, connection::input_pending, LOG_DEBUG, log_socket_error(), NULL, connection::priv, read_socket(), connection::service, strndup(), and service::type.
Referenced by gdb_get_char_fast().
|
static |
Definition at line 736 of file gdb_server.c.
References buffer, gdb_connection::busy, gdb_get_packet_inner(), and connection::priv.
Referenced by gdb_input_inner().
|
static |
Definition at line 653 of file gdb_server.c.
References buffer, gdb_connection::closed, gdb_connection::ctrl_c, ERROR_OK, ERROR_SERVER_REMOTE_CLOSED, fetch_packet(), gdb_get_char(), gdb_log_incoming_packet(), gdb_write(), LOG_DEBUG, LOG_WARNING, gdb_connection::noack_mode, and connection::priv.
Referenced by gdb_get_packet().
|
static |
Definition at line 2044 of file gdb_server.c.
References REG_TYPE_ARCH_DEFINED, REG_TYPE_BOOL, REG_TYPE_CODE_PTR, REG_TYPE_DATA_PTR, REG_TYPE_FLOAT, REG_TYPE_IEEE_DOUBLE, REG_TYPE_IEEE_SINGLE, REG_TYPE_INT, REG_TYPE_INT128, REG_TYPE_INT16, REG_TYPE_INT32, REG_TYPE_INT64, REG_TYPE_INT8, REG_TYPE_UINT, REG_TYPE_UINT128, REG_TYPE_UINT16, REG_TYPE_UINT32, REG_TYPE_UINT64, REG_TYPE_UINT8, and type.
Referenced by gdb_generate_reg_type_description(), and gdb_generate_target_description().
|
static |
Definition at line 1218 of file gdb_server.c.
References DIV_ROUND_UP, ERROR_FAIL, ERROR_OK, ERROR_TARGET_RESOURCE_NOT_AVAILABLE, gdb_str_to_target(), reg_arch_type::get, reg::size, reg::type, and reg::valid.
Referenced by gdb_get_register_packet(), and gdb_get_registers_packet().
|
static |
Definition at line 1371 of file gdb_server.c.
References DIV_ROUND_UP, ERROR_OK, ERROR_SERVER_REMOTE_CLOSED, reg::exist, gdb_error(), gdb_get_reg_value_as_str(), gdb_put_packet(), gdb_report_register_access_error, get_target_from_connection(), reg::hidden, LOG_DEBUG, LOG_ERROR, name, NULL, REG_CLASS_ALL, target::rtos, rtos_get_gdb_reg(), size, and target_get_gdb_reg_list_noread().
Referenced by gdb_input_inner().
|
static |
Definition at line 1240 of file gdb_server.c.
References DIV_ROUND_UP, ERROR_FAIL, ERROR_OK, reg::exist, gdb_error(), gdb_get_reg_value_as_str(), gdb_put_packet(), gdb_report_register_access_error, get_target_from_connection(), reg::hidden, LOG_DEBUG, name, REG_CLASS_GENERAL, target::rtos, rtos_get_gdb_reg_list(), size, strndup(), and target_get_gdb_reg_list().
Referenced by gdb_input_inner().
|
static |
Definition at line 2543 of file gdb_server.c.
References ERROR_FAIL, ERROR_OK, gdb_generate_target_description(), length, LOG_ERROR, NULL, offset, target_desc_format::tdesc, and target_desc_format::tdesc_length.
Referenced by gdb_query_packet().
|
static |
Definition at line 2698 of file gdb_server.c.
References ERROR_FAIL, ERROR_OK, gdb_generate_thread_list(), length, LOG_ERROR, MIN, NULL, and offset.
Referenced by gdb_query_packet().
|
static |
Definition at line 2979 of file gdb_server.c.
References rtos::current_thread, ERROR_OK, ERROR_TARGET_NOT_HALTED, gdb_connection::frontend_state, GDB_OUTPUT_ALL, GDB_OUTPUT_NO, gdb_put_packet(), gdb_running_type, gdb_sig_halted(), gdb_signal_reply(), rtos::gdb_target_for_threadid, get_target_from_connection(), LOG_DEBUG, LOG_ERROR, LOG_TARGET_DEBUG, LOG_TARGET_INFO, NULL, gdb_connection::output_flag, connection::priv, target::rtos, rtos_update_threads(), target::state, target_type::step, gdb_connection::sync, target, target_call_event_callbacks(), TARGET_EVENT_GDB_START, TARGET_HALTED, target_poll(), target_resume(), TARGET_RUNNING, target_step(), and target::type.
Referenced by gdb_v_packet().
|
static |
Definition at line 3203 of file gdb_server.c.
References alloc_printf(), semihosting::cmdline, gdb_put_packet(), gdb_restart_inferior(), get_target_from_connection(), LOG_INFO, next_hex_encoded_field(), and target::semihosting.
Referenced by gdb_v_packet().
|
static |
Definition at line 3744 of file gdb_server.c.
References gdb_connection::closed, ERROR_OK, ERROR_SERVER_REMOTE_CLOSED, gdb_input_inner(), and connection::priv.
|
static |
Definition at line 3497 of file gdb_server.c.
References gdb_connection::attached, gdb_connection::buf_cnt, gdb_connection::ctrl_c, rtos::current_threadid, ERROR_OK, ERROR_SERVER_REMOTE_CLOSED, gdb_connection::extended_protocol, gdb_connection::frontend_state, gdb_breakpoint_watchpoint_packet(), GDB_BUFFER_SIZE, gdb_detach(), gdb_fileio_response_packet(), gdb_frontend_halted(), gdb_get_packet(), gdb_get_register_packet(), gdb_get_registers_packet(), gdb_last_signal_packet(), gdb_log_incoming_packet(), GDB_OUTPUT_ALL, GDB_OUTPUT_NO, GDB_OUTPUT_NOTIF, gdb_put_packet(), gdb_query_packet(), gdb_read_memory_packet(), gdb_read_smp_packet(), gdb_restart_inferior(), gdb_set_register_packet(), gdb_set_registers_packet(), gdb_sig_halted(), gdb_step_continue_packet(), rtos::gdb_target_for_threadid, gdb_thread_packet(), GDB_THREAD_PACKET_NOT_CONSUMED, gdb_v_packet(), gdb_write_memory_binary_packet(), gdb_write_memory_packet(), gdb_write_smp_packet(), get_target_from_connection(), LOG_DEBUG, LOG_ERROR, LOG_INFO, LOG_WARNING, gdb_connection::mem_write_error, gdb_connection::output_flag, service::port, connection::priv, target::rtos, connection::service, target::state, gdb_connection::sync, target, target_call_event_callbacks(), TARGET_EVENT_GDB_HALT, TARGET_EVENT_GDB_START, target_halt(), TARGET_HALTED, target_poll(), and TARGET_RUNNING.
Referenced by gdb_input().
|
static |
Definition at line 3792 of file gdb_server.c.
References gdb_async_notif(), GDB_OUTPUT_ALL, gdb_output_con(), GDB_OUTPUT_NO, GDB_OUTPUT_NOTIF, gdb_connection::output_flag, and connection::priv.
|
static |
Definition at line 152 of file gdb_server.c.
References DBG_REASON_BREAKPOINT, DBG_REASON_DBGRQ, DBG_REASON_EXC_CATCH, DBG_REASON_NOTHALTED, DBG_REASON_SINGLESTEP, DBG_REASON_WATCHPOINT, DBG_REASON_WPTANDBKPT, target::debug_reason, LOG_TARGET_DEBUG, LOG_USER, and target_debug_reason_str().
Referenced by gdb_last_signal_packet(), and gdb_signal_reply().
|
static |
Definition at line 1139 of file gdb_server.c.
References gdb_connection::attached, ERROR_OK, gdb_last_signal(), gdb_put_packet(), get_target_from_connection(), and connection::priv.
Referenced by gdb_input_inner().
|
static |
Definition at line 3472 of file gdb_server.c.
References gdb_connection::busy, GDB_OUTPUT_ALL, gdb_output_con(), gdb_connection::output_flag, priv, and connection::priv.
Referenced by gdb_connection_closed(), and gdb_new_connection().
|
static |
Definition at line 354 of file gdb_server.c.
References find_nonprint_char(), get_target_from_connection(), LOG_LEVEL_IS, LOG_LVL_DEBUG, LOG_TARGET_DEBUG, MIN, connection::priv, and gdb_connection::unique_index.
Referenced by gdb_get_packet_inner(), gdb_input_inner(), and gdb_put_packet_inner().
|
static |
Definition at line 387 of file gdb_server.c.
References find_nonprint_char(), get_target_from_connection(), LOG_LEVEL_IS, LOG_LVL_DEBUG, LOG_TARGET_DEBUG, connection::priv, and gdb_connection::unique_index.
Referenced by gdb_put_packet_inner().
|
static |
Definition at line 1897 of file gdb_server.c.
References flash_bank::base, compare_bank(), ERROR_OK, flash_get_bank_count(), gdb_error(), gdb_put_packet(), get_flash_bank_by_num(), get_flash_bank_by_num_noprobe(), get_target_from_connection(), length, LOG_WARNING, flash_bank::name, NULL, flash_bank::num_sectors, flash_sector::offset, offset, sector_size, flash_bank::sectors, flash_sector::size, flash_bank::size, size, start, flash_bank::target, TARGET_ADDR_FMT, and target_address_max().
Referenced by gdb_query_packet().
|
static |
Definition at line 977 of file gdb_server.c.
References all_targets, gdb_connection::attached, breakpoint_clear_target(), gdb_connection::buf_cnt, gdb_connection::buf_p, gdb_connection::buffer, gdb_connection::busy, rtos_type::clean, gdb_connection::closed, connection::cmd_ctx, command_set_output_handler(), gdb_connection::ctrl_c, command_context::current_target, ERROR_OK, ERROR_TARGET_NOT_EXAMINED, gdb_connection::extended_protocol, flash_get_bank_count(), gdb_connection::frontend_state, gdb_actual_connections, gdb_get_char(), gdb_log_callback(), gdb_output(), GDB_OUTPUT_NO, gdb_putback_char(), gdb_target_callback_event_handler(), gdb_use_memory_map, get_flash_bank_by_num(), get_flash_bank_by_num_noprobe(), get_target_from_connection(), log_add_callback(), LOG_ERROR, LOG_LVL_DEBUG, LOG_LVL_INFO, log_printf_lf(), LOG_TARGET_ERROR, LOG_TARGET_WARNING, gdb_connection::mem_write_error, target::next, gdb_connection::noack_mode, NULL, gdb_connection::output_flag, connection::priv, target::rtos, rtos_update_threads(), target::state, gdb_connection::sync, flash_bank::target, target, target_call_event_callbacks(), gdb_connection::target_desc, TARGET_EVENT_GDB_ATTACH, TARGET_HALTED, target_name(), target_register_event_callback(), target_state_name(), target_was_examined(), target_desc_format::tdesc, target_desc_format::tdesc_length, gdb_connection::thread_list, rtos::type, gdb_connection::unique_index, gdb_connection::vflash_image, and watchpoint_clear_target().
|
static |
Definition at line 765 of file gdb_server.c.
References ERROR_OK, and LOG_USER_N.
Referenced by gdb_new_connection().
|
static |
Definition at line 745 of file gdb_server.c.
References ERROR_GDB_BUFFER_TOO_SMALL, gdb_put_packet(), and hexify().
Referenced by gdb_keep_client_alive(), gdb_log_callback(), and gdb_query_packet().
int gdb_put_packet | ( | struct connection * | connection, |
const char * | buffer, | ||
int | len | ||
) |
Definition at line 525 of file gdb_server.c.
References buffer, gdb_connection::busy, gdb_put_packet_inner(), kept_alive(), and connection::priv.
Referenced by gdb_breakpoint_watchpoint_packet(), gdb_detach(), gdb_fileio_reply(), gdb_get_register_packet(), gdb_get_registers_packet(), gdb_handle_vcont_packet(), gdb_handle_vrun_packet(), gdb_input_inner(), gdb_last_signal_packet(), gdb_memory_map(), gdb_output_con(), gdb_query_packet(), gdb_read_memory_packet(), gdb_read_smp_packet(), gdb_send_error(), gdb_set_register_packet(), gdb_set_registers_packet(), gdb_sig_halted(), gdb_signal_reply(), gdb_v_packet(), gdb_write_memory_binary_packet(), gdb_write_memory_packet(), gdb_write_smp_packet(), hwthread_thread_packet(), linux_gdb_h_packet(), linux_gdb_t_packet(), linux_gdb_thread_packet(), linux_gdb_thread_update(), linux_thread_extra_info(), linux_thread_packet(), rtos_put_gdb_reg_list(), rtos_qsymbol(), and rtos_thread_packet().
|
static |
Definition at line 404 of file gdb_server.c.
References buffer, check_pending(), gdb_connection::closed, gdb_connection::ctrl_c, ERROR_OK, ERROR_SERVER_REMOTE_CLOSED, gdb_get_char(), gdb_log_incoming_packet(), gdb_log_outgoing_packet(), GDB_OUTPUT_NO, gdb_putback_char(), gdb_write(), LOG_DEBUG, LOG_ERROR, LOG_WARNING, gdb_connection::noack_mode, gdb_connection::output_flag, and connection::priv.
Referenced by gdb_put_packet().
|
static |
Definition at line 322 of file gdb_server.c.
References gdb_connection::buf_cnt, gdb_connection::buf_p, gdb_connection::buffer, ERROR_OK, LOG_ERROR, and connection::priv.
Referenced by gdb_new_connection(), and gdb_put_packet_inner().
|
static |
Definition at line 2741 of file gdb_server.c.
References addr, alloc_printf(), buffer, cmd, connection::cmd_ctx, current_gdb_connection, command_context::current_target_override, decode_xfer_read(), ERROR_GDB_BUFFER_TOO_SMALL, ERROR_OK, ERROR_SERVER_REMOTE_CLOSED, flash_get_bank_count(), GDB_BUFFER_SIZE, gdb_error(), gdb_get_target_description_chunk(), gdb_get_thread_list_chunk(), gdb_memory_map(), GDB_OUTPUT_ALL, gdb_output_con(), GDB_OUTPUT_NO, GDB_OUTPUT_NOTIF, gdb_put_packet(), target_type::gdb_query_custom, gdb_send_error(), gdb_target_description_supported(), gdb_use_memory_map, gdb_use_target_description, get_target_from_connection(), hexify(), command_context::interp, length, LOG_ERROR, LOG_INFO, LOG_WARNING, gdb_connection::noack_mode, NULL, offset, gdb_connection::output_flag, connection::priv, size, target_call_timer_callbacks_now(), target_checksum_memory(), gdb_connection::target_desc, gdb_connection::thread_list, target::type, and unhexify().
Referenced by gdb_input_inner().
|
static |
Definition at line 1498 of file gdb_server.c.
References addr, buffer, ERROR_NOT_IMPLEMENTED, ERROR_OK, ERROR_SERVER_REMOTE_CLOSED, gdb_error(), gdb_put_packet(), gdb_report_data_abort, get_target_from_connection(), hexify(), LOG_DEBUG, LOG_ERROR, LOG_WARNING, NULL, target::rtos, rtos_read_buffer(), and target_read_buffer().
Referenced by gdb_input_inner().
|
inlinestatic |
Definition at line 1162 of file gdb_server.c.
References target::endianness, and TARGET_LITTLE_ENDIAN.
Referenced by gdb_str_to_target(), and gdb_target_to_reg().
int gdb_register_commands | ( | struct command_context * | cmd_ctx | ) |
Definition at line 4150 of file gdb_server.c.
References gdb_command_handlers, gdb_port, gdb_port_next, NULL, and register_commands().
Referenced by setup_command_handler().
|
static |
Definition at line 3188 of file gdb_server.c.
References gdb_connection::attached, breakpoint_clear_target(), connection::cmd_ctx, command_run_linef(), gdb_thread_packet(), get_target_from_connection(), connection::priv, target_name(), and watchpoint_clear_target().
Referenced by gdb_handle_vrun_packet(), and gdb_input_inner().
|
static |
Definition at line 1132 of file gdb_server.c.
References gdb_put_packet().
Referenced by gdb_error(), gdb_query_packet(), and gdb_v_packet().
void gdb_service_free | ( | void | ) |
Definition at line 4157 of file gdb_server.c.
References gdb_port, and gdb_port_next.
Referenced by openocd_main().
|
static |
Definition at line 1417 of file gdb_server.c.
References DIV_ROUND_UP, ERROR_OK, ERROR_SERVER_REMOTE_CLOSED, reg::exist, gdb_error(), gdb_put_packet(), gdb_report_register_access_error, gdb_target_to_reg(), get_target_from_connection(), reg::hidden, LOG_DEBUG, LOG_ERROR, name, REG_CLASS_ALL, target::rtos, rtos_set_reg(), reg_arch_type::set, size, target_get_gdb_reg_list_noread(), and reg::type.
Referenced by gdb_input_inner().
|
static |
Definition at line 1308 of file gdb_server.c.
References DIV_ROUND_UP, ERROR_OK, ERROR_SERVER_REMOTE_CLOSED, reg::exist, gdb_error(), gdb_put_packet(), gdb_report_register_access_error, gdb_target_to_reg(), get_target_from_connection(), reg::hidden, LOG_DEBUG, LOG_ERROR, LOG_WARNING, name, REG_CLASS_GENERAL, reg_arch_type::set, size, target_get_gdb_reg_list(), and reg::type.
Referenced by gdb_input_inner().
|
static |
Definition at line 3490 of file gdb_server.c.
References gdb_put_packet().
Referenced by gdb_handle_vcont_packet(), and gdb_input_inner().
|
static |
Definition at line 772 of file gdb_server.c.
References gdb_connection::ctrl_c, rtos::current_thread, rtos::current_threadid, DBG_REASON_EXIT, DBG_REASON_WATCHPOINT, target::debug_reason, ERROR_OK, gdb_connection::frontend_state, gdb_last_signal(), gdb_put_packet(), rtos::gdb_target_for_threadid, LOG_TARGET_DEBUG, connection::priv, target::rtos, rtos_update_threads(), target, TARGET_HALTED, TARGET_PRIxADDR, watchpoint_hit(), WPT_ACCESS, WPT_READ, and WPT_WRITE.
Referenced by gdb_frontend_halted(), and gdb_handle_vcont_packet().
|
static |
Definition at line 1703 of file gdb_server.c.
References ERROR_OK, gdb_running_type, get_target_from_connection(), LOG_DEBUG, NULL, target_resume(), and target_step().
Referenced by gdb_input_inner().
Definition at line 1179 of file gdb_server.c.
References DIV_ROUND_UP, gdb_reg_pos(), reg::size, and reg::value.
Referenced by gdb_get_reg_value_as_str().
int gdb_target_add_all | ( | struct target * | target | ) |
Definition at line 3907 of file gdb_server.c.
References ERROR_OK, gdb_target_add_one(), LOG_WARNING, and target::next.
Referenced by COMMAND_HANDLER().
|
static |
Definition at line 3851 of file gdb_server.c.
References alloc_printf(), ERROR_OK, gdb_port_next, target::gdb_port_override, target::gdb_service, gdb_target_start(), LOG_TARGET_DEBUG, LOG_TARGET_INFO, parse_long(), target::smp, and target_supports_gdb_connection().
Referenced by gdb_target_add_all().
|
static |
Definition at line 954 of file gdb_server.c.
References ERROR_OK, gdb_frontend_halted(), priv, service::priv, connection::service, gdb_service::target, target_call_event_callbacks(), TARGET_EVENT_GDB_END, TARGET_EVENT_GDB_HALT, and TARGET_EVENT_HALTED.
Referenced by gdb_connection_closed(), and gdb_new_connection().
|
static |
Definition at line 2597 of file gdb_server.c.
References ERROR_FAIL, ERROR_OK, get_reg_features_list(), LOG_ERROR, NULL, REG_CLASS_ALL, target_get_gdb_arch(), and target_get_gdb_reg_list_noread().
Referenced by gdb_query_packet().
|
static |
Definition at line 3822 of file gdb_server.c.
References add_service(), gdb_service::core, foreach_smp_target, target::gdb_max_connections, target::gdb_service, gdb_service_driver, LOG_TARGET_INFO, target::smp_targets, target, gdb_service::target, and target_list::target.
Referenced by gdb_target_add_one().
|
static |
Definition at line 1196 of file gdb_server.c.
References gdb_reg_pos(), and LOG_ERROR.
Referenced by gdb_set_register_packet(), and gdb_set_registers_packet().
|
static |
Definition at line 3245 of file gdb_server.c.
References addr, ERROR_FLASH_DST_OUT_OF_BANK, ERROR_OK, ERROR_SERVER_REMOTE_CLOSED, flash_erase_address_range(), flash_set_dirty(), flash_write(), gdb_flash_program, gdb_handle_vcont_packet(), gdb_handle_vrun_packet(), gdb_put_packet(), gdb_send_error(), get_target_from_connection(), image_add_section(), image_close(), image_open(), length, LOG_DEBUG, LOG_ERROR, NULL, connection::priv, target_call_event_callbacks(), TARGET_EVENT_GDB_FLASH_ERASE_END, TARGET_EVENT_GDB_FLASH_ERASE_START, TARGET_EVENT_GDB_FLASH_WRITE_END, TARGET_EVENT_GDB_FLASH_WRITE_START, and gdb_connection::vflash_image.
Referenced by gdb_input_inner().
|
static |
Definition at line 338 of file gdb_server.c.
References gdb_connection::closed, connection_write(), ERROR_OK, ERROR_SERVER_REMOTE_CLOSED, LOG_DEBUG, LOG_WARNING, and connection::priv.
Referenced by gdb_async_notif(), gdb_get_packet_inner(), and gdb_put_packet_inner().
|
static |
Definition at line 1624 of file gdb_server.c.
References addr, ERROR_FAIL, ERROR_NOT_IMPLEMENTED, ERROR_OK, ERROR_SERVER_REMOTE_CLOSED, gdb_error(), gdb_put_packet(), get_target_from_connection(), LOG_DEBUG, LOG_ERROR, gdb_connection::mem_write_error, connection::priv, target::rtos, rtos_write_buffer(), and target_write_buffer().
Referenced by gdb_input_inner().
|
static |
Definition at line 1573 of file gdb_server.c.
References addr, buffer, ERROR_NOT_IMPLEMENTED, ERROR_OK, ERROR_SERVER_REMOTE_CLOSED, gdb_error(), gdb_put_packet(), get_target_from_connection(), LOG_DEBUG, LOG_ERROR, target::rtos, rtos_write_buffer(), target_write_buffer(), and unhexify().
Referenced by gdb_input_inner().
|
static |
Definition at line 2248 of file gdb_server.c.
References ERROR_OK, feature, reg::feature, reg_feature::name, and NULL.
Referenced by gdb_generate_target_description(), and gdb_target_description_supported().
|
static |
Definition at line 2090 of file gdb_server.c.
References NULL.
Referenced by gdb_generate_reg_type_description(), and gdb_generate_target_description().
|
static |
Definition at line 3153 of file gdb_server.c.
References count, NULL, and unhexify().
Referenced by gdb_handle_vrun_packet().
|
static |
Definition at line 2291 of file gdb_server.c.
References ERROR_FAIL, ERROR_OK, reg::exist, foreach_smp_target, LOG_ERROR, LOG_TARGET_DEBUG, LOG_TARGET_WARNING, reg::name, NULL, REG_CLASS_ALL, reg::size, target::smp, target::smp_targets, target_list::target, target_get_gdb_reg_list_noread(), and target_was_examined().
Referenced by gdb_generate_target_description().
|
static |
Definition at line 110 of file gdb_server.c.
Referenced by COMMAND_HANDLER(), and gdb_query_packet().
|
static |
Definition at line 126 of file gdb_server.c.
Referenced by gdb_connection_closed(), gdb_get_actual_connections(), and gdb_new_connection().
|
static |
Definition at line 112 of file gdb_server.c.
Referenced by COMMAND_HANDLER(), and gdb_breakpoint_watchpoint_packet().
|
static |
Definition at line 112 of file gdb_server.c.
Referenced by COMMAND_HANDLER(), and gdb_breakpoint_watchpoint_packet().
|
static |
Definition at line 4019 of file gdb_server.c.
Referenced by gdb_register_commands().
|
static |
Definition at line 133 of file gdb_server.c.
Referenced by COMMAND_HANDLER(), and gdb_v_packet().
|
static |
Definition at line 116 of file gdb_server.c.
Referenced by COMMAND_HANDLER(), gdb_register_commands(), and gdb_service_free().
|
static |
Definition at line 117 of file gdb_server.c.
Referenced by COMMAND_HANDLER(), gdb_register_commands(), gdb_service_free(), and gdb_target_add_one().
|
static |
Definition at line 139 of file gdb_server.c.
Referenced by COMMAND_HANDLER(), and gdb_read_memory_packet().
|
static |
Definition at line 142 of file gdb_server.c.
Referenced by COMMAND_HANDLER(), gdb_get_register_packet(), gdb_get_registers_packet(), gdb_set_register_packet(), and gdb_set_registers_packet().
|
static |
Definition at line 150 of file gdb_server.c.
Referenced by gdb_fileio_response_packet(), gdb_handle_vcont_packet(), and gdb_step_continue_packet().
|
static |
Definition at line 3792 of file gdb_server.c.
Referenced by gdb_target_start().
|
static |
Definition at line 4019 of file gdb_server.c.
|
static |
Definition at line 131 of file gdb_server.c.
Referenced by COMMAND_HANDLER(), gdb_new_connection(), and gdb_query_packet().
|
static |
Definition at line 147 of file gdb_server.c.
Referenced by COMMAND_HANDLER(), and gdb_query_packet().