aboutsummaryrefslogtreecommitdiff
path: root/src/server/gdb_server.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/gdb_server.c')
-rw-r--r--src/server/gdb_server.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/server/gdb_server.c b/src/server/gdb_server.c
index c6c74c2..a5f4acb 100644
--- a/src/server/gdb_server.c
+++ b/src/server/gdb_server.c
@@ -967,15 +967,6 @@ static int gdb_new_connection(struct connection *connection)
breakpoint_clear_target(target);
watchpoint_clear_target(target);
- if (target->rtos) {
- /* clean previous rtos session if supported*/
- if (target->rtos->type->clean)
- target->rtos->type->clean(target);
-
- /* update threads */
- rtos_update_threads(target);
- }
-
/* remove the initial ACK from the incoming buffer */
retval = gdb_get_char(connection, &initial_ack);
if (retval != ERROR_OK)
@@ -988,6 +979,15 @@ static int gdb_new_connection(struct connection *connection)
gdb_putback_char(connection, initial_ack);
target_call_event_callbacks(target, TARGET_EVENT_GDB_ATTACH);
+ if (target->rtos) {
+ /* clean previous rtos session if supported*/
+ if (target->rtos->type->clean)
+ target->rtos->type->clean(target);
+
+ /* update threads */
+ rtos_update_threads(target);
+ }
+
if (gdb_use_memory_map) {
/* Connect must fail if the memory map can't be set up correctly.
*
@@ -1187,7 +1187,7 @@ static int gdb_get_registers_packet(struct connection *connection,
return gdb_error(connection, retval);
for (i = 0; i < reg_list_size; i++) {
- if (reg_list[i] == NULL || reg_list[i]->exist == false)
+ if (reg_list[i] == NULL || reg_list[i]->exist == false || reg_list[i]->hidden)
continue;
reg_packet_size += DIV_ROUND_UP(reg_list[i]->size, 8) * 2;
}
@@ -1201,7 +1201,7 @@ static int gdb_get_registers_packet(struct connection *connection,
reg_packet_p = reg_packet;
for (i = 0; i < reg_list_size; i++) {
- if (reg_list[i] == NULL || reg_list[i]->exist == false)
+ if (reg_list[i] == NULL || reg_list[i]->exist == false || reg_list[i]->hidden)
continue;
if (!reg_list[i]->valid) {
retval = reg_list[i]->type->get(reg_list[i]);
@@ -1330,7 +1330,7 @@ static int gdb_get_register_packet(struct connection *connection,
}
}
- reg_packet = malloc(DIV_ROUND_UP(reg_list[reg_num]->size, 8) * 2 + 1); /* plus one for string termination null */
+ reg_packet = calloc(DIV_ROUND_UP(reg_list[reg_num]->size, 8) * 2 + 1, 1); /* plus one for string termination null */
gdb_str_to_target(target, reg_packet, reg_list[reg_num]);
@@ -2187,7 +2187,7 @@ static int get_reg_features_list(struct target *target, char const **feature_lis
*feature_list = calloc(1, sizeof(char *));
for (int i = 0; i < reg_list_size; i++) {
- if (reg_list[i]->exist == false)
+ if (reg_list[i]->exist == false || reg_list[i]->hidden)
continue;
if (reg_list[i]->feature != NULL
@@ -2353,7 +2353,7 @@ static int gdb_generate_target_description(struct target *target, char **tdesc_o
int i;
for (i = 0; i < reg_list_size; i++) {
- if (reg_list[i]->exist == false)
+ if (reg_list[i]->exist == false || reg_list[i]->hidden)
continue;
if (strcmp(reg_list[i]->feature->name, features[current_feature]))
@@ -2600,7 +2600,7 @@ static int gdb_get_thread_list_chunk(struct target *target, char **thread_list,
transfer_type = 'l';
*chunk = malloc(length + 2 + 3);
- /* Allocating extra 3 bytes prevents false positive valgrind report
+ /* Allocating extra 3 bytes prevents false positive valgrind report
* of strlen(chunk) word access:
* Invalid read of size 4
* Address 0x4479934 is 44 bytes inside a block of size 45 alloc'd */
@@ -3614,8 +3614,8 @@ static int gdb_target_start(struct target *target, const char *port)
target->gdb_service = gdb_service;
ret = add_service("gdb",
- port, 1, &gdb_new_connection, &gdb_input,
- &gdb_connection_closed, gdb_service);
+ port, target->gdb_max_connections, &gdb_new_connection, &gdb_input,
+ &gdb_connection_closed, gdb_service, NULL);
/* initialize all targets gdb service with the same pointer */
{
struct target_list *head;