summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
434f570)
Use a separate variable for iterating GDB service port numbers than
the one set by the user. Restores the behavior of returning the
original port number and only incrementing the port used on success.
extern int gdb_error(struct connection *connection, int retval);
static unsigned short gdb_port = 3333;
extern int gdb_error(struct connection *connection, int retval);
static unsigned short gdb_port = 3333;
+static unsigned short gdb_port_next = 0;
static const char *DIGITS = "0123456789abcdef";
static void gdb_log_callback(void *priv, const char *file, unsigned line,
static const char *DIGITS = "0123456789abcdef";
static void gdb_log_callback(void *priv, const char *file, unsigned line,
LOG_INFO("gdb port disabled");
return ERROR_OK;
}
LOG_INFO("gdb port disabled");
return ERROR_OK;
}
+ if (0 == gdb_port_next)
+ gdb_port_next = gdb_port;
bool use_pipes = server_use_pipes;
static bool server_started_with_pipes = false;
bool use_pipes = server_use_pipes;
static bool server_started_with_pipes = false;
- int e = gdb_target_start(target, use_pipes ? 0 : gdb_port++);
+ int e = gdb_target_start(target, use_pipes ? 0 : gdb_port_next);
server_started_with_pipes |= use_pipes;
server_started_with_pipes |= use_pipes;
/* daemon configuration command gdb_port */
COMMAND_HANDLER(handle_gdb_port_command)
{
/* daemon configuration command gdb_port */
COMMAND_HANDLER(handle_gdb_port_command)
{
- return CALL_COMMAND_HANDLER(server_port_command, &gdb_port);
+ int retval = CALL_COMMAND_HANDLER(server_port_command, &gdb_port);
+ if (ERROR_OK == retval)
+ gdb_port_next = gdb_port;
+ return retval;
}
COMMAND_HANDLER(handle_gdb_memory_map_command)
}
COMMAND_HANDLER(handle_gdb_memory_map_command)