Changeset a35b458 in mainline for uspace/app/trace
- Timestamp:
- 2018-03-02T20:10:49Z (8 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- f1380b7
- Parents:
- 3061bc1
- git-author:
- Jiří Zárevúcky <zarevucky.jiri@…> (2018-02-28 17:38:31)
- git-committer:
- Jiří Zárevúcky <zarevucky.jiri@…> (2018-03-02 20:10:49)
- Location:
- uspace/app/trace
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/trace/ipcp.c
r3061bc1 ra35b458 253 253 proto_t *proto; 254 254 int cphone; 255 255 256 256 sysarg_t *resp; 257 257 oper_t *oper; 258 258 int i; 259 259 260 260 phone = pcall->phone_hash; 261 261 method = IPC_GET_IMETHOD(pcall->question); 262 262 retval = IPC_GET_RETVAL(*answer); 263 263 264 264 resp = answer->args; 265 265 266 266 if ((display_mask & DM_IPC) != 0) { 267 267 printf("Response to %d: retval=%s, args = (%" PRIun ", " … … 271 271 IPC_GET_ARG4(*answer), IPC_GET_ARG5(*answer)); 272 272 } 273 273 274 274 if ((display_mask & DM_USER) != 0) { 275 275 oper = pcall->oper; 276 276 277 277 if ((oper != NULL) && 278 278 ((oper->rv_type != V_VOID) || (oper->respc > 0))) { 279 279 printf("->"); 280 280 281 281 if (oper->rv_type != V_VOID) { 282 282 putchar(' '); 283 283 val_print((sysarg_t) retval, oper->rv_type); 284 284 } 285 285 286 286 if (oper->respc > 0) { 287 287 putchar(' '); … … 294 294 putchar(')'); 295 295 } 296 296 297 297 putchar('\n'); 298 298 } 299 299 } 300 300 301 301 if ((phone == PHONE_NS) && (method == IPC_M_CONNECT_ME_TO) && 302 302 (retval == 0)) { … … 306 306 if (proto == NULL) 307 307 proto = proto_unknown; 308 308 309 309 cphone = IPC_GET_ARG5(*answer); 310 310 if ((display_mask & DM_SYSTEM) != 0) { … … 312 312 proto->name); 313 313 } 314 314 315 315 ipcp_connection_set(cphone, 0, proto); 316 316 } … … 321 321 ht_link_t *item; 322 322 pending_call_t *pcall; 323 323 324 324 if ((call->flags & IPC_CALL_ANSWERED) == 0) { 325 325 /* Not a response */ … … 329 329 return; 330 330 } 331 331 332 332 item = hash_table_find(&pending_calls, &hash); 333 333 if (item == NULL) 334 334 return; /* No matching question found */ 335 335 336 336 /* 337 337 * Response matched to question. 338 338 */ 339 339 340 340 pcall = hash_table_get_inst(item, pending_call_t, link); 341 341 hash_table_remove(&pending_calls, &hash); 342 342 343 343 parse_answer(hash, pcall, call); 344 344 free(pcall); -
uspace/app/trace/proto.h
r3061bc1 ra35b458 44 44 typedef struct { 45 45 const char *name; 46 46 47 47 int argc; 48 48 val_type_t arg_type[OPER_MAX_ARGS]; 49 49 50 50 val_type_t rv_type; 51 51 52 52 int respc; 53 53 val_type_t resp_type[OPER_MAX_ARGS]; … … 57 57 /** Protocol name */ 58 58 const char *name; 59 59 60 60 /** Maps method number to operation */ 61 61 hash_table_t method_oper; -
uspace/app/trace/trace.c
r3061bc1 ra35b458 146 146 { 147 147 async_sess_t *ksess = async_connect_kbox(task_id); 148 148 149 149 if (!ksess) { 150 150 if (errno == ENOTSUP) { … … 155 155 return errno; 156 156 } 157 157 158 158 printf("Error connecting\n"); 159 159 printf("ipc_connect_task(%" PRIu64 ") -> %s ", task_id, str_error_name(errno)); 160 160 return errno; 161 161 } 162 162 163 163 errno_t rc = udebug_begin(ksess); 164 164 if (rc != EOK) { … … 166 166 return rc; 167 167 } 168 168 169 169 rc = udebug_set_evmask(ksess, UDEBUG_EM_ALL); 170 170 if (rc != EOK) { … … 172 172 return rc; 173 173 } 174 174 175 175 sess = ksess; 176 176 return 0; … … 283 283 ipc_call_t call; 284 284 sysarg_t phoneid; 285 285 286 286 if (sc_rc != EOK) 287 287 return; … … 324 324 memset(&call, 0, sizeof(call)); 325 325 rc = udebug_mem_read(sess, &call, sc_args[0], sizeof(call)); 326 326 327 327 if (rc == EOK) 328 328 ipcp_call_in(&call, sc_rc); … … 525 525 int fd_stdout; 526 526 int fd_stderr; 527 527 528 528 fd_root = vfs_root(); 529 529 if (fd_root >= 0) { … … 533 533 goto error; 534 534 } 535 535 536 536 if ((stdin != NULL) && (vfs_fhandle(stdin, &fd_stdin) == EOK)) { 537 537 rc = loader_add_inbox(ldr, "stdin", fd_stdin); … … 539 539 goto error; 540 540 } 541 541 542 542 if ((stdout != NULL) && (vfs_fhandle(stdout, &fd_stdout) == EOK)) { 543 543 rc = loader_add_inbox(ldr, "stdout", fd_stdout); … … 545 545 goto error; 546 546 } 547 547 548 548 if ((stderr != NULL) && (vfs_fhandle(stderr, &fd_stderr) == EOK)) { 549 549 rc = loader_add_inbox(ldr, "stderr", fd_stderr); … … 551 551 goto error; 552 552 } 553 553 554 554 /* Load the program. */ 555 555 rc = loader_load_program(ldr); … … 571 571 572 572 (void) arg; 573 573 574 574 console_ctrl_t *console = console_init(stdin, stdout); 575 575 576 576 while (true) { 577 577 fibril_mutex_lock(&state_lock); … … 579 579 fibril_condvar_wait(&state_cv, &state_lock); 580 580 fibril_mutex_unlock(&state_lock); 581 581 582 582 if (!console_get_event(console, &event)) 583 583 return EINVAL; 584 584 585 585 if (event.type == CEV_KEY) { 586 586 fibril_mutex_lock(&state_lock); … … 750 750 display_mask_t dm = 0; 751 751 const char *c = text; 752 752 753 753 while (*c) { 754 754 switch (*c) { … … 769 769 exit(1); 770 770 } 771 771 772 772 ++c; 773 773 } 774 774 775 775 return dm; 776 776 } … … 810 810 break; 811 811 } 812 812 813 813 --argc; 814 814 ++argv; … … 831 831 /* Preload the specified program file. */ 832 832 printf("Spawning '%s' with arguments:\n", *argv); 833 833 834 834 char **cp = argv; 835 835 while (*cp) 836 836 printf("'%s'\n", *cp++); 837 837 838 838 task_ldr = preload_task(*argv, argv, &task_id); 839 839 task_wait_for = true; -
uspace/app/trace/trace.h
r3061bc1 ra35b458 42 42 */ 43 43 typedef enum { 44 44 45 45 DM_THREAD = 1, /**< Thread creation and termination events */ 46 46 DM_SYSCALL = 2, /**< System calls */
Note:
See TracChangeset
for help on using the changeset viewer.
