Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 2945 → Rev 2946

/branches/tracing/uspace/app/sctrace/proto.c
56,12 → 56,34
link_t link;
} method_oper_t;
 
hash_index_t srv_proto_hash(unsigned long key[])
static hash_index_t srv_proto_hash(unsigned long key[]);
static int srv_proto_compare(unsigned long key[], hash_count_t keys,
link_t *item);
static void srv_proto_remove_callback(link_t *item);
 
hash_table_operations_t srv_proto_ops = {
.hash = srv_proto_hash,
.compare = srv_proto_compare,
.remove_callback = srv_proto_remove_callback
};
 
static hash_index_t method_oper_hash(unsigned long key[]);
static int method_oper_compare(unsigned long key[], hash_count_t keys,
link_t *item);
static void method_oper_remove_callback(link_t *item);
 
hash_table_operations_t method_oper_ops = {
.hash = method_oper_hash,
.compare = method_oper_compare,
.remove_callback = method_oper_remove_callback
};
 
static hash_index_t srv_proto_hash(unsigned long key[])
{
return key[0] % SRV_PROTO_TABLE_CHAINS;
}
 
int srv_proto_compare(unsigned long key[], hash_count_t keys,
static int srv_proto_compare(unsigned long key[], hash_count_t keys,
link_t *item)
{
srv_proto_t *sp;
71,22 → 93,16
return key[0] == sp->srv;
}
 
void srv_proto_remove_callback(link_t *item)
static void srv_proto_remove_callback(link_t *item)
{
}
 
hash_table_operations_t srv_proto_ops = {
.hash = srv_proto_hash,
.compare = srv_proto_compare,
.remove_callback = srv_proto_remove_callback
};
 
hash_index_t method_oper_hash(unsigned long key[])
static hash_index_t method_oper_hash(unsigned long key[])
{
return key[0] % METHOD_OPER_TABLE_CHAINS;
}
 
int method_oper_compare(unsigned long key[], hash_count_t keys,
static int method_oper_compare(unsigned long key[], hash_count_t keys,
link_t *item)
{
method_oper_t *mo;
96,17 → 112,11
return key[0] == mo->method;
}
 
void method_oper_remove_callback(link_t *item)
static void method_oper_remove_callback(link_t *item)
{
}
 
hash_table_operations_t method_oper_ops = {
.hash = method_oper_hash,
.compare = method_oper_compare,
.remove_callback = method_oper_remove_callback
};
 
 
void proto_init(void)
{
hash_table_create(&srv_proto, SRV_PROTO_TABLE_CHAINS, 1,
/branches/tracing/uspace/app/sctrace/sctrace.c
68,7 → 68,7
 
static proto_t *proto_console;
 
int task_connect(int taskid)
static int task_connect(int taskid)
{
int rc;
 
91,16 → 91,15
return 0;
}
 
int get_thread_list(void)
static int get_thread_list(void)
{
int rc;
int tb_copied;
int tb_needed;
size_t tb_copied;
size_t tb_needed;
int i;
 
 
printf("send IPC_M_DEBUG_THREAD_READ message\n");
rc = udebug_thread_read(phoneid, (unsigned)thread_hash_buf,
rc = udebug_thread_read(phoneid, thread_hash_buf,
THBUF_SIZE*sizeof(unsigned), &tb_copied, &tb_needed);
printf("-> %d\n", rc);
if (rc < 0) return rc;
116,7 → 115,7
return 0;
}
 
void print_sc_retval(int retval, rv_type_t rv_type)
static void print_sc_retval(int retval, rv_type_t rv_type)
{
printf (" -> ");
if (rv_type == RV_INTEGER) {
143,7 → 142,7
putchar('\n');
}
 
void print_sc_args(unsigned *sc_args, int n)
static void print_sc_args(unsigned *sc_args, int n)
{
int i;
 
155,7 → 154,7
putchar(')');
}
 
void sc_ipc_call_async_fast(unsigned *sc_args, int sc_rc)
static void sc_ipc_call_async_fast(unsigned *sc_args, int sc_rc)
{
ipc_call_t call;
int phoneid;
175,7 → 174,7
ipcp_call_out(phoneid, &call, sc_rc);
}
 
void sc_ipc_call_async_slow(unsigned *sc_args, int sc_rc)
static void sc_ipc_call_async_slow(unsigned *sc_args, int sc_rc)
{
ipc_call_t call;
int rc;
191,7 → 190,7
}
}
 
void sc_ipc_call_sync_fast(unsigned *sc_args)
static void sc_ipc_call_sync_fast(unsigned *sc_args)
{
ipc_call_t question, reply;
int rc;
219,7 → 218,7
ipcp_call_sync(phoneidx, &question, &reply);
}
 
void sc_ipc_call_sync_slow(unsigned *sc_args)
static void sc_ipc_call_sync_slow(unsigned *sc_args)
{
ipc_call_t question, reply;
int rc;
237,12 → 236,12
ipcp_call_sync(sc_args[0], &question, &reply);
}
 
void sc_ipc_wait(unsigned *sc_args, int sc_rc)
static void sc_ipc_wait(unsigned *sc_args, int sc_rc)
{
ipc_call_t call;
int rc;
 
if (sc_rc == 0) return 0;
if (sc_rc == 0) return;
 
memset(&call, 0, sizeof(call));
rc = udebug_mem_read(phoneid, &call, sc_args[0], sizeof(call));
254,10 → 253,9
}
}
 
void event_syscall_b(unsigned thread_id, unsigned thread_hash, unsigned sc_id, int sc_rc)
static void event_syscall_b(unsigned thread_id, unsigned thread_hash, unsigned sc_id, int sc_rc)
{
unsigned sc_args[6];
int rv_type;
int rc;
 
/* Read syscall arguments */
280,7 → 278,7
async_serialize_end();
}
 
void event_syscall_e(unsigned thread_id, unsigned thread_hash, unsigned sc_id, int sc_rc)
static void event_syscall_e(unsigned thread_id, unsigned thread_hash, unsigned sc_id, int sc_rc)
{
unsigned sc_args[6];
int rv_type;
325,7 → 323,7
async_serialize_end();
}
 
void event_thread_b(unsigned hash)
static void event_thread_b(unsigned hash)
{
async_serialize_start();
printf("new thread, hash 0x%x\n", hash);
334,7 → 332,7
thread_trace_start(hash);
}
 
void trace_loop(void *thread_hash_arg)
static int trace_loop(void *thread_hash_arg)
{
int rc;
unsigned ev_type;
393,6 → 391,7
}
 
printf("trace_loop(%d) exiting\n", thread_id);
return 0;
}
 
void thread_trace_start(unsigned thread_hash)
408,7 → 407,7
fibril_add_ready(fid);
}
 
void trace_active_task(void)
static void trace_active_task(void)
{
int taskid;
int i;
/branches/tracing/uspace/app/sctrace/ipcp.c
63,13 → 63,25
#define PCALL_TABLE_CHAINS 32
hash_table_t pending_calls;
 
hash_index_t pending_call_hash(unsigned long key[])
static hash_index_t pending_call_hash(unsigned long key[]);
static int pending_call_compare(unsigned long key[], hash_count_t keys,
link_t *item);
static void pending_call_remove_callback(link_t *item);
 
hash_table_operations_t pending_call_ops = {
.hash = pending_call_hash,
.compare = pending_call_compare,
.remove_callback = pending_call_remove_callback
};
 
 
static hash_index_t pending_call_hash(unsigned long key[])
{
// printf("pending_call_hash\n");
return key[0] % PCALL_TABLE_CHAINS;
}
 
int pending_call_compare(unsigned long key[], hash_count_t keys,
static int pending_call_compare(unsigned long key[], hash_count_t keys,
link_t *item)
{
pending_call_t *hs;
80,16 → 92,11
return key[0] == hs->call_hash;
}
 
void pending_call_remove_callback(link_t *item)
static void pending_call_remove_callback(link_t *item)
{
// printf("pending_call_remove_callback\n");
}
 
hash_table_operations_t pending_call_ops = {
.hash = pending_call_hash,
.compare = pending_call_compare,
.remove_callback = pending_call_remove_callback
};
 
void ipcp_connection_set(int phone, int server, proto_t *proto)
{
147,6 → 154,7
{
pending_call_t *pcall;
proto_t *proto;
unsigned long key[1];
 
if (have_conn[phone]) proto = connections[phone].proto;
else proto = NULL;
170,7 → 178,9
pcall->question = *call;
pcall->call_hash = hash;
 
hash_table_insert(&pending_calls, &pcall->call_hash, &pcall->link);
key[0] = hash;
 
hash_table_insert(&pending_calls, key, &pcall->link);
}
 
static void parse_answer(pending_call_t *pcall, ipc_call_t *answer)
208,6 → 218,7
{
link_t *item;
pending_call_t *pcall;
unsigned long key[1];
 
// printf("ipcp_call_in()\n");
/* printf("phone: %d, method: ", call->in_phone_hash);
227,14 → 238,15
}
 
hash = hash & ~IPC_CALLID_ANSWERED;
key[0] = hash;
 
item = hash_table_find(&pending_calls, &hash);
item = hash_table_find(&pending_calls, key);
if (item == NULL) return; // No matching question found
pcall = hash_table_get_instance(item, pending_call_t, link);
 
printf("response matched to question\n");
hash_table_remove(&pending_calls, &hash, 1);
hash_table_remove(&pending_calls, key, 1);
 
parse_answer(pcall, call);
free(pcall);
/branches/tracing/uspace/app/sctrace/Makefile
57,7 → 57,7
-include Makefile.depend
 
clean:
-rm -f $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm Makefile.depend
-rm -f $(OUTPUT) $(OBJECTS) $(OUTPUT).map $(OUTPUT).disasm Makefile.depend
 
depend:
$(CC) $(DEFS) $(CFLAGS) -M $(SOURCES) > Makefile.depend
/branches/tracing/uspace/app/debug/cons.c
74,7 → 74,6
void cons_read_line(char *buffer, int n)
{
char c;
int i;
 
line_buffer = buffer;
line_chars = 0;
/branches/tracing/uspace/app/debug/main.c
105,6 → 105,10
len = strlen(cmd_argv[0]);
cmp_len = 1;
 
/* Silence warnings */
num_found = 0;
idx_found = 0;
 
while (cmp_len <= len + 1) {
 
num_found = 0;
198,8 → 202,8
static int get_thread_list(thash_t **thash_buf_ptr, int *n)
{
int rc;
int tb_copied;
int tb_needed;
size_t tb_copied;
size_t tb_needed;
int i;
size_t tb_size;
thash_t *thash_buf;
207,7 → 211,7
tb_size = THASH_BUF_INIT_LENGTH * sizeof(thash_t);
thash_buf = malloc(tb_size);
 
rc = udebug_thread_read(app_phone, (sysarg_t)thash_buf,
rc = udebug_thread_read(app_phone, thash_buf,
tb_size, &tb_copied, &tb_needed);
if (rc < 0) return rc;
 
226,7 → 230,7
 
/* Try again */
rc = udebug_thread_read(app_phone, (sysarg_t)thash_buf,
rc = udebug_thread_read(app_phone, thash_buf,
tb_size, &tb_copied, &tb_needed);
 
if (rc < 0) return rc;
247,7 → 251,7
return 0;
}
 
void event_thread_b(unsigned hash)
static void event_thread_b(unsigned hash)
{
async_serialize_start();
cons_printf("new thread, hash 0x%x\n", hash);
256,8 → 260,6
thread_debug_start(hash);
}
 
static unsigned buffer[1024];
 
static void debug_event(thash_t thash, udebug_event_t ev_type, sysarg_t val0)
{
switch (ev_type) {
284,11 → 286,10
}
}
 
void debug_loop(void *dt_arg)
static int debug_loop(void *dt_arg)
{
int rc;
udebug_event_t ev_type;
unsigned thread_buf_idx;
unsigned val0, val1;
dthread_t *dt;
 
309,6 → 310,7
}
 
cons_printf("debug_loop(%d) exiting\n", dt->id);
return 0;
}
 
void thread_debug_start(unsigned thash)
327,12 → 329,11
fibril_add_ready(fid);
}
 
void debug_active_task(void)
static void debug_active_task(void)
{
int taskid;
int i;
int rc;
int c;
 
thash_t *thash_buffer;
int n_threads;
/branches/tracing/uspace/app/debug/dthread.c
102,7 → 102,6
void dthread_stop_me(void)
{
dthread_t *dt;
int i;
 
dt = dthread_get();
assert(dt);
/branches/tracing/uspace/lib/libc/include/udebug.h
51,7 → 51,8
int udebug_args_read(int phoneid, thash_t tid, sysarg_t *buffer);
int udebug_regs_read(int phoneid, thash_t tid, void *buffer);
int udebug_regs_write(int phoneid, thash_t tid, void *buffer);
int udebug_go(int phoneid, thash_t tid, int *ev_type, int *val0, int *val1);
int udebug_go(int phoneid, thash_t tid, udebug_event_t *ev_type,
sysarg_t *val0, sysarg_t *val1);
int udebug_stop(int phoneid, thash_t tid);
 
#endif
/branches/tracing/uspace/lib/libc/generic/udebug.c
93,7 → 93,8
tid, (sysarg_t)buffer);
}
 
int udebug_go(int phoneid, thash_t tid, int *ev_type, int *val0, int *val1)
int udebug_go(int phoneid, thash_t tid, udebug_event_t *ev_type,
sysarg_t *val0, sysarg_t *val1)
{
return async_req_2_3(phoneid, IPC_M_DEBUG_ALL, UDEBUG_M_GO,
tid, (sysarg_t)ev_type, (sysarg_t)val0, (sysarg_t)val1);