Permalink
Browse files

Initial breakpoints, step, and continue for gdbserver. Plus *started*…

… talking to GDB (#7679)

* GDB doesn't crash when connecting to us anymore

* Added initial support for breakpoints, step, continue to gdbserver
  • Loading branch information...
SrimantaBarua authored and radare committed Jun 4, 2017
1 parent 3fd5112 commit ad764839b20818d629131d4e07bda0038f9d747f
Showing with 298 additions and 8 deletions.
  1. +33 −3 libr/core/rtr.c
  2. +265 −5 shlr/gdb/src/gdbserver/core.c
View
@@ -899,6 +899,7 @@ static int r_core_rtr_gdb_cb(void *core_ptr, const char *cmd, char *out_buf, siz
ut64 reg_value;
utX reg_value_big;
ut64 m_off;
RDebugPid *dbgpid;
if (!core_ptr || ! cmd) {
return -1;
}
@@ -912,9 +913,36 @@ static int r_core_rtr_gdb_cb(void *core_ptr, const char *cmd, char *out_buf, siz
// TODO support multiprocess
snprintf (out_buf, max_len - 1, "QC%x", core->dbg->tid);
return 0;
case 't': // dpt
r_core_cmd (core, cmd, 0);
return 0;
case 't':
switch (cmd[3]) {
case '\0': // dpt
if (!core->dbg->h->threads) {
return -1;
}
if (!(list = core->dbg->h->threads(core->dbg, core->dbg->pid))) {
return -1;
}
memset (out_buf, 0, max_len);
out_buf[0] = 'm';
ret = 1;
r_list_foreach (list, iter, dbgpid) {
// Max length of a hex pid = 8?
if (ret >= max_len - 9) {
break;
}
snprintf (out_buf + ret, max_len - ret - 1, "%x,", dbgpid->pid);
ret = strlen (out_buf);
}
if (ret > 1) {
ret--;
out_buf[ret] = '\0';
}
return 0;
case 'r': // dptr -> return current tid as int
return core->dbg->tid;
default:
return r_core_cmd (core, cmd, 0);
}
}
break;
case 'r': // dr
@@ -976,6 +1004,8 @@ static int r_core_rtr_gdb_cb(void *core_ptr, const char *cmd, char *out_buf, siz
}
}
return ret;
default:
return r_core_cmd (core, cmd, 0);
}
break;
case 'm':
Oops, something went wrong.

0 comments on commit ad76483

Please sign in to comment.