Changeset b7fd2a0 in mainline for uspace/app/taskdump
- Timestamp:
- 2018-01-13T03:10:29Z (8 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a53ed3a
- Parents:
- 36f0738
- Location:
- uspace/app/taskdump
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/taskdump/elf_core.c
r36f0738 rb7fd2a0 66 66 67 67 static off64_t align_foff_up(off64_t, uintptr_t, size_t); 68 static int write_mem_area(int, aoff64_t *, as_area_info_t *, async_sess_t *);68 static errno_t write_mem_area(int, aoff64_t *, as_area_info_t *, async_sess_t *); 69 69 70 70 #define BUFFER_SIZE 0x1000 … … 84 84 * 85 85 */ 86 int elf_core_save(const char *file_name, as_area_info_t *ainfo, unsigned int n,86 errno_t elf_core_save(const char *file_name, as_area_info_t *ainfo, unsigned int n, 87 87 async_sess_t *sess, istate_t *istate) 88 88 { … … 98 98 99 99 int fd; 100 int rc;100 errno_t rc; 101 101 size_t nwr; 102 102 unsigned int i; … … 292 292 * 293 293 */ 294 static int write_mem_area(int fd, aoff64_t *pos, as_area_info_t *area,294 static errno_t write_mem_area(int fd, aoff64_t *pos, as_area_info_t *area, 295 295 async_sess_t *sess) 296 296 { … … 298 298 size_t total; 299 299 uintptr_t addr; 300 int rc;300 errno_t rc; 301 301 size_t nwr; 302 302 -
uspace/app/taskdump/fibrildump.c
r36f0738 rb7fd2a0 43 43 #include <udebug.h> 44 44 45 static int fibrildump_read_uintptr(void *, uintptr_t, uintptr_t *);45 static errno_t fibrildump_read_uintptr(void *, uintptr_t, uintptr_t *); 46 46 47 47 static stacktrace_ops_t fibrildump_st_ops = { … … 49 49 }; 50 50 51 static int fibrildump_read_uintptr(void *arg, uintptr_t addr, uintptr_t *data)51 static errno_t fibrildump_read_uintptr(void *arg, uintptr_t addr, uintptr_t *data) 52 52 { 53 53 async_sess_t *sess = (async_sess_t *)arg; … … 56 56 } 57 57 58 static int read_link(async_sess_t *sess, uintptr_t addr, link_t *link)58 static errno_t read_link(async_sess_t *sess, uintptr_t addr, link_t *link) 59 59 { 60 int rc;60 errno_t rc; 61 61 62 62 rc = udebug_mem_read(sess, (void *)link, addr, sizeof(link_t)); … … 64 64 } 65 65 66 static int read_fibril(async_sess_t *sess, uintptr_t addr, fibril_t *fibril)66 static errno_t read_fibril(async_sess_t *sess, uintptr_t addr, fibril_t *fibril) 67 67 { 68 int rc;68 errno_t rc; 69 69 70 70 rc = udebug_mem_read(sess, (void *)fibril, addr, sizeof(fibril_t)); … … 72 72 } 73 73 74 int fibrils_dump(symtab_t *symtab, async_sess_t *sess)74 errno_t fibrils_dump(symtab_t *symtab, async_sess_t *sess) 75 75 { 76 76 uintptr_t fibril_list_addr; … … 79 79 uintptr_t addr, fibril_addr; 80 80 uintptr_t pc, fp; 81 int rc;81 errno_t rc; 82 82 83 83 /* -
uspace/app/taskdump/include/elf_core.h
r36f0738 rb7fd2a0 40 40 #include <libarch/istate.h> 41 41 42 extern int elf_core_save(const char *, as_area_info_t *, unsigned int,42 extern errno_t elf_core_save(const char *, as_area_info_t *, unsigned int, 43 43 async_sess_t *, istate_t *); 44 44 -
uspace/app/taskdump/include/fibrildump.h
r36f0738 rb7fd2a0 40 40 #include <symtab.h> 41 41 42 extern int fibrils_dump(symtab_t *, async_sess_t *sess);42 extern errno_t fibrils_dump(symtab_t *, async_sess_t *sess); 43 43 44 44 #endif -
uspace/app/taskdump/include/symtab.h
r36f0738 rb7fd2a0 48 48 } symtab_t; 49 49 50 extern int symtab_load(const char *file_name, symtab_t **symtab);50 extern errno_t 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, const char *name, uintptr_t *addr);53 extern int symtab_addr_to_name(symtab_t *symtab, uintptr_t addr, char **name,52 extern errno_t symtab_name_to_addr(symtab_t *st, const char *name, uintptr_t *addr); 53 extern errno_t symtab_addr_to_name(symtab_t *symtab, uintptr_t addr, char **name, 54 54 size_t *offs); 55 55 -
uspace/app/taskdump/include/taskdump.h
r36f0738 rb7fd2a0 39 39 #include <stdint.h> 40 40 41 extern int td_stacktrace(uintptr_t, uintptr_t);41 extern errno_t td_stacktrace(uintptr_t, uintptr_t); 42 42 43 43 #endif -
uspace/app/taskdump/symtab.c
r36f0738 rb7fd2a0 46 46 #include "include/symtab.h" 47 47 48 static int elf_hdr_check(elf_header_t *hdr);49 static int section_hdr_load(int fd, const elf_header_t *ehdr, int idx,48 static errno_t elf_hdr_check(elf_header_t *hdr); 49 static errno_t section_hdr_load(int fd, const elf_header_t *ehdr, int idx, 50 50 elf_section_header_t *shdr); 51 static int chunk_load(int fd, off64_t start, size_t size, void **ptr);51 static errno_t chunk_load(int fd, off64_t start, size_t size, void **ptr); 52 52 53 53 /** Load symbol table from an ELF file. … … 59 59 * ENOTSUP if file parsing failed. 60 60 */ 61 int symtab_load(const char *file_name, symtab_t **symtab)61 errno_t symtab_load(const char *file_name, symtab_t **symtab) 62 62 { 63 63 symtab_t *stab; … … 71 71 72 72 int fd; 73 int rc;73 errno_t rc; 74 74 size_t nread; 75 75 int i; … … 204 204 * @return EOK on success, ENOENT if no such symbol was found. 205 205 */ 206 int symtab_name_to_addr(symtab_t *st, const char *name, uintptr_t *addr)206 errno_t symtab_name_to_addr(symtab_t *st, const char *name, uintptr_t *addr) 207 207 { 208 208 size_t i; … … 241 241 * @return EOK on success or ENOENT if no matching symbol was found. 242 242 */ 243 int symtab_addr_to_name(symtab_t *st, uintptr_t addr, char **name,243 errno_t symtab_addr_to_name(symtab_t *st, uintptr_t addr, char **name, 244 244 size_t *offs) 245 245 { … … 287 287 * @return EOK on success or an error code. 288 288 */ 289 static int elf_hdr_check(elf_header_t *ehdr)289 static errno_t elf_hdr_check(elf_header_t *ehdr) 290 290 { 291 291 /* TODO */ … … 302 302 * @return EOK on success or EIO if I/O failed. 303 303 */ 304 static int section_hdr_load(int fd, const elf_header_t *elf_hdr, int idx,304 static errno_t section_hdr_load(int fd, const elf_header_t *elf_hdr, int idx, 305 305 elf_section_header_t *sec_hdr) 306 306 { 307 int rc;307 errno_t rc; 308 308 size_t nread; 309 309 aoff64_t pos = elf_hdr->e_shoff + idx * sizeof(elf_section_header_t); … … 327 327 * @return EOK on success or EIO on failure. 328 328 */ 329 static int chunk_load(int fd, off64_t start, size_t size, void **ptr)330 { 331 int rc;329 static errno_t chunk_load(int fd, off64_t start, size_t size, void **ptr) 330 { 331 errno_t rc; 332 332 size_t nread; 333 333 aoff64_t pos = start; -
uspace/app/taskdump/taskdump.c
r36f0738 rb7fd2a0 63 63 static symtab_t *app_symtab; 64 64 65 static int connect_task(task_id_t task_id);65 static errno_t connect_task(task_id_t task_id); 66 66 static int parse_args(int argc, char *argv[]); 67 67 static void print_syntax(void); 68 static int threads_dump(void);69 static int thread_dump(uintptr_t thash);70 static int areas_dump(void);71 static int td_read_uintptr(void *arg, uintptr_t addr, uintptr_t *value);68 static errno_t threads_dump(void); 69 static errno_t thread_dump(uintptr_t thash); 70 static errno_t areas_dump(void); 71 static errno_t td_read_uintptr(void *arg, uintptr_t addr, uintptr_t *value); 72 72 73 73 static void autoload_syms(void); … … 83 83 int main(int argc, char *argv[]) 84 84 { 85 int rc;85 errno_t rc; 86 86 87 87 printf("Task Dump Utility\n"); … … 122 122 } 123 123 124 static int connect_task(task_id_t task_id)124 static errno_t connect_task(task_id_t task_id) 125 125 { 126 126 async_sess_t *ksess = async_connect_kbox(task_id); … … 140 140 } 141 141 142 int rc = udebug_begin(ksess);142 errno_t rc = udebug_begin(ksess); 143 143 if (rc != EOK) { 144 144 printf("udebug_begin() -> %s\n", str_error_name(rc)); … … 210 210 } 211 211 212 static int threads_dump(void)212 static errno_t threads_dump(void) 213 213 { 214 214 uintptr_t *thash_buf; … … 219 219 size_t needed; 220 220 size_t i; 221 int rc;221 errno_t rc; 222 222 223 223 /* TODO: See why NULL does not work. */ … … 260 260 } 261 261 262 static int areas_dump(void)262 static errno_t areas_dump(void) 263 263 { 264 264 as_area_info_t *ainfo_buf; … … 269 269 size_t needed; 270 270 size_t i; 271 int rc;271 errno_t rc; 272 272 273 273 rc = udebug_areas_read(sess, &dummy_buf, 0, &copied, &needed); … … 320 320 } 321 321 322 int td_stacktrace(uintptr_t fp, uintptr_t pc)322 errno_t td_stacktrace(uintptr_t fp, uintptr_t pc) 323 323 { 324 324 uintptr_t nfp; 325 325 stacktrace_t st; 326 326 char *sym_pc; 327 int rc;327 errno_t rc; 328 328 329 329 st.op_arg = NULL; … … 349 349 } 350 350 351 static int thread_dump(uintptr_t thash)351 static errno_t thread_dump(uintptr_t thash) 352 352 { 353 353 istate_t istate; 354 354 uintptr_t pc, fp; 355 355 char *sym_pc; 356 int rc;356 errno_t rc; 357 357 358 358 rc = udebug_regs_read(sess, thash, &istate); … … 378 378 } 379 379 380 static int td_read_uintptr(void *arg, uintptr_t addr, uintptr_t *value)380 static errno_t td_read_uintptr(void *arg, uintptr_t addr, uintptr_t *value) 381 381 { 382 382 uintptr_t data; 383 int rc;383 errno_t rc; 384 384 385 385 (void) arg; … … 399 399 { 400 400 char *file_name; 401 int rc;401 errno_t rc; 402 402 int ret; 403 403 … … 455 455 size_t copied, needed, name_size; 456 456 char *name; 457 int rc;457 errno_t rc; 458 458 459 459 rc = udebug_name_read(sess, &dummy_buf, 0, &copied, &needed); … … 488 488 char *name; 489 489 size_t offs; 490 int rc;490 errno_t rc; 491 491 int ret; 492 492 char *str;
Note:
See TracChangeset
for help on using the changeset viewer.