Changeset 47246f4 in mainline
- Timestamp:
- 2009-12-30T18:34:15Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 01fda09
- Parents:
- ee2f1aae
- Location:
- uspace/lib/libc
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/libc/arch/amd64/src/entry.s
ree2f1aae r47246f4 39 39 __entry: 40 40 # 41 # Stop stack traces in this function.41 # Create the first stack frame. 42 42 # 43 xorq %rbp, %rbp 43 pushq $0 44 mov %rsp, %rbp 44 45 45 46 # %rdi was deliberately chosen as the first argument is also in %rdi -
uspace/lib/libc/arch/amd64/src/stacktrace.S
ree2f1aae r47246f4 33 33 .global frame_pointer_validate 34 34 .global return_address_get 35 .global program_counter_get 35 36 36 37 frame_pointer_get: … … 49 50 movq 8(%rdi), %rax 50 51 ret 52 53 program_counter_get: 54 movq (%rsp), %rax 55 ret -
uspace/lib/libc/arch/amd64/src/thread_entry.s
ree2f1aae r47246f4 36 36 __thread_entry: 37 37 # 38 # Stop stack traces in this function.38 # Create the first stack frame. 39 39 # 40 xorq %rbp, %rbp 40 pushq $0 41 movq %rsp, %rbp 41 42 42 43 # -
uspace/lib/libc/arch/arm32/src/stacktrace.S
ree2f1aae r47246f4 33 33 .global frame_pointer_validate 34 34 .global return_address_get 35 .global program_counter_get 35 36 36 37 frame_pointer_get: … … 38 39 frame_pointer_validate: 39 40 return_address_get: 41 program_counter_get: 40 42 mov r0, #0 41 43 mov pc, lr -
uspace/lib/libc/arch/ia32/src/entry.s
ree2f1aae r47246f4 56 56 0: 57 57 # 58 # Stop stack traces in this function.58 # Create the first stack frame. 59 59 # 60 xorl %ebp, %ebp 60 pushl $0 61 movl %esp, %ebp 61 62 62 63 # Pass the PCB pointer to __main as the first argument -
uspace/lib/libc/arch/ia32/src/stacktrace.S
ree2f1aae r47246f4 33 33 .global frame_pointer_validate 34 34 .global return_address_get 35 .global program_counter_get 35 36 36 37 frame_pointer_get: … … 51 52 movl 4(%eax), %eax 52 53 ret 54 55 program_counter_get: 56 movl (%esp), %eax 57 ret -
uspace/lib/libc/arch/ia32/src/thread_entry.s
ree2f1aae r47246f4 42 42 43 43 # 44 # Stop stack traces in this function.44 # Create the first stack frame. 45 45 # 46 xorl %ebp, %ebp 46 pushl $0 47 mov %esp, %ebp 47 48 48 49 # -
uspace/lib/libc/arch/sparc64/include/fibril.h
ree2f1aae r47246f4 53 53 (c)->fp = -STACK_BIAS; \ 54 54 (c)->tp = ptls; \ 55 (c)->i7 = 0; \56 55 } while (0) 57 56 -
uspace/lib/libc/arch/sparc64/src/entry.s
ree2f1aae r47246f4 40 40 __entry: 41 41 # 42 # Stop stack traces in this function.42 # Create the first stack frame. 43 43 # 44 clr %i7 44 save %sp, -176, %sp 45 flushw 46 add %g0, -0x7ff, %fp 45 47 46 48 # Pass pcb_ptr as the first argument to __main() 47 mov % o1, %o049 mov %i1, %o0 48 50 sethi %hi(_gp), %l7 49 51 call __main -
uspace/lib/libc/arch/sparc64/src/stacktrace.S
ree2f1aae r47246f4 27 27 # 28 28 29 #include <libarch/stack.h> 30 29 31 .text 30 32 … … 33 35 .global frame_pointer_validate 34 36 .global return_address_get 37 .global program_counter_get 35 38 36 39 frame_pointer_get: 37 40 # Add the stack bias to %sp to get the actual address. 38 41 retl 39 add %sp, 0x7ff, %o042 add %sp, STACK_BIAS, %o0 40 43 41 44 frame_pointer_prev: 42 save %sp, - 176, %sp45 save %sp, -(STACK_WINDOW_SAVE_AREA_SIZE+STACK_ARG_SAVE_AREA_SIZE), %sp 43 46 # Flush all other windows to memory so that we can read their contents. 44 47 flushw … … 46 49 ldx [%i0 + 14 * 8], %i0 47 50 # Add the stack bias to the %fp read from the window save area. 48 add %i0, 0x7ff, %i051 add %i0, STACK_BIAS, %i0 49 52 ret 50 53 restore 51 54 52 55 frame_pointer_validate: 53 # 54 # Fall through - we detect the last frame in the trace by zero %i7. 55 # 56 retl 57 nop 56 58 57 59 return_address_get: 58 save %sp, - 176, %sp60 save %sp, -(STACK_WINDOW_SAVE_AREA_SIZE+STACK_ARG_SAVE_AREA_SIZE), %sp 59 61 # Flush all other windows to memory so that we can read their contents. 60 62 flushw … … 63 65 ret 64 66 restore 67 68 program_counter_get: 69 retl 70 mov %o7, %o0 71 -
uspace/lib/libc/arch/sparc64/src/thread_entry.s
ree2f1aae r47246f4 36 36 __thread_entry: 37 37 # 38 # Stop stack traces in this function.38 # Create the first stack frame. 39 39 # 40 clr %i7 40 save %sp, -176, %sp 41 flushw 42 add %g0, -0x7ff, %fp 41 43 42 44 sethi %hi(_gp), %l7 -
uspace/lib/libc/generic/stacktrace.c
ree2f1aae r47246f4 37 37 #include <sys/types.h> 38 38 39 void stack_trace_fp (uintptr_t fp)39 void stack_trace_fp_pc(uintptr_t fp, uintptr_t pc) 40 40 { 41 uintptr_t ra;42 41 printf("Printing stack trace:\n"); 42 printf("=====================\n"); 43 43 while (frame_pointer_validate(fp)) { 44 ra = return_address_get(fp);45 p rintf("%p: %p()\n", fp, ra);44 printf("%p: %p()\n", fp, pc); 45 pc = return_address_get(fp); 46 46 fp = frame_pointer_prev(fp); 47 47 } 48 printf("=====================\n"); 48 49 } 49 50 50 51 void stack_trace(void) 51 52 { 52 stack_trace_fp (frame_pointer_get());53 stack_trace_fp_pc(frame_pointer_get(), program_counter_get()); 53 54 } 54 55 -
uspace/lib/libc/include/stacktrace.h
ree2f1aae r47246f4 40 40 41 41 extern void stack_trace(void); 42 extern void stack_trace_fp (uintptr_t);42 extern void stack_trace_fp_pc(uintptr_t, uintptr_t); 43 43 44 44 /* … … 49 49 extern uintptr_t frame_pointer_prev(uintptr_t); 50 50 extern uintptr_t return_address_get(uintptr_t); 51 extern uintptr_t program_counter_get(); 51 52 52 53 #endif
Note:
See TracChangeset
for help on using the changeset viewer.