Changes in uspace/app/taskdump/taskdump.c [1ccafee:dafa2d04] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/taskdump/taskdump.c
r1ccafee rdafa2d04 40 40 #include <udebug.h> 41 41 #include <task.h> 42 #include < kernel/mm/as.h>42 #include <as.h> 43 43 #include <sys/types.h> 44 44 #include <sys/typefmt.h> … … 49 49 50 50 #include <symtab.h> 51 #include <elf_core.h> 51 52 #include <stacktrace.h> 52 53 … … 58 59 static int phoneid; 59 60 static task_id_t task_id; 60 static bool dump_memory; 61 static bool write_core_file; 62 static char *core_file_name; 61 63 static char *app_name; 62 64 static symtab_t *app_symtab; … … 80 82 int rc; 81 83 82 /*83 * FIXME: The stdio module cannot currently detect whether we are84 * writing to a console or file. This workaround make file output85 * faster.86 */87 setvbuf(stdout, NULL, _IOFBF, 32768);88 89 84 printf("Task Dump Utility\n"); 90 dump_memory= false;85 write_core_file = false; 91 86 92 87 if (parse_args(argc, argv) < 0) … … 172 167 return -1; 173 168 } 174 } else if (arg[1] == 'm' && arg[2] == '\0') { 175 dump_memory = true; 169 } else if (arg[1] == 'c' && arg[2] == '\0') { 170 write_core_file = true; 171 172 --argc; ++argv; 173 core_file_name = *argv; 176 174 } else { 177 175 printf("Uknown option '%s'\n", arg[0]); … … 203 201 static void print_syntax(void) 204 202 { 205 printf("Syntax: taskdump [- m] -t <task_id>\n");206 printf("\t- m\tDump memory area contents.\n");203 printf("Syntax: taskdump [-c <core_file>] -t <task_id>\n"); 204 printf("\t-c <core_file_id>\tName of core file to write.\n"); 207 205 printf("\t-t <task_id>\tWhich task to dump.\n"); 208 206 } … … 297 295 (ainfo_buf[i].flags & AS_AREA_CACHEABLE) ? 'C' : '-', 298 296 ainfo_buf[i].start_addr, ainfo_buf[i].size); 299 300 if (dump_memory) { 301 putchar('\n'); 302 area_dump(&ainfo_buf[i]); 303 putchar('\n'); 297 } 298 299 putchar('\n'); 300 301 if (write_core_file) { 302 printf("Writing core file '%s'\n", core_file_name); 303 rc = elf_core_save(core_file_name, ainfo_buf, n_areas, phoneid); 304 if (rc != EOK) { 305 printf("Failed writing core file.\n"); 306 return EIO; 304 307 } 305 308 } 306 307 putchar('\n');308 309 309 310 free(ainfo_buf);
Note:
See TracChangeset
for help on using the changeset viewer.