Changeset 80487bc5 in mainline for uspace


Ignore:
Timestamp:
2010-01-25T21:40:13Z (16 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
e515b21a
Parents:
0d21b53
Message:

Allow taskdump to read register state and extract PC, FP (not implemented for all arches).

Location:
uspace
Files:
8 added
3 edited

Legend:

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

    r0d21b53 r80487bc5  
    4141#include <task.h>
    4242#include <kernel/mm/as.h>
     43#include <libarch/istate.h>
    4344#include <macros.h>
    4445#include <assert.h>
     
    5859static void print_syntax();
    5960static int threads_dump(void);
     61static int thread_dump(uintptr_t thash);
    6062static int areas_dump(void);
    6163static int area_dump(as_area_info_t *area);
     
    229231        for (i = 0; i < n_threads; i++) {
    230232                printf(" [%d] hash: 0x%lx\n", 1+i, thash_buf[i]);
     233
     234                thread_dump(thash_buf[i]);
    231235        }
    232236        putchar('\n');
     
    291295}
    292296
     297static int thread_dump(uintptr_t thash)
     298{
     299        istate_t istate;
     300        uintptr_t pc, fp;
     301        int rc;
     302
     303        rc = udebug_regs_read(phoneid, thash, &istate);
     304        if (rc < 0) {
     305                printf("Failed reading registers (%d).\n", rc);
     306                return EIO;
     307        }
     308
     309        pc = istate_get_pc(&istate);
     310        fp = istate_get_fp(&istate);
     311
     312        printf("Thread 0x%lx crashed at PC 0x%lx. FP 0x%lx\n", thash, pc, fp);
     313        printf("Istate hexdump:\n");
     314        hex_dump(0, &istate, (sizeof(istate_t) + 15) & ~15);
     315
     316        return EOK;
     317}
     318
    293319static int area_dump(as_area_info_t *area)
    294320{
  • uspace/lib/libc/generic/udebug.c

    r0d21b53 r80487bc5  
    9797}
    9898
     99int udebug_regs_read(int phoneid, thash_t tid, void *buffer)
     100{
     101        return async_req_3_0(phoneid, IPC_M_DEBUG_ALL, UDEBUG_M_REGS_READ,
     102            tid, (sysarg_t)buffer);
     103}
     104
    99105int udebug_go(int phoneid, thash_t tid, udebug_event_t *ev_type,
    100106    sysarg_t *val0, sysarg_t *val1)
  • uspace/lib/libc/include/udebug.h

    r0d21b53 r80487bc5  
    5151int udebug_mem_read(int phoneid, void *buffer, uintptr_t addr, size_t n);
    5252int udebug_args_read(int phoneid, thash_t tid, sysarg_t *buffer);
     53int udebug_regs_read(int phoneid, thash_t tid, void *buffer);
    5354int udebug_go(int phoneid, thash_t tid, udebug_event_t *ev_type,
    5455        sysarg_t *val0, sysarg_t *val1);
Note: See TracChangeset for help on using the changeset viewer.