Changeset 6e3a44a in mainline for uspace/app/trace/trace.c


Ignore:
Timestamp:
2009-07-21T22:18:49Z (15 years ago)
Author:
Jiri Svoboda <jirik.svoboda@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
9ad5b5cc
Parents:
5462a30
Message:

Wait for app to exit before returning from tracer.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/trace/trace.c

    r5462a30 r6e3a44a  
    8484static task_id_t task_id;
    8585static loader_t *task_ldr;
     86static int task_wait_for;
    8687
    8788/** Combination of events/data to print. */
     
    861862                                task_id = strtol(*argv, &err_p, 10);
    862863                                task_ldr = NULL;
     864                                task_wait_for = 0;
    863865                                if (*err_p) {
    864866                                        printf("Task ID syntax error\n");
     
    898900        }
    899901        task_ldr = preload_task(*argv, argv, &task_id);
     902        task_wait_for = 1;
    900903
    901904        return 0;
     
    905908{
    906909        int rc;
     910        task_exit_t texit;
     911        int retval;
    907912
    908913        printf("System Call / IPC Tracer\n");
     
    924929        printf("Connected to task %lld.\n", task_id);
    925930
    926         if (task_ldr != NULL) {
     931        if (task_ldr != NULL)
    927932                program_run();
    928         }
    929933
    930934        cev_fibril_start();
    931935        trace_task(task_id);
    932936
     937        if (task_wait_for) {
     938                printf("Waiting for task to exit.\n");
     939
     940                rc = task_wait(task_id, &texit, &retval);
     941                if (rc != EOK) {
     942                        printf("Failed waiting for task.\n");
     943                        return -1;
     944                }
     945
     946                if (texit == TASK_EXIT_NORMAL) {
     947                        printf("Task exited normally, return value %d.\n",
     948                            retval);
     949                } else {
     950                        printf("Task exited unexpectedly.\n");
     951                }
     952        }
     953
    933954        return 0;
    934955}
Note: See TracChangeset for help on using the changeset viewer.