Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 3453 → Rev 3454

/trunk/uspace/app/trace/trace.c
55,8 → 55,8
#include "trace.h"
 
#define THBUF_SIZE 64
unsigned thread_hash_buf[THBUF_SIZE];
unsigned n_threads;
uintptr_t thread_hash_buf[THBUF_SIZE];
int n_threads;
 
int next_thread_id;
 
63,10 → 63,10
int phoneid;
int abort_trace;
 
unsigned thash;
uintptr_t thash;
volatile int paused;
 
void thread_trace_start(unsigned thread_hash);
void thread_trace_start(uintptr_t thread_hash);
 
static proto_t *proto_console;
static task_id_t task_id;
125,13 → 125,13
return rc;
}
 
n_threads = tb_copied / sizeof(unsigned);
n_threads = tb_copied / sizeof(uintptr_t);
 
printf("Threads:");
for (i = 0; i < n_threads; i++) {
printf(" [%d] (hash 0x%x)", 1+i, thread_hash_buf[i]);
printf(" [%d] (hash 0x%lx)", 1+i, thread_hash_buf[i]);
}
printf("\ntotal of %u threads\n", tb_needed/sizeof(unsigned));
printf("\ntotal of %u threads\n", tb_needed / sizeof(uintptr_t));
 
return 0;
}
196,22 → 196,22
putchar('\n');
}
 
static void print_sc_args(unsigned *sc_args, int n)
static void print_sc_args(sysarg_t *sc_args, int n)
{
int i;
 
putchar('(');
if (n > 0) printf("%d", sc_args[0]);
if (n > 0) printf("%ld", sc_args[0]);
for (i = 1; i < n; i++) {
printf(", %d", sc_args[i]);
printf(", %ld", sc_args[i]);
}
putchar(')');
}
 
static void sc_ipc_call_async_fast(unsigned *sc_args, int sc_rc)
static void sc_ipc_call_async_fast(sysarg_t *sc_args, sysarg_t sc_rc)
{
ipc_call_t call;
int phoneid;
ipcarg_t phoneid;
if (sc_rc == IPC_CALLRET_FATAL || sc_rc == IPC_CALLRET_TEMPORARY)
return;
228,7 → 228,7
ipcp_call_out(phoneid, &call, sc_rc);
}
 
static void sc_ipc_call_async_slow(unsigned *sc_args, int sc_rc)
static void sc_ipc_call_async_slow(sysarg_t *sc_args, sysarg_t sc_rc)
{
ipc_call_t call;
int rc;
244,7 → 244,7
}
}
 
static void sc_ipc_call_sync_fast(unsigned *sc_args)
static void sc_ipc_call_sync_fast(sysarg_t *sc_args)
{
ipc_call_t question, reply;
int rc;
272,7 → 272,7
ipcp_call_sync(phoneidx, &question, &reply);
}
 
static void sc_ipc_call_sync_slow(unsigned *sc_args)
static void sc_ipc_call_sync_slow(sysarg_t *sc_args)
{
ipc_call_t question, reply;
int rc;
290,7 → 290,7
ipcp_call_sync(sc_args[0], &question, &reply);
}
 
static void sc_ipc_wait(unsigned *sc_args, int sc_rc)
static void sc_ipc_wait(sysarg_t *sc_args, int sc_rc)
{
ipc_call_t call;
int rc;
307,9 → 307,10
}
}
 
static void event_syscall_b(unsigned thread_id, unsigned thread_hash, unsigned sc_id, int sc_rc)
static void event_syscall_b(unsigned thread_id, uintptr_t thread_hash,
unsigned sc_id, sysarg_t sc_rc)
{
unsigned sc_args[6];
sysarg_t sc_args[6];
int rc;
 
/* Read syscall arguments */
334,9 → 335,10
async_serialize_end();
}
 
static void event_syscall_e(unsigned thread_id, unsigned thread_hash, unsigned sc_id, int sc_rc)
static void event_syscall_e(unsigned thread_id, uintptr_t thread_hash,
unsigned sc_id, sysarg_t sc_rc)
{
unsigned sc_args[6];
sysarg_t sc_args[6];
int rv_type;
int rc;
 
382,10 → 384,10
async_serialize_end();
}
 
static void event_thread_b(unsigned hash)
static void event_thread_b(uintptr_t hash)
{
async_serialize_start();
printf("New thread, hash 0x%x\n", hash);
printf("New thread, hash 0x%lx\n", hash);
async_serialize_end();
 
thread_trace_start(hash);
395,14 → 397,14
{
int rc;
unsigned ev_type;
unsigned thread_hash;
uintptr_t thread_hash;
unsigned thread_id;
unsigned val0, val1;
sysarg_t val0, val1;
 
thread_hash = (unsigned)thread_hash_arg;
thread_hash = (uintptr_t)thread_hash_arg;
thread_id = next_thread_id++;
 
printf("Start tracing thread [%d] (hash 0x%x)\n", thread_id, thread_hash);
printf("Start tracing thread [%d] (hash 0x%lx)\n", thread_id, thread_hash);
 
while (!abort_trace) {
 
438,7 → 440,7
event_thread_b(val0);
break;
case UDEBUG_EVENT_THREAD_E:
printf("Thread 0x%x exited\n", val0);
printf("Thread 0x%lx exited\n", val0);
abort_trace = 1;
break;
default:
453,7 → 455,7
return 0;
}
 
void thread_trace_start(unsigned thread_hash)
void thread_trace_start(uintptr_t thread_hash)
{
fid_t fid;
 
672,7 → 674,7
}
 
if (task_id != 0) {
if (argc == 0) return;
if (argc == 0) return 0;
printf("Extra arguments\n");
print_syntax();
return -1;
/trunk/uspace/app/trace/ipcp.c
44,11 → 44,11
#define IPCP_CALLID_SYNC 0
 
typedef struct {
int phone_hash;
ipcarg_t phone_hash;
ipc_call_t question;
oper_t *oper;
 
int call_hash;
ipc_callid_t call_hash;
 
link_t link;
} pending_call_t;
97,6 → 97,7
// printf("pending_call_compare\n");
hs = hash_table_get_instance(item, pending_call_t, link);
 
// FIXME: this will fail if sizeof(long) < sizeof(void *).
return key[0] == hs->call_hash;
}
 
134,11 → 135,11
}
 
if (oper != NULL) {
printf("%s (%d)", oper->name, method);
printf("%s (%ld)", oper->name, method);
return;
}
 
printf("%d", method);
printf("%ld", method);
}
 
void ipcp_init(void)
198,10 → 199,10
args = call->args;
 
if ((display_mask & DM_IPC) != 0) {
printf("Call ID: 0x%x, phone: %d, proto: %s, method: ", hash,
printf("Call ID: 0x%lx, phone: %d, proto: %s, method: ", hash,
phone, (proto ? proto->name : "n/a"));
ipc_m_print(proto, IPC_GET_METHOD(*call));
printf(" args: (%u, %u, %u, %u, %u)\n", args[1], args[2],
printf(" args: (%lu, %lu, %lu, %lu, %lu)\n", args[1], args[2],
args[3], args[4], args[5]);
}
 
257,10 → 258,10
static void parse_answer(ipc_callid_t hash, pending_call_t *pcall,
ipc_call_t *answer)
{
int phone;
ipcarg_t phone;
ipcarg_t method;
ipcarg_t service;
int retval;
ipcarg_t retval;
proto_t *proto;
int cphone;
 
277,7 → 278,7
resp = answer->args;
 
if ((display_mask & DM_IPC) != 0) {
printf("Response to 0x%x: retval=%d, args = (%u, %u, %u, %u, %u)\n",
printf("Response to 0x%lx: retval=%ld, args = (%lu, %lu, %lu, %lu, %lu)\n",
hash, retval, IPC_GET_ARG1(*answer),
IPC_GET_ARG2(*answer), IPC_GET_ARG3(*answer),
IPC_GET_ARG4(*answer), IPC_GET_ARG5(*answer));
332,7 → 333,7
// printf("ipcp_call_in()\n");
/* printf("phone: %d, method: ", call->in_phone_hash);
ipc_m_print(IPC_GET_METHOD(*call));
printf(" args: (%u, %u, %u, %u, %u)\n",
printf(" args: (%lu, %lu, %lu, %lu, %lu)\n",
IPC_GET_ARG1(*call),
IPC_GET_ARG2(*call),
IPC_GET_ARG3(*call),
343,7 → 344,7
if ((hash & IPC_CALLID_ANSWERED) == 0 && hash != IPCP_CALLID_SYNC) {
/* Not a response */
if ((display_mask & DM_IPC) != 0) {
printf("Not a response (hash %d)\n", hash);
printf("Not a response (hash 0x%lx)\n", hash);
}
return;
}
/trunk/uspace/lib/libc/generic/udebug.c
57,10 → 57,8
int udebug_thread_read(int phoneid, void *buffer, size_t n,
size_t *copied, size_t *needed)
{
unsigned dest_addr;
 
return async_req_3_3(phoneid, IPC_M_DEBUG_ALL, UDEBUG_M_THREAD_READ,
(sysarg_t)buffer, n, &dest_addr, copied, needed);
(sysarg_t)buffer, n, NULL, copied, needed);
}
 
int udebug_mem_read(int phoneid, void *buffer, uintptr_t addr, size_t n)