Changes in uspace/app/taskdump/taskdump.c [6a343bdf:5baf209] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/taskdump/taskdump.c
r6a343bdf r5baf209 34 34 35 35 #include <async.h> 36 #include <elf/elf_linux.h> 36 37 #include <stdio.h> 37 38 #include <stdlib.h> … … 54 55 #define LINE_BYTES 16 55 56 56 static int phoneid;57 static async_sess_t *sess; 57 58 static task_id_t task_id; 58 59 static bool write_core_file; … … 73 74 static char *fmt_sym_address(uintptr_t addr); 74 75 76 static istate_t reg_state; 77 75 78 int main(int argc, char *argv[]) 76 79 { … … 104 107 printf("Failed dumping address space areas.\n"); 105 108 106 udebug_end( phoneid);107 async_hangup( phoneid);109 udebug_end(sess); 110 async_hangup(sess); 108 111 109 112 return 0; … … 112 115 static int connect_task(task_id_t task_id) 113 116 { 114 int rc; 115 116 rc = async_connect_kbox(task_id); 117 118 if (rc == ENOTSUP) { 119 printf("You do not have userspace debugging support " 120 "compiled in the kernel.\n"); 121 printf("Compile kernel with 'Support for userspace debuggers' " 122 "(CONFIG_UDEBUG) enabled.\n"); 123 return rc; 124 } 125 126 if (rc < 0) { 117 async_sess_t *ksess = async_connect_kbox(task_id); 118 119 if (!ksess) { 120 if (errno == ENOTSUP) { 121 printf("You do not have userspace debugging support " 122 "compiled in the kernel.\n"); 123 printf("Compile kernel with 'Support for userspace debuggers' " 124 "(CONFIG_UDEBUG) enabled.\n"); 125 return errno; 126 } 127 127 128 printf("Error connecting\n"); 128 printf("async_connect_kbox(%" PRIu64 ") -> %d ", task_id, rc); 129 return rc; 130 } 131 132 phoneid = rc; 133 134 rc = udebug_begin(phoneid); 129 printf("async_connect_kbox(%" PRIu64 ") -> %d ", task_id, errno); 130 return errno; 131 } 132 133 int rc = udebug_begin(ksess); 135 134 if (rc < 0) { 136 135 printf("udebug_begin() -> %d\n", rc); 137 136 return rc; 138 137 } 139 138 139 sess = ksess; 140 140 return 0; 141 141 } … … 213 213 214 214 /* TODO: See why NULL does not work. */ 215 rc = udebug_thread_read( phoneid, &dummy_buf, 0, &copied, &needed);215 rc = udebug_thread_read(sess, &dummy_buf, 0, &copied, &needed); 216 216 if (rc < 0) { 217 217 printf("udebug_thread_read() -> %d\n", rc); … … 227 227 thash_buf = malloc(buf_size); 228 228 229 rc = udebug_thread_read( phoneid, thash_buf, buf_size, &copied, &needed);229 rc = udebug_thread_read(sess, thash_buf, buf_size, &copied, &needed); 230 230 if (rc < 0) { 231 231 printf("udebug_thread_read() -> %d\n", rc); … … 262 262 int rc; 263 263 264 rc = udebug_areas_read( phoneid, &dummy_buf, 0, &copied, &needed);264 rc = udebug_areas_read(sess, &dummy_buf, 0, &copied, &needed); 265 265 if (rc < 0) { 266 266 printf("udebug_areas_read() -> %d\n", rc); … … 271 271 ainfo_buf = malloc(buf_size); 272 272 273 rc = udebug_areas_read( phoneid, ainfo_buf, buf_size, &copied, &needed);273 rc = udebug_areas_read(sess, ainfo_buf, buf_size, &copied, &needed); 274 274 if (rc < 0) { 275 275 printf("udebug_areas_read() -> %d\n", rc); … … 296 296 if (write_core_file) { 297 297 printf("Writing core file '%s'\n", core_file_name); 298 rc = elf_core_save(core_file_name, ainfo_buf, n_areas, phoneid); 298 299 rc = elf_core_save(core_file_name, ainfo_buf, n_areas, sess, 300 ®_state); 301 299 302 if (rc != EOK) { 300 303 printf("Failed writing core file.\n"); … … 316 319 int rc; 317 320 318 rc = udebug_regs_read( phoneid, thash, &istate);321 rc = udebug_regs_read(sess, thash, &istate); 319 322 if (rc < 0) { 320 323 printf("Failed reading registers (%d).\n", rc); … … 324 327 pc = istate_get_pc(&istate); 325 328 fp = istate_get_fp(&istate); 329 330 /* Save register state for dumping to core file later. */ 331 reg_state = istate; 326 332 327 333 sym_pc = fmt_sym_address(pc); … … 359 365 (void) arg; 360 366 361 rc = udebug_mem_read( phoneid, &data, addr, sizeof(data));367 rc = udebug_mem_read(sess, &data, addr, sizeof(data)); 362 368 if (rc < 0) { 363 369 printf("Warning: udebug_mem_read() failed.\n"); … … 430 436 int rc; 431 437 432 rc = udebug_name_read( phoneid, &dummy_buf, 0, &copied, &needed);438 rc = udebug_name_read(sess, &dummy_buf, 0, &copied, &needed); 433 439 if (rc < 0) 434 440 return NULL; … … 436 442 name_size = needed; 437 443 name = malloc(name_size + 1); 438 rc = udebug_name_read( phoneid, name, name_size, &copied, &needed);444 rc = udebug_name_read(sess, name, name_size, &copied, &needed); 439 445 if (rc < 0) { 440 446 free(name);
Note:
See TracChangeset
for help on using the changeset viewer.