Attach pid

This commit is contained in:
SrimantaBarua 2017-06-23 01:59:57 +05:30 committed by Anton Kochkov
parent ec6ac26e8b
commit 9651b6a997
2 changed files with 6 additions and 2 deletions

View file

@ -120,8 +120,10 @@ static RIODesc *__open(RIO *io, const char *file, int rw, int mode) {
eprintf ("gdbr: Failed to attach to PID %i\n", i_pid);
return NULL;
}
} else if ((pid = desc->pid) <= 0) {
pid = -1;
}
riogdb = r_io_desc_new (&r_io_plugin_gdb, riog->desc.sock->fd, file, rw, mode, riog);
riogdb = r_io_desc_new (&r_io_plugin_gdb, pid, file, rw, mode, riog);
return riogdb;
}
eprintf ("gdb.io.open: Cannot connect to host.\n");

View file

@ -96,9 +96,11 @@ int handle_qC(libgdbr_t *g) {
t1++;
g->pid = (int) strtol (t1, NULL, 16);
t2++;
g->tid = (int) strtol (t2, NULL, 16);
return send_ack (g);
}
}
g->tid = (int) strtol (t2, NULL, 16);
g->pid = g->tid = (int) strtol (t2, NULL, 16);
return send_ack (g);
}