2010-03-05 01:49:12 +01:00
|
|
|
/* radare - LGPL - Copyright 2009-2010 pancake<nopcode.org> */
|
2009-04-01 22:44:43 +00:00
|
|
|
|
|
|
|
#include <r_debug.h>
|
|
|
|
|
2010-03-05 01:49:12 +01:00
|
|
|
R_API RDebugPid *r_debug_pid_new(char *path, int pid, char status) {
|
|
|
|
RDebugPid *p = R_NEW (RDebugPid);
|
|
|
|
p->path = strdup (path);
|
|
|
|
p->pid = pid;
|
|
|
|
p->status = status;
|
|
|
|
p->runnable = R_TRUE;
|
|
|
|
return p;
|
|
|
|
}
|
|
|
|
|
|
|
|
R_API RDebugPid *r_debug_pid_free(RDebugPid *pid) {
|
|
|
|
//free (pid->path);
|
|
|
|
//free (pid);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
R_API int r_debug_pid_list(struct r_debug_t *dbg, int pid) {
|
|
|
|
RList *list;
|
|
|
|
RListIter *iter;
|
|
|
|
if (dbg && dbg->h && dbg->h->pids) {
|
|
|
|
list = dbg->h->pids (pid);
|
|
|
|
if (list == NULL)
|
|
|
|
return R_FALSE;
|
|
|
|
iter = r_list_iterator (list);
|
|
|
|
while (r_list_iter_next (iter)) {
|
|
|
|
RDebugPid *p = r_list_iter_get (iter);
|
|
|
|
eprintf (" %d %c %s\n", p->pid, p->status, p->path);
|
|
|
|
}
|
|
|
|
r_list_free (list);
|
|
|
|
}
|
|
|
|
return R_FALSE;
|
2009-04-01 22:44:43 +00:00
|
|
|
}
|
|
|
|
|
2010-03-11 00:29:36 +01:00
|
|
|
R_API int r_debug_thread_list(struct r_debug_t *dbg, int pid) {
|
|
|
|
RList *list;
|
|
|
|
RListIter *iter;
|
|
|
|
if (dbg && dbg->h && dbg->h->pids) {
|
|
|
|
list = dbg->h->threads (pid);
|
|
|
|
if (list == NULL)
|
|
|
|
return R_FALSE;
|
|
|
|
iter = r_list_iterator (list);
|
|
|
|
while (r_list_iter_next (iter)) {
|
|
|
|
RDebugPid *p = r_list_iter_get (iter);
|
|
|
|
eprintf (" %d %c %s\n", p->pid, p->status, p->path);
|
|
|
|
}
|
|
|
|
r_list_free (list);
|
|
|
|
}
|
|
|
|
return R_FALSE;
|
|
|
|
}
|
|
|
|
|
2009-04-01 22:44:43 +00:00
|
|
|
/* processes */
|
2010-03-02 11:18:49 +01:00
|
|
|
R_API int r_debug_pid_parent(RDebugPid *pid) {
|
2009-09-10 20:51:34 +00:00
|
|
|
// fork in child
|
|
|
|
return 0;
|
2009-04-01 22:44:43 +00:00
|
|
|
}
|
|
|
|
|
2010-03-05 01:49:12 +01:00
|
|
|
#if 0
|
2010-03-02 11:18:49 +01:00
|
|
|
R_API int r_debug_pid_del(struct r_debug_t *dbg) {
|
2009-09-10 20:51:34 +00:00
|
|
|
// kill da child
|
2009-04-01 22:44:43 +00:00
|
|
|
return R_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* threads */
|
2010-03-02 11:18:49 +01:00
|
|
|
R_API int r_debug_pid_add_thread(struct r_debug_t *dbg) {
|
2009-09-10 20:51:34 +00:00
|
|
|
// create a thread in process
|
2009-04-01 22:44:43 +00:00
|
|
|
return R_TRUE;
|
|
|
|
}
|
|
|
|
|
2010-03-02 11:18:49 +01:00
|
|
|
R_API int r_debug_pid_del_thread(struct r_debug_t *dbg) {
|
2009-09-10 20:51:34 +00:00
|
|
|
// kill a thread in process
|
2009-04-01 22:44:43 +00:00
|
|
|
return R_TRUE;
|
|
|
|
}
|
2010-03-05 01:49:12 +01:00
|
|
|
#endif
|
2009-04-01 22:44:43 +00:00
|
|
|
|
|
|
|
/* status */
|
2010-03-02 11:18:49 +01:00
|
|
|
R_API int r_debug_pid_set_state(struct r_debug_t *dbg, int status) {
|
2009-04-01 22:44:43 +00:00
|
|
|
return R_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* status */
|
2010-03-02 11:18:49 +01:00
|
|
|
R_API struct r_debug_pid_t *r_debug_pid_get_status(struct r_debug_t *dbg, int pid) {
|
2009-04-01 22:44:43 +00:00
|
|
|
return NULL;
|
|
|
|
}
|