Changeset 2314381 in mainline for uspace/lib/libc/generic
- Timestamp:
- 2010-01-26T22:49:26Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- bca408b
- Parents:
- bb0d3d24 (diff), 3698e44 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- uspace/lib/libc/generic
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/libc/generic/stacktrace.c
rbb0d3d24 r2314381 1 1 /* 2 2 * Copyright (c) 2009 Jakub Jermar 3 * Copyright (c) 2010 Jiri Svoboda 3 4 * All rights reserved. 4 5 * … … 36 37 #include <stdio.h> 37 38 #include <sys/types.h> 39 #include <errno.h> 38 40 39 void stack_trace_fp_pc(uintptr_t fp, uintptr_t pc) 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) 40 44 { 41 while (frame_pointer_validate(fp)) { 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)) { 42 52 printf("%p: %p()\n", fp, pc); 43 pc = return_address_get(fp); 44 fp = frame_pointer_prev(fp); 53 (void) stacktrace_ra_get(&st, fp, &pc); 54 (void) stacktrace_fp_prev(&st, fp, &nfp); 55 fp = nfp; 45 56 } 46 57 } 47 58 48 void stack _trace(void)59 void stacktrace_print(void) 49 60 { 50 stack_trace_fp_pc(frame_pointer_get(), program_counter_get()); 61 stacktrace_prepare(); 62 stacktrace_print_fp_pc(stacktrace_fp_get(), stacktrace_pc_get()); 51 63 /* 52 64 * Prevent the tail call optimization of the previous call by 53 65 * making it a non-tail call. 54 66 */ 55 (void) frame_pointer_get(); 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; 56 75 } 57 76 -
uspace/lib/libc/generic/udebug.c
rbb0d3d24 r2314381 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 71 86 int udebug_areas_read(int phoneid, void *buffer, size_t n, 72 87 size_t *copied, size_t *needed) … … 84 99 } 85 100 86 87 101 int udebug_mem_read(int phoneid, void *buffer, uintptr_t addr, size_t n) 88 102 { … … 94 108 { 95 109 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, 96 116 tid, (sysarg_t)buffer); 97 117 }
Note:
See TracChangeset
for help on using the changeset viewer.