15 g->data_len =
g->data_len / 2;
28 if (
g->data_len == 0) {
37 if (
g->data_len == 3 &&
g->data[0] ==
'E') {
42 int len = strlen(
g->data);
43 g->data_len =
len / 2;
49 if (!
g || !
g->data || !*
g->data) {
53 char *tok = strtok(data,
";");
59 if (strncmp(tok,
"T0", 2)) {
66 if (!strncmp(tok,
"tnotrun:0", 9)) {
70 tok = strtok(
NULL,
";");
79 if (strncmp(
g->data,
"QC", 2)) {
83 g->data[
g->data_len] =
'\0';
84 if (
read_thread_id(
g->data + 2, &
g->pid, &
g->tid,
g->stub_features.multiprocess) < 0) {
125 if (
g->data_len == 3 &&
g->data[0] ==
'E') {
133 if (
g->data_len < 2 ||
g->data[0] !=
'F' ||
g->data[1] ==
'-' || !
isxdigit(
g->data[1])) {
137 g->data[
g->data_len] =
'\0';
138 if ((
g->remote_file_fd = strtol(
g->data + 1,
NULL, 16)) <= 0) {
149 if (
g->data_len < 3 ||
g->data[0] !=
'F') {
154 if (
g->data[1] ==
'-') {
160 if (sscanf(
g->data,
"F%x;", &
len) != 1) {
167 if (!(ptr = strchr(
g->data,
';')) || ptr >=
g->data +
g->data_len) {
178 if (
g->data_len < 2 ||
g->data[0] !=
'F' ||
g->data[1] ==
'-' || !
isxdigit(
g->data[1])) {
191 if (
g->stub_features.multiprocess &&
g->data_len > 3) {
192 if (sscanf(
g->data + 1,
"%x;process:%x", &
status, &
pid) != 2) {
193 eprintf(
"Message from remote: %s\n",
g->data);
197 g->stop_reason.thread.pid =
pid;
198 g->stop_reason.thread.tid =
pid;
199 g->stop_reason.is_valid =
true;
203 eprintf(
"Message from remote: %s\n",
g->data);
208 g->stop_reason.thread.pid =
pid;
209 g->stop_reason.thread.tid =
pid;
210 g->stop_reason.is_valid =
true;
218 if (
g->stub_features.multiprocess &&
g->data_len > 3) {
219 if (sscanf(
g->data + 1,
"%x;process:%x", &
signal, &
pid) != 2) {
220 eprintf(
"Message from remote: %s\n",
g->data);
224 g->stop_reason.thread.pid =
pid;
225 g->stop_reason.thread.tid =
pid;
226 g->stop_reason.signum =
signal;
227 g->stop_reason.is_valid =
true;
231 eprintf(
"Message from remote: %s\n",
g->data);
235 eprintf(
"Process %d terminated with signal %d\n",
g->pid,
signal);
236 g->stop_reason.thread.pid =
pid;
237 g->stop_reason.thread.tid =
pid;
238 g->stop_reason.signum =
signal;
239 g->stop_reason.is_valid =
true;
246 if (
g->data_len < 3) {
249 switch (
g->data[0]) {
258 g->stop_reason.signum = -1;
266 if (
g->data[0] !=
'T') {
270 g->data[
g->data_len] =
'\0';
271 free(
g->stop_reason.exec.path);
273 g->stop_reason.core = -1;
274 if (sscanf(
g->data + 1,
"%02x", &
g->stop_reason.signum) != 1) {
277 g->stop_reason.is_valid =
true;
279 for (ptr1 = strtok(
g->data + 3,
";"); ptr1; ptr1 = strtok(
NULL,
";")) {
281 if (!(ptr2 = strchr(ptr1,
':'))) {
286 &
g->stop_reason.thread.tid,
287 g->stub_features.multiprocess) < 0) {
290 g->stop_reason.thread.present =
true;
294 if (!(ptr2 = strchr(ptr1,
':'))) {
301 g->stop_reason.core = (
int)strtol(ptr2,
NULL, 16);
304 if (
g->stop_reason.signum == 5) {
306 if (!(ptr2 = strchr(ptr1,
':'))) {
313 g->stop_reason.watchpoint.addr = strtoll(ptr2,
NULL, 16);
314 g->stop_reason.watchpoint.present =
true;
318 if (!(ptr2 = strchr(ptr1,
':'))) {
322 if (!(
g->stop_reason.exec.path =
calloc(strlen(ptr1) / 2, 1))) {
325 unpack_hex(ptr2, strlen(ptr2),
g->stop_reason.exec.path);
326 g->stop_reason.exec.present =
true;
330 if (!(ptr2 = strchr(ptr1,
':'))) {
335 &
g->stop_reason.fork.tid,
336 g->stub_features.multiprocess) < 0) {
339 g->stop_reason.fork.present =
true;
343 if (!(ptr2 = strchr(ptr1,
':'))) {
348 &
g->stop_reason.vfork.tid,
349 g->stub_features.multiprocess) < 0) {
352 g->stop_reason.vfork.present =
true;
356 g->stop_reason.vforkdone =
true;
360 g->stop_reason.library =
true;
364 g->stop_reason.swbreak =
true;
368 g->stop_reason.hwbreak =
true;
372 g->stop_reason.create =
true;
377 if (
g->stop_reason.signum == 5) {
391 char *ptr, *ptr2, *
buf;
392 size_t regnum, tot_regs,
buflen = 0;
395 for (regnum = 0; *
g->registers[regnum].name; regnum++) {
396 if (
g->registers[regnum].offset +
g->registers[regnum].size >
buflen) {
397 buflen =
g->registers[regnum].offset +
g->registers[regnum].size;
406 if (!(ptr = strtok(
g->data,
";"))) {
412 ptr = strtok(
NULL,
";");
416 regnum = (
int)strtoul(ptr,
NULL, 16);
417 if (regnum >= tot_regs || !(ptr2 = strchr(ptr,
':'))) {
418 ptr = strtok(
NULL,
";");
423 unpack_hex(ptr2, strlen(ptr2),
buf +
g->registers[regnum].offset);
424 ptr = strtok(
NULL,
";");
int gdbr_disconnect(libgdbr_t *g)
disconnects the lib
int send_ack(libgdbr_t *g)
Functions sends a single ack ('+')
RZ_API void Ht_() free(HtName_(Ht) *ht)
return memset(p, 0, total)
memcpy(mem, inblock.get(), min(CONTAINING_RECORD(inblock.get(), MEMBLOCK, data) ->size, size))
#define MSG_NOT_SUPPORTED
void * calloc(size_t number, size_t size)
static static fork const void static count static fd const char const char static newpath char char char static envp time_t static t const char static mode static whence const char static dir time_t static t unsigned static seconds const char struct utimbuf static buf static inc pid
return strdup("=SP r13\n" "=LR r14\n" "=PC r15\n" "=A0 r0\n" "=A1 r1\n" "=A2 r2\n" "=A3 r3\n" "=ZF zf\n" "=SF nf\n" "=OF vf\n" "=CF cf\n" "=SN or0\n" "gpr lr .32 56 0\n" "gpr pc .32 60 0\n" "gpr cpsr .32 64 0 ____tfiae_________________qvczn\n" "gpr or0 .32 68 0\n" "gpr tf .1 64.5 0 thumb\n" "gpr ef .1 64.9 0 endian\n" "gpr jf .1 64.24 0 java\n" "gpr qf .1 64.27 0 sticky_overflow\n" "gpr vf .1 64.28 0 overflow\n" "gpr cf .1 64.29 0 carry\n" "gpr zf .1 64.30 0 zero\n" "gpr nf .1 64.31 0 negative\n" "gpr itc .4 64.10 0 if_then_count\n" "gpr gef .4 64.16 0 great_or_equal\n" "gpr r0 .32 0 0\n" "gpr r1 .32 4 0\n" "gpr r2 .32 8 0\n" "gpr r3 .32 12 0\n" "gpr r4 .32 16 0\n" "gpr r5 .32 20 0\n" "gpr r6 .32 24 0\n" "gpr r7 .32 28 0\n" "gpr r8 .32 32 0\n" "gpr r9 .32 36 0\n" "gpr r10 .32 40 0\n" "gpr r11 .32 44 0\n" "gpr r12 .32 48 0\n" "gpr r13 .32 52 0\n" "gpr r14 .32 56 0\n" "gpr r15 .32 60 0\n" "gpr r16 .32 64 0\n" "gpr r17 .32 68 0\n")
static static fork const void static count static fd const char static mode const char static pathname const char static path const char static dev const char static group static getpid static getuid void void static data static pause const char static mode static sync const char const char static newpath const char static pathname unsigned long static filedes void static end_data_segment signal
static const char struct stat static buf struct stat static buf static vhangup int status
static int stop_reason_exit(libgdbr_t *g)
int handle_G(libgdbr_t *g)
int handle_qStatus(libgdbr_t *g)
int handle_M(libgdbr_t *g)
int handle_lldb_read_reg(libgdbr_t *g)
int handle_vFile_pread(libgdbr_t *g, ut8 *buf)
int handle_m(libgdbr_t *g)
int handle_vFile_close(libgdbr_t *g)
int handle_setbp(libgdbr_t *g)
int handle_cont(libgdbr_t *g)
int handle_stop_reason(libgdbr_t *g)
int handle_g(libgdbr_t *g)
int handle_removebp(libgdbr_t *g)
int handle_attach(libgdbr_t *g)
int handle_vFile_open(libgdbr_t *g)
static int stop_reason_terminated(libgdbr_t *g)
int handle_qC(libgdbr_t *g)
int handle_P(libgdbr_t *g)
@ RZ_DEBUG_REASON_BREAKPOINT
RZ_API bool rz_str_startswith(RZ_NONNULL const char *str, RZ_NONNULL const char *needle)
Checks if a string starts with a specifc sequence of characters (case sensitive)
int unpack_hex(const char *src, ut64 len, char *dst)
int read_thread_id(const char *src, int *pid, int *tid, bool multiprocess)