Changes in / [2314381:bb0d3d24] in mainline
- Files:
-
- 7 added
- 25 deleted
- 35 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/include/udebug/udebug.h
r2314381 rbb0d3d24 27 27 */ 28 28 29 /** @addtogroup generic 29 /** @addtogroup generic 30 30 * @{ 31 31 */ … … 83 83 UDEBUG_M_ARGS_READ, 84 84 85 /** Read thread's userspace register state (istate_t).86 *87 * - ARG2 - thread identification88 * - ARG3 - destination address in the caller's address space89 *90 * or, on error, retval will be91 * - ENOENT - thread does not exist92 * - EBUSY - register state not available93 */94 UDEBUG_M_REGS_READ,95 96 85 /** Read the list of the debugged tasks's threads. 97 86 * … … 107 96 */ 108 97 UDEBUG_M_THREAD_READ, 109 110 /** Read the name of the debugged task.111 *112 * - ARG2 - destination address in the caller's address space113 * - ARG3 - size of receiving buffer in bytes114 *115 * The kernel fills the buffer with a non-terminated string.116 *117 * - ARG2 - number of bytes that were actually copied118 * - ARG3 - number of bytes of the complete data119 *120 */121 UDEBUG_M_NAME_READ,122 98 123 99 /** Read the list of the debugged task's address space areas. … … 146 122 } udebug_method_t; 147 123 148 124 149 125 typedef enum { 150 126 UDEBUG_EVENT_FINISHED = 1, /**< Debuging session has finished */ … … 242 218 243 219 int udebug_task_cleanup(struct task *ta); 244 void udebug_thread_fault(void);245 220 246 221 #endif -
kernel/generic/include/udebug/udebug_ops.h
r2314381 rbb0d3d24 47 47 int udebug_thread_read(void **buffer, size_t buf_size, size_t *stored, 48 48 size_t *needed); 49 int udebug_name_read(char **data, size_t *data_size);50 49 int udebug_args_read(thread_t *t, void **buffer); 51 52 int udebug_regs_read(thread_t *t, void **buffer);53 50 54 51 int udebug_mem_read(unative_t uspace_addr, size_t n, void **buffer); -
kernel/generic/src/interrupt/interrupt.c
r2314381 rbb0d3d24 134 134 printf("\n"); 135 135 136 /*137 * Userspace can subscribe for FAULT events to take action138 * whenever a thread faults. (E.g. take a dump, run a debugger).139 * The notification is always available, but unless Udebug is enabled,140 * that's all you get.141 */142 136 if (event_is_subscribed(EVENT_FAULT)) { 143 /* Notify the subscriber that a fault occurred. */144 137 event_notify_3(EVENT_FAULT, LOWER32(TASK->taskid), 145 138 UPPER32(TASK->taskid), (unative_t) THREAD); 139 } 146 140 147 141 #ifdef CONFIG_UDEBUG 148 /* Wait for a debugging session. */ 149 udebug_thread_fault(); 150 #endif 151 } 142 /* Wait until a debugger attends to us. */ 143 mutex_lock(&THREAD->udebug.lock); 144 while (!THREAD->udebug.active) 145 condvar_wait(&THREAD->udebug.active_cv, &THREAD->udebug.lock); 146 mutex_unlock(&THREAD->udebug.lock); 147 148 udebug_stoppable_begin(); 149 udebug_stoppable_end(); 150 151 /* Make sure the debugging session is over before proceeding. */ 152 mutex_lock(&THREAD->udebug.lock); 153 while (THREAD->udebug.active) 154 condvar_wait(&THREAD->udebug.active_cv, &THREAD->udebug.lock); 155 mutex_unlock(&THREAD->udebug.lock); 156 #endif 152 157 153 158 task_kill(task->taskid); -
kernel/generic/src/udebug/udebug.c
r2314381 rbb0d3d24 460 460 } 461 461 462 /** Wait for debugger to handle a fault in this thread.463 *464 * When a thread faults and someone is subscribed to the FAULT kernel event,465 * this function is called to wait for a debugging session to give userspace466 * a chance to examine the faulting thead/task. When the debugging session467 * is over, this function returns (so that thread/task cleanup can continue).468 */469 void udebug_thread_fault(void)470 {471 udebug_stoppable_begin();472 473 /* Wait until a debugger attends to us. */474 mutex_lock(&THREAD->udebug.lock);475 while (!THREAD->udebug.active)476 condvar_wait(&THREAD->udebug.active_cv, &THREAD->udebug.lock);477 mutex_unlock(&THREAD->udebug.lock);478 479 /* Make sure the debugging session is over before proceeding. */480 mutex_lock(&THREAD->udebug.lock);481 while (THREAD->udebug.active)482 condvar_wait(&THREAD->udebug.active_cv, &THREAD->udebug.lock);483 mutex_unlock(&THREAD->udebug.lock);484 485 udebug_stoppable_end();486 }487 462 488 463 /** @} -
kernel/generic/src/udebug/udebug_ipc.c
r2314381 rbb0d3d24 202 202 } 203 203 204 /** Process a NAME_READ call.205 *206 * Returns a string containing the name of the task.207 *208 * @param call The call structure.209 */210 static void udebug_receive_name_read(call_t *call)211 {212 unative_t uspace_addr;213 unative_t to_copy;214 size_t data_size;215 size_t buf_size;216 void *data;217 218 uspace_addr = IPC_GET_ARG2(call->data); /* Destination address */219 buf_size = IPC_GET_ARG3(call->data); /* Dest. buffer size */220 221 /*222 * Read task name.223 */224 udebug_name_read((char **) &data, &data_size);225 226 /* Copy MAX(buf_size, data_size) bytes */227 228 if (buf_size > data_size)229 to_copy = data_size;230 else231 to_copy = buf_size;232 233 /*234 * Make use of call->buffer to transfer data to caller's userspace235 */236 237 IPC_SET_RETVAL(call->data, 0);238 /* ARG1=dest, ARG2=size as in IPC_M_DATA_READ so that239 same code in process_answer() can be used240 (no way to distinguish method in answer) */241 IPC_SET_ARG1(call->data, uspace_addr);242 IPC_SET_ARG2(call->data, to_copy);243 244 IPC_SET_ARG3(call->data, data_size);245 call->buffer = data;246 247 ipc_answer(&TASK->kb.box, call);248 }249 250 204 /** Process an AREAS_READ call. 251 205 * … … 333 287 ipc_answer(&TASK->kb.box, call); 334 288 } 335 336 /** Receive a REGS_READ call.337 *338 * Reads the thread's register state (istate structure).339 */340 static void udebug_receive_regs_read(call_t *call)341 {342 thread_t *t;343 unative_t uspace_addr;344 unative_t to_copy;345 void *buffer;346 int rc;347 348 t = (thread_t *) IPC_GET_ARG2(call->data);349 350 rc = udebug_regs_read(t, &buffer);351 if (rc < 0) {352 IPC_SET_RETVAL(call->data, rc);353 ipc_answer(&TASK->kb.box, call);354 return;355 }356 357 /*358 * Make use of call->buffer to transfer data to caller's userspace359 */360 361 uspace_addr = IPC_GET_ARG3(call->data);362 to_copy = sizeof(istate_t);363 364 IPC_SET_RETVAL(call->data, 0);365 /* ARG1=dest, ARG2=size as in IPC_M_DATA_READ so that366 same code in process_answer() can be used367 (no way to distinguish method in answer) */368 IPC_SET_ARG1(call->data, uspace_addr);369 IPC_SET_ARG2(call->data, to_copy);370 371 call->buffer = buffer;372 373 ipc_answer(&TASK->kb.box, call);374 }375 376 289 377 290 /** Process an MEM_READ call. … … 455 368 udebug_receive_thread_read(call); 456 369 break; 457 case UDEBUG_M_NAME_READ:458 udebug_receive_name_read(call);459 break;460 370 case UDEBUG_M_AREAS_READ: 461 371 udebug_receive_areas_read(call); … … 464 374 udebug_receive_args_read(call); 465 375 break; 466 case UDEBUG_M_REGS_READ:467 udebug_receive_regs_read(call);468 break;469 376 case UDEBUG_M_MEM_READ: 470 377 udebug_receive_mem_read(call); -
kernel/generic/src/udebug/udebug_ops.c
r2314381 rbb0d3d24 46 46 #include <errno.h> 47 47 #include <print.h> 48 #include <string.h>49 48 #include <syscall/copy.h> 50 49 #include <ipc/ipc.h> … … 440 439 } 441 440 442 /** Read task name.443 *444 * Returns task name as non-terminated string in a newly allocated buffer.445 * Also returns the size of the data.446 *447 * @param data Place to store pointer to newly allocated block.448 * @param data_size Place to store size of the data.449 *450 * @returns EOK.451 */452 int udebug_name_read(char **data, size_t *data_size)453 {454 size_t name_size;455 456 name_size = str_size(TASK->name) + 1;457 *data = malloc(name_size, 0);458 *data_size = name_size;459 460 memcpy(*data, TASK->name, name_size);461 462 return 0;463 }464 465 441 /** Read the arguments of a system call. 466 442 * … … 473 449 * this function will fail with an EINVAL error code. 474 450 * 475 * @param t Thread where call arguments are to be read. 476 * @param buffer Place to store pointer to new buffer. 477 * @return EOK on success, ENOENT if @a t is invalid, EINVAL 478 * if thread state is not valid for this operation. 451 * @param buffer The buffer for storing thread hashes. 479 452 */ 480 453 int udebug_args_read(thread_t *t, void **buffer) … … 508 481 } 509 482 510 /** Read the register state of the thread.511 *512 * The contents of the thread's istate structure are copied to a newly513 * allocated buffer and a pointer to it is written to @a buffer. The size of514 * the buffer will be sizeof(istate_t).515 *516 * Currently register state cannot be read if the thread is inside a system517 * call (as opposed to an exception). This is an implementation limit.518 *519 * @param t Thread whose state is to be read.520 * @param buffer Place to store pointer to new buffer.521 * @return EOK on success, ENOENT if @a t is invalid, EINVAL522 * if thread is not in valid state, EBUSY if istate523 * is not available.524 */525 int udebug_regs_read(thread_t *t, void **buffer)526 {527 istate_t *state, *state_buf;528 int rc;529 530 /* Prepare a buffer to hold the data. */531 state_buf = malloc(sizeof(istate_t), 0);532 533 /* On success, this will lock t->udebug.lock */534 rc = _thread_op_begin(t, false);535 if (rc != EOK) {536 return rc;537 }538 539 state = t->udebug.uspace_state;540 if (state == NULL) {541 _thread_op_end(t);542 return EBUSY;543 }544 545 /* Copy to the allocated buffer */546 memcpy(state_buf, state, sizeof(istate_t));547 548 _thread_op_end(t);549 550 *buffer = (void *) state_buf;551 return 0;552 }553 554 483 /** Read the memory of the debugged task. 555 484 * -
uspace/app/taskdump/Makefile
r2314381 rbb0d3d24 29 29 USPACE_PREFIX = ../.. 30 30 LIBS = $(LIBC_PREFIX)/libc.a 31 EXTRA_CFLAGS = -Iinclude32 31 33 32 OUTPUT = taskdump 34 33 35 34 SOURCES = \ 36 taskdump.c \ 37 symtab.c 35 taskdump.c 38 36 39 37 include ../Makefile.common -
uspace/app/taskdump/taskdump.c
r2314381 rbb0d3d24 41 41 #include <task.h> 42 42 #include <kernel/mm/as.h> 43 #include <libarch/istate.h>44 43 #include <macros.h> 45 44 #include <assert.h> 46 45 #include <bool.h> 47 46 48 #include <symtab.h>49 #include <stacktrace.h>50 51 47 #define LINE_BYTES 16 52 48 … … 57 53 static task_id_t task_id; 58 54 static bool dump_memory; 59 static char *app_name;60 static symtab_t *app_symtab;61 55 62 56 static int connect_task(task_id_t task_id); 63 57 static int parse_args(int argc, char *argv[]); 64 static void print_syntax( void);58 static void print_syntax(); 65 59 static int threads_dump(void); 66 static int thread_dump(uintptr_t thash);67 60 static int areas_dump(void); 68 61 static int area_dump(as_area_info_t *area); 69 62 static void hex_dump(uintptr_t addr, void *buffer, size_t size); 70 static int td_read_uintptr(void *arg, uintptr_t addr, uintptr_t *value);71 72 static void autoload_syms(void);73 static char *get_app_task_name(void);74 static char *fmt_sym_address(uintptr_t addr);75 63 76 64 int main(int argc, char *argv[]) … … 97 85 } 98 86 99 app_name = get_app_task_name(); 100 app_symtab = NULL; 101 102 printf("Dumping task '%s' (task ID %lld).\n", app_name, task_id); 103 autoload_syms(); 104 putchar('\n'); 87 printf("Dumping task %lld.\n\n", task_id); 105 88 106 89 rc = threads_dump(); … … 199 182 } 200 183 201 static void print_syntax( void)184 static void print_syntax() 202 185 { 203 186 printf("Syntax: taskdump [-m] -t <task_id>\n"); … … 246 229 for (i = 0; i < n_threads; i++) { 247 230 printf(" [%d] hash: 0x%lx\n", 1+i, thash_buf[i]); 248 249 thread_dump(thash_buf[i]);250 231 } 251 232 putchar('\n'); … … 310 291 } 311 292 312 static int thread_dump(uintptr_t thash)313 {314 istate_t istate;315 uintptr_t pc, fp, nfp;316 stacktrace_t st;317 char *sym_pc;318 int rc;319 320 rc = udebug_regs_read(phoneid, thash, &istate);321 if (rc < 0) {322 printf("Failed reading registers (%d).\n", rc);323 return EIO;324 }325 326 pc = istate_get_pc(&istate);327 fp = istate_get_fp(&istate);328 329 printf("Thread 0x%lx crashed at PC 0x%lx. FP 0x%lx\n", thash, pc, fp);330 331 st.op_arg = NULL;332 st.read_uintptr = td_read_uintptr;333 334 while (stacktrace_fp_valid(&st, fp)) {335 sym_pc = fmt_sym_address(pc);336 printf(" %p: %s()\n", fp, sym_pc);337 free(sym_pc);338 339 rc = stacktrace_ra_get(&st, fp, &pc);340 if (rc != EOK)341 return rc;342 343 rc = stacktrace_fp_prev(&st, fp, &nfp);344 if (rc != EOK)345 return rc;346 347 fp = nfp;348 }349 350 return EOK;351 }352 353 293 static int area_dump(as_area_info_t *area) 354 294 { … … 410 350 } 411 351 412 static int td_read_uintptr(void *arg, uintptr_t addr, uintptr_t *value)413 {414 uintptr_t data;415 int rc;416 417 (void) arg;418 419 rc = udebug_mem_read(phoneid, &data, addr, sizeof(data));420 if (rc < 0) {421 printf("Warning: udebug_mem_read() failed.\n");422 return rc;423 }424 425 *value = data;426 return EOK;427 }428 429 /** Attempt to find the right executable file and load the symbol table. */430 static void autoload_syms(void)431 {432 char *file_name;433 int rc;434 435 assert(app_name != NULL);436 assert(app_symtab == NULL);437 438 rc = asprintf(&file_name, "/app/%s", app_name);439 if (rc < 0) {440 printf("Memory allocation failure.\n");441 exit(1);442 }443 444 rc = symtab_load(file_name, &app_symtab);445 if (rc == EOK) {446 printf("Loaded symbol table from %s\n", file_name);447 free(file_name);448 return;449 }450 451 free(file_name);452 453 rc = asprintf(&file_name, "/srv/%s", app_name);454 if (rc < 0) {455 printf("Memory allocation failure.\n");456 exit(1);457 }458 459 rc = symtab_load("/srv/xyz", &app_symtab);460 if (rc == EOK) {461 printf("Loaded symbol table from %s\n", file_name);462 free(file_name);463 return;464 }465 466 free(file_name);467 printf("Failed autoloading symbol table.\n");468 }469 470 static char *get_app_task_name(void)471 {472 char dummy_buf;473 size_t copied, needed, name_size;474 char *name;475 int rc;476 477 rc = udebug_name_read(phoneid, &dummy_buf, 0, &copied, &needed);478 if (rc < 0)479 return NULL;480 481 name_size = needed;482 name = malloc(name_size + 1);483 rc = udebug_name_read(phoneid, name, name_size, &copied, &needed);484 if (rc < 0) {485 free(name);486 return NULL;487 }488 489 assert(copied == name_size);490 assert(copied == needed);491 name[copied] = '\0';492 493 return name;494 }495 496 /** Format address in symbolic form.497 *498 * Formats address as <symbol_name>+<offset> (<address>), if possible,499 * otherwise as <address>.500 *501 * @param addr Address to format.502 * @return Newly allocated string, address in symbolic form.503 */504 static char *fmt_sym_address(uintptr_t addr)505 {506 char *name;507 size_t offs;508 int rc;509 char *str;510 511 if (app_symtab != NULL) {512 rc = symtab_addr_to_name(app_symtab, addr, &name, &offs);513 } else {514 rc = ENOTSUP;515 }516 517 if (rc == EOK) {518 rc = asprintf(&str, "(%p) %s+%p", addr, name, offs);519 } else {520 rc = asprintf(&str, "%p", addr);521 }522 523 if (rc < 0) {524 printf("Memory allocation error.\n");525 exit(1);526 }527 528 return str;529 }530 531 352 /** @} 532 353 */ -
uspace/lib/libc/arch/amd64/Makefile.inc
r2314381 rbb0d3d24 37 37 arch/$(UARCH)/src/fibril.S \ 38 38 arch/$(UARCH)/src/tls.c \ 39 arch/$(UARCH)/src/stacktrace.c \ 40 arch/$(UARCH)/src/stacktrace_asm.S 39 arch/$(UARCH)/src/stacktrace.S 41 40 42 41 GCC_CFLAGS += -fno-omit-frame-pointer -
uspace/lib/libc/arch/amd64/include/types.h
r2314381 rbb0d3d24 36 36 #define LIBC_amd64_TYPES_H_ 37 37 38 #define __64_BITS__39 40 38 typedef unsigned long long sysarg_t; 41 39 -
uspace/lib/libc/arch/arm32/Makefile.inc
r2314381 rbb0d3d24 38 38 arch/$(UARCH)/src/tls.c \ 39 39 arch/$(UARCH)/src/eabi.S \ 40 arch/$(UARCH)/src/stacktrace.c \ 41 arch/$(UARCH)/src/stacktrace_asm.S 40 arch/$(UARCH)/src/stacktrace.S 42 41 43 42 GCC_CFLAGS += -ffixed-r9 -mtp=soft -mapcs-frame -fno-omit-frame-pointer -
uspace/lib/libc/arch/arm32/include/types.h
r2314381 rbb0d3d24 37 37 #define LIBC_arm32_TYPES_H_ 38 38 39 #define __32_BITS__40 41 39 typedef unsigned int sysarg_t; 42 40 -
uspace/lib/libc/arch/ia32/Makefile.inc
r2314381 rbb0d3d24 38 38 arch/$(UARCH)/src/tls.c \ 39 39 arch/$(UARCH)/src/setjmp.S \ 40 arch/$(UARCH)/src/stacktrace.c \ 41 arch/$(UARCH)/src/stacktrace_asm.S 40 arch/$(UARCH)/src/stacktrace.S 42 41 43 42 GCC_CFLAGS += -march=pentium -
uspace/lib/libc/arch/ia32/include/types.h
r2314381 rbb0d3d24 36 36 #define LIBC_ia32_TYPES_H_ 37 37 38 #define __32_BITS__39 40 38 typedef unsigned int sysarg_t; 41 39 -
uspace/lib/libc/arch/ia64/Makefile.inc
r2314381 rbb0d3d24 37 37 arch/$(UARCH)/src/tls.c \ 38 38 arch/$(UARCH)/src/ddi.c \ 39 arch/$(UARCH)/src/stacktrace.c \ 40 arch/$(UARCH)/src/stacktrace_asm.S 39 arch/$(UARCH)/src/stacktrace.S 41 40 42 41 GCC_CFLAGS += -fno-unwind-tables -
uspace/lib/libc/arch/ia64/include/types.h
r2314381 rbb0d3d24 36 36 #define LIBC_ia64_TYPES_H_ 37 37 38 #define __64_BITS__39 40 38 typedef unsigned long long sysarg_t; 41 39 -
uspace/lib/libc/arch/mips32/Makefile.inc
r2314381 rbb0d3d24 36 36 arch/$(UARCH)/src/fibril.S \ 37 37 arch/$(UARCH)/src/tls.c \ 38 arch/$(UARCH)/src/stacktrace.c \ 39 arch/$(UARCH)/src/stacktrace_asm.S 38 arch/$(UARCH)/src/stacktrace.S 40 39 41 40 GCC_CFLAGS += -mips3 -
uspace/lib/libc/arch/mips32/include/types.h
r2314381 rbb0d3d24 37 37 #define LIBC_mips32_TYPES_H_ 38 38 39 #define __32_BITS__40 41 39 typedef unsigned int sysarg_t; 42 40 -
uspace/lib/libc/arch/mips32eb/Makefile.inc
r2314381 rbb0d3d24 36 36 arch/$(UARCH)/src/fibril.S \ 37 37 arch/$(UARCH)/src/tls.c \ 38 arch/$(UARCH)/src/stacktrace.c \ 39 arch/$(UARCH)/src/stacktrace_asm.S 38 arch/$(UARCH)/src/stacktrace.S 40 39 41 40 GCC_CFLAGS += -mips3 -
uspace/lib/libc/arch/ppc32/Makefile.inc
r2314381 rbb0d3d24 36 36 arch/$(UARCH)/src/fibril.S \ 37 37 arch/$(UARCH)/src/tls.c \ 38 arch/$(UARCH)/src/stacktrace.c \ 39 arch/$(UARCH)/src/stacktrace_asm.S 38 arch/$(UARCH)/src/stacktrace.S 40 39 41 40 GCC_CFLAGS += -mcpu=powerpc -msoft-float -m32 -
uspace/lib/libc/arch/ppc32/include/types.h
r2314381 rbb0d3d24 36 36 #define LIBC_ppc32_TYPES_H_ 37 37 38 #define __32_BITS__39 40 38 typedef unsigned int sysarg_t; 41 39 -
uspace/lib/libc/arch/sparc64/Makefile.inc
r2314381 rbb0d3d24 35 35 ARCH_SOURCES += arch/$(UARCH)/src/fibril.S \ 36 36 arch/$(UARCH)/src/tls.c \ 37 arch/$(UARCH)/src/stacktrace.c \ 38 arch/$(UARCH)/src/stacktrace_asm.S 37 arch/$(UARCH)/src/stacktrace.S 39 38 40 39 GCC_CFLAGS += -mcpu=ultrasparc -m64 -
uspace/lib/libc/arch/sparc64/include/types.h
r2314381 rbb0d3d24 36 36 #define LIBC_sparc64_TYPES_H_ 37 37 38 #define __64_BITS__39 40 38 typedef unsigned long sysarg_t; 41 39 -
uspace/lib/libc/generic/stacktrace.c
r2314381 rbb0d3d24 1 1 /* 2 2 * Copyright (c) 2009 Jakub Jermar 3 * Copyright (c) 2010 Jiri Svoboda4 3 * All rights reserved. 5 4 * … … 37 36 #include <stdio.h> 38 37 #include <sys/types.h> 39 #include <errno.h>40 38 41 static int stacktrace_read_uintptr(void *arg, uintptr_t addr, uintptr_t *data); 42 43 void stacktrace_print_fp_pc(uintptr_t fp, uintptr_t pc) 39 void stack_trace_fp_pc(uintptr_t fp, uintptr_t pc) 44 40 { 45 stacktrace_t st; 46 uintptr_t nfp; 47 48 st.op_arg = NULL; 49 st.read_uintptr = stacktrace_read_uintptr; 50 51 while (stacktrace_fp_valid(&st, fp)) { 41 while (frame_pointer_validate(fp)) { 52 42 printf("%p: %p()\n", fp, pc); 53 (void) stacktrace_ra_get(&st, fp, &pc); 54 (void) stacktrace_fp_prev(&st, fp, &nfp); 55 fp = nfp; 43 pc = return_address_get(fp); 44 fp = frame_pointer_prev(fp); 56 45 } 57 46 } 58 47 59 void stack trace_print(void)48 void stack_trace(void) 60 49 { 61 stacktrace_prepare(); 62 stacktrace_print_fp_pc(stacktrace_fp_get(), stacktrace_pc_get()); 50 stack_trace_fp_pc(frame_pointer_get(), program_counter_get()); 63 51 /* 64 52 * Prevent the tail call optimization of the previous call by 65 53 * making it a non-tail call. 66 54 */ 67 (void) stacktrace_fp_get(); 68 } 69 70 static int stacktrace_read_uintptr(void *arg, uintptr_t addr, uintptr_t *data) 71 { 72 (void) arg; 73 *data = *((uintptr_t *) addr); 74 return EOK; 55 (void) frame_pointer_get(); 75 56 } 76 57 -
uspace/lib/libc/generic/udebug.c
r2314381 rbb0d3d24 69 69 } 70 70 71 int udebug_name_read(int phoneid, void *buffer, size_t n,72 size_t *copied, size_t *needed)73 {74 ipcarg_t a_copied, a_needed;75 int rc;76 77 rc = async_req_3_3(phoneid, IPC_M_DEBUG_ALL, UDEBUG_M_NAME_READ,78 (sysarg_t)buffer, n, NULL, &a_copied, &a_needed);79 80 *copied = (size_t)a_copied;81 *needed = (size_t)a_needed;82 83 return rc;84 }85 86 71 int udebug_areas_read(int phoneid, void *buffer, size_t n, 87 72 size_t *copied, size_t *needed) … … 99 84 } 100 85 86 101 87 int udebug_mem_read(int phoneid, void *buffer, uintptr_t addr, size_t n) 102 88 { … … 108 94 { 109 95 return async_req_3_0(phoneid, IPC_M_DEBUG_ALL, UDEBUG_M_ARGS_READ, 110 tid, (sysarg_t)buffer);111 }112 113 int udebug_regs_read(int phoneid, thash_t tid, void *buffer)114 {115 return async_req_3_0(phoneid, IPC_M_DEBUG_ALL, UDEBUG_M_REGS_READ,116 96 tid, (sysarg_t)buffer); 117 97 } -
uspace/lib/libc/include/stacktrace.h
r2314381 rbb0d3d24 1 1 /* 2 2 * Copyright (c) 2009 Jakub Jermar 3 * Copyright (c) 2010 Jiri Svoboda4 3 * All rights reserved. 5 4 * … … 40 39 #include <bool.h> 41 40 42 typedef struct { 43 void *op_arg; 44 int (*read_uintptr)(void *, uintptr_t, uintptr_t *); 45 } stacktrace_t; 46 47 extern void stacktrace_print(void); 48 extern void stacktrace_print_fp_pc(uintptr_t, uintptr_t); 41 extern void stack_trace(void); 42 extern void stack_trace_fp_pc(uintptr_t, uintptr_t); 49 43 50 44 /* 51 45 * The following interface is to be implemented by each architecture. 52 46 */ 53 extern bool stacktrace_fp_valid(stacktrace_t *, uintptr_t); 54 extern int stacktrace_fp_prev(stacktrace_t *, uintptr_t, uintptr_t *); 55 extern int stacktrace_ra_get(stacktrace_t *, uintptr_t, uintptr_t *); 56 57 extern void stacktrace_prepare(void); 58 extern uintptr_t stacktrace_fp_get(void); 59 extern uintptr_t stacktrace_pc_get(); 47 extern bool frame_pointer_validate(uintptr_t); 48 extern uintptr_t frame_pointer_get(void); 49 extern uintptr_t frame_pointer_prev(uintptr_t); 50 extern uintptr_t return_address_get(uintptr_t); 51 extern uintptr_t program_counter_get(); 60 52 61 53 #endif -
uspace/lib/libc/include/stdlib.h
r2314381 rbb0d3d24 42 42 #define abort() \ 43 43 do { \ 44 stack trace_print(); \44 stack_trace(); \ 45 45 _exit(1); \ 46 46 } while (0) -
uspace/lib/libc/include/udebug.h
r2314381 rbb0d3d24 47 47 int udebug_thread_read(int phoneid, void *buffer, size_t n, 48 48 size_t *copied, size_t *needed); 49 int udebug_name_read(int phoneid, void *buffer, size_t n,50 size_t *copied, size_t *needed);51 49 int udebug_areas_read(int phoneid, void *buffer, size_t n, 52 50 size_t *copied, size_t *needed); 53 51 int udebug_mem_read(int phoneid, void *buffer, uintptr_t addr, size_t n); 54 52 int udebug_args_read(int phoneid, thash_t tid, sysarg_t *buffer); 55 int udebug_regs_read(int phoneid, thash_t tid, void *buffer);56 53 int udebug_go(int phoneid, thash_t tid, udebug_event_t *ev_type, 57 54 sysarg_t *val0, sysarg_t *val1); -
uspace/srv/loader/arch/amd64/Makefile.inc
r2314381 rbb0d3d24 27 27 # 28 28 29 EXTRA_CFLAGS = -D__64_BITS__ 29 30 ARCH_SOURCES := arch/$(UARCH)/amd64.s -
uspace/srv/loader/arch/arm32/Makefile.inc
r2314381 rbb0d3d24 27 27 # 28 28 29 EXTRA_CFLAGS = -D__32_BITS__ 29 30 ARCH_SOURCES := arch/$(UARCH)/arm32.s -
uspace/srv/loader/arch/ia32/Makefile.inc
r2314381 rbb0d3d24 27 27 # 28 28 29 EXTRA_CFLAGS = -D__32_BITS__ 29 30 ARCH_SOURCES := arch/$(UARCH)/ia32.s -
uspace/srv/loader/arch/ia64/Makefile.inc
r2314381 rbb0d3d24 27 27 # 28 28 29 EXTRA_CFLAGS = -D__64_BITS__ 29 30 ARCH_SOURCES := arch/$(UARCH)/ia64.s 30 31 AFLAGS += -xexplicit -
uspace/srv/loader/arch/mips32/Makefile.inc
r2314381 rbb0d3d24 27 27 # 28 28 29 EXTRA_CFLAGS = -D__32_BITS__ 29 30 ARCH_SOURCES := arch/$(UARCH)/mips32.s -
uspace/srv/loader/arch/ppc32/Makefile.inc
r2314381 rbb0d3d24 27 27 # 28 28 29 EXTRA_CFLAGS = -D__32_BITS__ 29 30 ARCH_SOURCES := arch/$(UARCH)/ppc32.s -
uspace/srv/loader/arch/sparc64/Makefile.inc
r2314381 rbb0d3d24 27 27 # 28 28 29 EXTRA_CFLAGS = -D__64_BITS__ 29 30 ARCH_SOURCES := arch/$(UARCH)/sparc64.s
Note:
See TracChangeset
for help on using the changeset viewer.