Changeset 79ae36dd in mainline for uspace/app/taskdump/taskdump.c


Ignore:
Timestamp:
2011-06-08T19:01:55Z (13 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
0eff68e
Parents:
764d71e
Message:

new async framework with integrated exchange tracking

  • strict isolation between low-level IPC and high-level async framework with integrated exchange tracking
    • each IPC connection is represented by an async_sess_t structure
    • each IPC exchange is represented by an async_exch_t structure
    • exchange management is either based on atomic messages (EXCHANGE_ATOMIC), locking (EXCHANGE_SERIALIZE) or connection cloning (EXCHANGE_CLONE)
  • async_obsolete: temporary compatibility layer to keep old async clients working (several pieces of code are currently broken, but only non-essential functionality)
  • IPC_M_PHONE_HANGUP is now method no. 0 (for elegant boolean evaluation)
  • IPC_M_DEBUG_ALL has been renamed to IPC_M_DEBUG
  • IPC_M_PING has been removed (VFS protocol now has VFS_IN_PING)
  • console routines in libc have been rewritten for better abstraction
  • additional use for libc-private header files (FILE structure opaque to the client)
  • various cstyle changes (typos, indentation, missing externs in header files, improved comments, etc.)
File:
1 edited

Legend:

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

    r764d71e r79ae36dd  
    5454#define LINE_BYTES 16
    5555
    56 static int phoneid;
     56static async_sess_t *sess;
    5757static task_id_t task_id;
    5858static bool write_core_file;
     
    104104                printf("Failed dumping address space areas.\n");
    105105
    106         udebug_end(phoneid);
    107         async_hangup(phoneid);
     106        udebug_end(sess);
     107        async_hangup(sess);
    108108
    109109        return 0;
     
    112112static int connect_task(task_id_t task_id)
    113113{
    114         int rc;
    115 
    116         rc = async_connect_kbox(task_id);
    117 
    118         if (rc == ENOTSUP) {
    119                 printf("You do not have userspace debugging support "
    120                     "compiled in the kernel.\n");
    121                 printf("Compile kernel with 'Support for userspace debuggers' "
    122                     "(CONFIG_UDEBUG) enabled.\n");
    123                 return rc;
    124         }
    125 
    126         if (rc < 0) {
     114        async_sess_t *ksess = async_connect_kbox(task_id);
     115       
     116        if (!ksess) {
     117                if (errno == ENOTSUP) {
     118                        printf("You do not have userspace debugging support "
     119                            "compiled in the kernel.\n");
     120                        printf("Compile kernel with 'Support for userspace debuggers' "
     121                            "(CONFIG_UDEBUG) enabled.\n");
     122                        return errno;
     123                }
     124               
    127125                printf("Error connecting\n");
    128                 printf("async_connect_kbox(%" PRIu64 ") -> %d ", task_id, rc);
    129                 return rc;
    130         }
    131 
    132         phoneid = rc;
    133 
    134         rc = udebug_begin(phoneid);
     126                printf("async_connect_kbox(%" PRIu64 ") -> %d ", task_id, errno);
     127                return errno;
     128        }
     129       
     130        int rc = udebug_begin(ksess);
    135131        if (rc < 0) {
    136132                printf("udebug_begin() -> %d\n", rc);
    137133                return rc;
    138134        }
    139 
     135       
     136        sess = ksess;
    140137        return 0;
    141138}
     
    213210
    214211        /* TODO: See why NULL does not work. */
    215         rc = udebug_thread_read(phoneid, &dummy_buf, 0, &copied, &needed);
     212        rc = udebug_thread_read(sess, &dummy_buf, 0, &copied, &needed);
    216213        if (rc < 0) {
    217214                printf("udebug_thread_read() -> %d\n", rc);
     
    227224        thash_buf = malloc(buf_size);
    228225
    229         rc = udebug_thread_read(phoneid, thash_buf, buf_size, &copied, &needed);
     226        rc = udebug_thread_read(sess, thash_buf, buf_size, &copied, &needed);
    230227        if (rc < 0) {
    231228                printf("udebug_thread_read() -> %d\n", rc);
     
    262259        int rc;
    263260
    264         rc = udebug_areas_read(phoneid, &dummy_buf, 0, &copied, &needed);
     261        rc = udebug_areas_read(sess, &dummy_buf, 0, &copied, &needed);
    265262        if (rc < 0) {
    266263                printf("udebug_areas_read() -> %d\n", rc);
     
    271268        ainfo_buf = malloc(buf_size);
    272269
    273         rc = udebug_areas_read(phoneid, ainfo_buf, buf_size, &copied, &needed);
     270        rc = udebug_areas_read(sess, ainfo_buf, buf_size, &copied, &needed);
    274271        if (rc < 0) {
    275272                printf("udebug_areas_read() -> %d\n", rc);
     
    296293        if (write_core_file) {
    297294                printf("Writing core file '%s'\n", core_file_name);
    298                 rc = elf_core_save(core_file_name, ainfo_buf, n_areas, phoneid);
     295                rc = elf_core_save(core_file_name, ainfo_buf, n_areas, sess);
    299296                if (rc != EOK) {
    300297                        printf("Failed writing core file.\n");
     
    316313        int rc;
    317314
    318         rc = udebug_regs_read(phoneid, thash, &istate);
     315        rc = udebug_regs_read(sess, thash, &istate);
    319316        if (rc < 0) {
    320317                printf("Failed reading registers (%d).\n", rc);
     
    359356        (void) arg;
    360357
    361         rc = udebug_mem_read(phoneid, &data, addr, sizeof(data));
     358        rc = udebug_mem_read(sess, &data, addr, sizeof(data));
    362359        if (rc < 0) {
    363360                printf("Warning: udebug_mem_read() failed.\n");
     
    430427        int rc;
    431428
    432         rc = udebug_name_read(phoneid, &dummy_buf, 0, &copied, &needed);
     429        rc = udebug_name_read(sess, &dummy_buf, 0, &copied, &needed);
    433430        if (rc < 0)
    434431                return NULL;
     
    436433        name_size = needed;
    437434        name = malloc(name_size + 1);
    438         rc = udebug_name_read(phoneid, name, name_size, &copied, &needed);
     435        rc = udebug_name_read(sess, name, name_size, &copied, &needed);
    439436        if (rc < 0) {
    440437                free(name);
Note: See TracChangeset for help on using the changeset viewer.