/** @addtogroup sctrace
* @{
*/
/** @file
*/
#include <stdio.h>
#include <syscall.h>
#include <ipc/ipc.h>
#include <udebug.h>
#include "debug_api.h"
int debug_begin(unsigned phoneid)
{
return ipc_call_sync_1_0(phoneid, IPC_M_DEBUG_ALL, UDEBUG_M_BEGIN);
}
int debug_thread_read(unsigned phoneid, void *buffer, unsigned n,
unsigned *copied, unsigned *needed)
{
printf("send IPC_M_DEBUG_THREAD_READ message\n");
return ipc_call_sync_3_2(phoneid, IPC_M_DEBUG_ALL, UDEBUG_M_THREAD_READ,
(sysarg_t)buffer, n, copied, needed);
}
int debug_mem_read(unsigned phoneid, void *buffer, unsigned addr, unsigned n)
{
return ipc_call_sync_4_0(phoneid, IPC_M_DEBUG_ALL, UDEBUG_M_MEM_READ,
(sysarg_t)buffer, addr, n);
}
int debug_args_read(unsigned phoneid, unsigned tid, unsigned *buffer)
{
unsigned copied;
int rc;
rc = ipc_call_sync_4_1(phoneid, IPC_M_DEBUG_ALL, UDEBUG_M_ARGS_READ,
tid, (sysarg_t)buffer, 6 * sizeof(unsigned), &copied);
if (copied != 6 * sizeof(unsigned)) {
printf("Warning: read %d bytes from syscall args instead of 24!\n",
copied);
}
return rc;
}
int debug_go(unsigned phoneid, unsigned tid, unsigned *ev_type,
unsigned *sc_id, unsigned *sc_rc)
{
/* Run thread until a syscall is executed */
return ipc_call_sync_2_3(phoneid, IPC_M_DEBUG_ALL, UDEBUG_M_GO,
tid, (sysarg_t)ev_type, (sysarg_t)sc_id, (sysarg_t)sc_rc);
}
/** @}
*/