Changes in / [f27ada7:25e963a] in mainline
- Files:
-
- 2 deleted
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
HelenOS.config
rf27ada7 r25e963a 505 505 ! [CONFIG_START_BD=y] CONFIG_MOUNT_DATA (n/y) 506 506 507 % Write core files508 ! CONFIG_ WRITE_CORE_FILES (n/y)507 % Verbose task dumps 508 ! CONFIG_VERBOSE_DUMPS (n/y) -
uspace/app/taskdump/Makefile
rf27ada7 r25e963a 34 34 35 35 SOURCES = \ 36 elf_core.c \37 36 taskdump.c \ 38 37 symtab.c -
uspace/app/taskdump/include/elf.h
rf27ada7 r25e963a 148 148 #define SHF_MASKPROC 0xf0000000 149 149 150 /** Macros for decomposing elf_symbol.st_info into binging and type */151 #define ELF_ST_BIND(i) ((i) >> 4)152 #define ELF_ST_TYPE(i) ((i) & 0x0f)153 #define ELF_ST_INFO(b, t) (((b) << 4) + ((t) & 0x0f))154 155 150 /** 156 151 * Symbol binding -
uspace/app/taskdump/symtab.c
rf27ada7 r25e963a 206 206 size_t i; 207 207 char *sname; 208 unsigned stype;209 208 210 209 for (i = 0; i < st->sym_size / sizeof(elf_symbol_t); ++i) { 211 210 if (st->sym[i].st_name == 0) 212 continue;213 214 stype = ELF_ST_TYPE(st->sym[i].st_info);215 if (stype != STT_OBJECT && stype != STT_FUNC)216 211 continue; 217 212 … … 245 240 uintptr_t saddr, best_addr; 246 241 char *sname, *best_name; 247 unsigned stype;248 242 249 243 best_name = NULL; … … 252 246 for (i = 0; i < st->sym_size / sizeof(elf_symbol_t); ++i) { 253 247 if (st->sym[i].st_name == 0) 254 continue;255 256 stype = ELF_ST_TYPE(st->sym[i].st_info);257 if (stype != STT_OBJECT && stype != STT_FUNC)258 248 continue; 259 249 -
uspace/app/taskdump/taskdump.c
rf27ada7 r25e963a 40 40 #include <udebug.h> 41 41 #include <task.h> 42 #include < as.h>42 #include <kernel/mm/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>52 51 #include <stacktrace.h> 53 52 … … 59 58 static int phoneid; 60 59 static task_id_t task_id; 61 static bool write_core_file; 62 static char *core_file_name; 60 static bool dump_memory; 63 61 static char *app_name; 64 62 static symtab_t *app_symtab; … … 82 80 int rc; 83 81 82 /* 83 * FIXME: The stdio module cannot currently detect whether we are 84 * writing to a console or file. This workaround make file output 85 * faster. 86 */ 87 setvbuf(stdout, NULL, _IOFBF, 32768); 88 84 89 printf("Task Dump Utility\n"); 85 write_core_file= false;90 dump_memory = false; 86 91 87 92 if (parse_args(argc, argv) < 0) … … 167 172 return -1; 168 173 } 169 } else if (arg[1] == 'c' && arg[2] == '\0') { 170 write_core_file = true; 171 172 --argc; ++argv; 173 core_file_name = *argv; 174 } else if (arg[1] == 'm' && arg[2] == '\0') { 175 dump_memory = true; 174 176 } else { 175 177 printf("Uknown option '%s'\n", arg[0]); … … 201 203 static void print_syntax(void) 202 204 { 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");205 printf("Syntax: taskdump [-m] -t <task_id>\n"); 206 printf("\t-m\tDump memory area contents.\n"); 205 207 printf("\t-t <task_id>\tWhich task to dump.\n"); 206 208 } … … 295 297 (ainfo_buf[i].flags & AS_AREA_CACHEABLE) ? 'C' : '-', 296 298 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'); 304 } 297 305 } 298 306 299 307 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;307 }308 }309 308 310 309 free(ainfo_buf); -
uspace/srv/taskmon/taskmon.c
rf27ada7 r25e963a 49 49 static void fault_event(ipc_callid_t callid, ipc_call_t *call) 50 50 { 51 char *argv[ 6];51 char *argv[11]; 52 52 char *fname; 53 53 char *dump_fname; … … 66 66 } 67 67 68 if (asprintf(&dump_fname, "/ data/core" PRIuTASKID, taskid) < 0) {68 if (asprintf(&dump_fname, "/scratch/d" PRIuTASKID ".txt", taskid) < 0) { 69 69 printf("Memory allocation failed.\n"); 70 70 return; … … 73 73 printf(NAME ": Task %" PRIuTASKID " fault in thread %p.\n", taskid, thread); 74 74 75 #ifdef CONFIG_WRITE_CORE_FILES 76 argv[0] = "/app/taskdump"; 77 argv[1] = "-c"; 78 argv[2] = dump_fname; 79 argv[3] = "-t"; 80 argv[4] = s_taskid; 81 argv[5] = NULL; 75 #ifdef CONFIG_VERBOSE_DUMPS 76 argv[0] = "/app/redir"; 77 argv[1] = "-i"; 78 argv[2] = "/readme"; 79 argv[3] = "-o"; 80 argv[4] = dump_fname; 81 argv[5] = "--"; 82 argv[6] = "/app/taskdump"; 83 argv[7] = "-m"; 84 argv[8] = "-t"; 85 argv[9] = s_taskid; 86 argv[10] = NULL; 82 87 #else 83 88 argv[0] = "/app/taskdump";
Note:
See TracChangeset
for help on using the changeset viewer.