Changeset c1b979a in mainline for uspace/app
- Timestamp:
- 2014-07-11T23:06:30Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 78192cc7
- Parents:
- 8e4a408
- Location:
- uspace/app/taskdump
- Files:
-
- 3 added
- 4 edited
-
Makefile (modified) (1 diff)
-
fibrildump.c (added)
-
include/fibrildump.h (added)
-
include/symtab.h (modified) (1 diff)
-
include/taskdump.h (added)
-
symtab.c (modified) (1 diff)
-
taskdump.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/taskdump/Makefile
r8e4a408 rc1b979a 33 33 SOURCES = \ 34 34 elf_core.c \ 35 fibrildump.c \ 35 36 taskdump.c \ 36 37 symtab.c -
uspace/app/taskdump/include/symtab.h
r8e4a408 rc1b979a 50 50 extern int symtab_load(const char *file_name, symtab_t **symtab); 51 51 extern void symtab_delete(symtab_t *st); 52 extern int symtab_name_to_addr(symtab_t *st, c har *name, uintptr_t *addr);52 extern int symtab_name_to_addr(symtab_t *st, const char *name, uintptr_t *addr); 53 53 extern int symtab_addr_to_name(symtab_t *symtab, uintptr_t addr, char **name, 54 54 size_t *offs); -
uspace/app/taskdump/symtab.c
r8e4a408 rc1b979a 202 202 * @return EOK on success, ENOENT if no such symbol was found. 203 203 */ 204 int symtab_name_to_addr(symtab_t *st, c har *name, uintptr_t *addr)204 int symtab_name_to_addr(symtab_t *st, const char *name, uintptr_t *addr) 205 205 { 206 206 size_t i; -
uspace/app/taskdump/taskdump.c
r8e4a408 rc1b979a 35 35 #include <async.h> 36 36 #include <elf/elf_linux.h> 37 #include <fibrildump.h> 37 38 #include <stdio.h> 38 39 #include <stdlib.h> … … 52 53 #include <elf_core.h> 53 54 #include <stacktrace.h> 55 #include <taskdump.h> 54 56 55 57 #define LINE_BYTES 16 … … 76 78 static istate_t reg_state; 77 79 80 static stacktrace_ops_t td_stacktrace_ops = { 81 .read_uintptr = td_read_uintptr 82 }; 83 78 84 int main(int argc, char *argv[]) 79 85 { … … 106 112 if (rc < 0) 107 113 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"); 108 118 109 119 udebug_end(sess); … … 311 321 } 312 322 323 int td_stacktrace(uintptr_t fp, uintptr_t pc) 324 { 325 uintptr_t nfp; 326 stacktrace_t st; 327 char *sym_pc; 328 int rc; 329 330 st.op_arg = NULL; 331 st.ops = &td_stacktrace_ops; 332 333 while (stacktrace_fp_valid(&st, fp)) { 334 sym_pc = fmt_sym_address(pc); 335 printf(" %p: %s\n", (void *) fp, sym_pc); 336 free(sym_pc); 337 338 rc = stacktrace_ra_get(&st, fp, &pc); 339 if (rc != EOK) 340 return rc; 341 342 rc = stacktrace_fp_prev(&st, fp, &nfp); 343 if (rc != EOK) 344 return rc; 345 346 fp = nfp; 347 } 348 349 return EOK; 350 } 351 313 352 static int thread_dump(uintptr_t thash) 314 353 { 315 354 istate_t istate; 316 uintptr_t pc, fp, nfp; 317 stacktrace_t st; 355 uintptr_t pc, fp; 318 356 char *sym_pc; 319 357 int rc; … … 336 374 free(sym_pc); 337 375 338 st.op_arg = NULL; 339 st.read_uintptr = td_read_uintptr; 340 341 while (stacktrace_fp_valid(&st, fp)) { 342 sym_pc = fmt_sym_address(pc); 343 printf(" %p: %s\n", (void *) fp, sym_pc); 344 free(sym_pc); 345 346 rc = stacktrace_ra_get(&st, fp, &pc); 347 if (rc != EOK) 348 return rc; 349 350 rc = stacktrace_fp_prev(&st, fp, &nfp); 351 if (rc != EOK) 352 return rc; 353 354 fp = nfp; 355 } 376 (void) td_stacktrace(fp, pc); 356 377 357 378 return EOK;
Note:
See TracChangeset
for help on using the changeset viewer.
