Changeset 80487bc5 in mainline for uspace/app/taskdump/taskdump.c


Ignore:
Timestamp:
2010-01-25T21:40:13Z (14 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).

File:
1 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{
Note: See TracChangeset for help on using the changeset viewer.