Changes in uspace/app/taskdump/taskdump.c [c1b979a:3e6a98c5] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/taskdump/taskdump.c
rc1b979a r3e6a98c5 35 35 #include <async.h> 36 36 #include <elf/elf_linux.h> 37 #include <fibrildump.h>38 37 #include <stdio.h> 39 38 #include <stdlib.h> … … 53 52 #include <elf_core.h> 54 53 #include <stacktrace.h> 55 #include <taskdump.h>56 54 57 55 #define LINE_BYTES 16 … … 78 76 static istate_t reg_state; 79 77 80 static stacktrace_ops_t td_stacktrace_ops = {81 .read_uintptr = td_read_uintptr82 };83 84 78 int main(int argc, char *argv[]) 85 79 { … … 112 106 if (rc < 0) 113 107 printf("Failed dumping address space areas.\n"); 114 115 rc = fibrils_dump(app_symtab, sess);116 if (rc < 0)117 printf("Failed dumping fibrils.\n");118 108 119 109 udebug_end(sess); … … 321 311 } 322 312 323 int td_stacktrace(uintptr_t fp, uintptr_t pc) 324 { 325 uintptr_t nfp; 313 static int thread_dump(uintptr_t thash) 314 { 315 istate_t istate; 316 uintptr_t pc, fp, nfp; 326 317 stacktrace_t st; 327 318 char *sym_pc; 328 319 int rc; 329 320 321 rc = udebug_regs_read(sess, thash, &istate); 322 if (rc < 0) { 323 printf("Failed reading registers (%d).\n", rc); 324 return EIO; 325 } 326 327 pc = istate_get_pc(&istate); 328 fp = istate_get_fp(&istate); 329 330 /* Save register state for dumping to core file later. */ 331 reg_state = istate; 332 333 sym_pc = fmt_sym_address(pc); 334 printf("Thread %p: PC = %s. FP = %p\n", (void *) thash, 335 sym_pc, (void *) fp); 336 free(sym_pc); 337 330 338 st.op_arg = NULL; 331 st. ops = &td_stacktrace_ops;339 st.read_uintptr = td_read_uintptr; 332 340 333 341 while (stacktrace_fp_valid(&st, fp)) { … … 346 354 fp = nfp; 347 355 } 348 349 return EOK;350 }351 352 static int thread_dump(uintptr_t thash)353 {354 istate_t istate;355 uintptr_t pc, fp;356 char *sym_pc;357 int rc;358 359 rc = udebug_regs_read(sess, thash, &istate);360 if (rc < 0) {361 printf("Failed reading registers (%d).\n", rc);362 return EIO;363 }364 365 pc = istate_get_pc(&istate);366 fp = istate_get_fp(&istate);367 368 /* Save register state for dumping to core file later. */369 reg_state = istate;370 371 sym_pc = fmt_sym_address(pc);372 printf("Thread %p: PC = %s. FP = %p\n", (void *) thash,373 sym_pc, (void *) fp);374 free(sym_pc);375 376 (void) td_stacktrace(fp, pc);377 356 378 357 return EOK;
Note:
See TracChangeset
for help on using the changeset viewer.