fix gdb covs (#8036)

This commit is contained in:
Srimanta Barua 2017-07-26 23:50:07 +05:30 committed by radare
parent abaac71290
commit 277771156c
2 changed files with 18 additions and 30 deletions

View File

@ -1211,39 +1211,27 @@ static int r_core_rtr_gdb_run(RCore *core, int launch, const char *path) {
debug_msg = true;
path++;
}
while (*path && isspace (*path)) {
path++;
}
if (!*path) {
if (!(path = r_str_chop_ro (path)) || !*path) {
eprintf ("gdbserver: Port not specified\n");
return -1;
}
if (path && (p = atoi (path))) {
if (p < 0 || p > 65535) {
eprintf ("gdbserver: Invalid port: %s\n", port);
return -1;
}
snprintf (port, sizeof (port) - 1, "%d", p);
if (!(file = strchr (path, ' '))) {
eprintf ("gdbserver: File not specified\n");
return -1;
}
while (isspace (*file)) {
file++;
}
if (!*file) {
eprintf ("gdbserver: File not specified\n");
return -1;
}
if (!(p = atoi (path)) || p < 0 || p > 65535) {
eprintf ("gdbserver: Invalid port: %s\n", port);
return -1;
}
if (file) {
args = strchr (file, ' ');
if (args) {
*args++ = '\0';
while (isspace (*args)) {
args++;
}
} else {
snprintf (port, sizeof (port) - 1, "%d", p);
if (!(file = strchr (path, ' '))) {
eprintf ("gdbserver: File not specified\n");
return -1;
}
if (!(file = r_str_chop_ro (file)) || !*file) {
eprintf ("gdbserver: File not specified\n");
return -1;
}
args = strchr (file, ' ');
if (args) {
*args++ = '\0';
if (!(args = r_str_chop_ro (args))) {
args = "";
}
} else {

View File

@ -1046,7 +1046,7 @@ int gdbr_send_qRcmd(libgdbr_t *g, const char *cmd) {
if (!(buf = calloc (len, sizeof (char)))) {
return -1;
}
strncpy (buf, "qRcmd,", 6);
strcpy (buf, "qRcmd,");
pack_hex (cmd, strlen (cmd), buf + 6);
if (send_msg (g, buf) < 0) {
free (buf);