Changes in uspace/app/taskdump/symtab.c [8e3498b:1d6dd2a] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/taskdump/symtab.c
r8e3498b r1d6dd2a 41 41 #include <stddef.h> 42 42 #include <errno.h> 43 #include <str.h> 44 #include <str_error.h> 43 45 #include <vfs/vfs.h> 44 46 45 47 #include "include/symtab.h" 46 48 47 static int elf_hdr_check(elf_header_t *hdr);48 static int section_hdr_load(int fd, const elf_header_t *ehdr, int idx,49 static errno_t elf_hdr_check(elf_header_t *hdr); 50 static errno_t section_hdr_load(int fd, const elf_header_t *ehdr, int idx, 49 51 elf_section_header_t *shdr); 50 static int chunk_load(int fd, off64_t start, size_t size, void **ptr);52 static errno_t chunk_load(int fd, off64_t start, size_t size, void **ptr); 51 53 52 54 /** Load symbol table from an ELF file. … … 58 60 * ENOTSUP if file parsing failed. 59 61 */ 60 int symtab_load(const char *file_name, symtab_t **symtab)62 errno_t symtab_load(const char *file_name, symtab_t **symtab) 61 63 { 62 64 symtab_t *stab; … … 70 72 71 73 int fd; 72 int rc;74 errno_t rc; 73 75 size_t nread; 74 76 int i; … … 82 84 return ENOMEM; 83 85 84 fd = vfs_lookup_open(file_name, WALK_REGULAR, MODE_READ);85 if ( fd < 0) {86 printf("failed opening file \n");86 rc = vfs_lookup_open(file_name, WALK_REGULAR, MODE_READ, &fd); 87 if (rc != EOK) { 88 printf("failed opening file '%s': %s\n", file_name, str_error(rc)); 87 89 free(stab); 88 90 return ENOENT; … … 203 205 * @return EOK on success, ENOENT if no such symbol was found. 204 206 */ 205 int symtab_name_to_addr(symtab_t *st, const char *name, uintptr_t *addr)207 errno_t symtab_name_to_addr(symtab_t *st, const char *name, uintptr_t *addr) 206 208 { 207 209 size_t i; … … 240 242 * @return EOK on success or ENOENT if no matching symbol was found. 241 243 */ 242 int symtab_addr_to_name(symtab_t *st, uintptr_t addr, char **name,244 errno_t symtab_addr_to_name(symtab_t *st, uintptr_t addr, char **name, 243 245 size_t *offs) 244 246 { … … 284 286 /** Check if ELF header is valid. 285 287 * 286 * @return EOK on success or negativeerror code.287 */ 288 static int elf_hdr_check(elf_header_t *ehdr)288 * @return EOK on success or an error code. 289 */ 290 static errno_t elf_hdr_check(elf_header_t *ehdr) 289 291 { 290 292 /* TODO */ … … 301 303 * @return EOK on success or EIO if I/O failed. 302 304 */ 303 static int section_hdr_load(int fd, const elf_header_t *elf_hdr, int idx,305 static errno_t section_hdr_load(int fd, const elf_header_t *elf_hdr, int idx, 304 306 elf_section_header_t *sec_hdr) 305 307 { 306 int rc;308 errno_t rc; 307 309 size_t nread; 308 310 aoff64_t pos = elf_hdr->e_shoff + idx * sizeof(elf_section_header_t); … … 326 328 * @return EOK on success or EIO on failure. 327 329 */ 328 static int chunk_load(int fd, off64_t start, size_t size, void **ptr)329 { 330 int rc;330 static errno_t chunk_load(int fd, off64_t start, size_t size, void **ptr) 331 { 332 errno_t rc; 331 333 size_t nread; 332 334 aoff64_t pos = start;
Note:
See TracChangeset
for help on using the changeset viewer.