Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 40cb845e in mainline


Ignore:
Timestamp:
2009-12-30T19:21:45Z (12 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master
Children:
a7a0417
Parents:
26b50cb (diff), f0452536 (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.
Message:

Merge the stack tracing branch.

So far, only userspace stack tracing on amd64, ia32 and sparc64 is supported.
Other architectures have dummy support.

Location:
uspace
Files:
11 added
21 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/tester/Makefile.build

    r26b50cb r40cb845e  
    4949        fault/fault1.c \
    5050        fault/fault2.c \
     51        fault/fault3.c \
    5152        vfs/vfs1.c \
    5253        ipc/ping_pong.c \
  • uspace/app/tester/tester.c

    r26b50cb r40cb845e  
    5656#include "fault/fault1.def"
    5757#include "fault/fault2.def"
     58#include "fault/fault3.def"
    5859#include "vfs/vfs1.def"
    5960#include "ipc/ping_pong.def"
  • uspace/app/tester/tester.h

    r26b50cb r40cb845e  
    7373extern char *test_fault1(void);
    7474extern char *test_fault2(void);
     75extern char *test_fault3(void);
    7576extern char *test_vfs1(void);
    7677extern char *test_ping_pong(void);
  • uspace/lib/libc/Makefile.build

    r26b50cb r40cb845e  
    8787        generic/udebug.c \
    8888        generic/vfs/vfs.c \
    89         generic/vfs/canonify.c
     89        generic/vfs/canonify.c \
     90        generic/stacktrace.c
    9091
    9192ARCH_SOURCES += \
  • uspace/lib/libc/arch/amd64/Makefile.inc

    r26b50cb r40cb845e  
    3636ARCH_SOURCES += arch/$(UARCH)/src/syscall.S \
    3737        arch/$(UARCH)/src/fibril.S \
    38         arch/$(UARCH)/src/tls.c
     38        arch/$(UARCH)/src/tls.c \
     39        arch/$(UARCH)/src/stacktrace.S
    3940
     41GCC_CFLAGS += -fno-omit-frame-pointer
    4042LFLAGS += -N
    4143
  • uspace/lib/libc/arch/amd64/include/fibril.h

    r26b50cb r40cb845e  
    4444#define SP_DELTA     16
    4545
     46#define context_set(c, _pc, stack, size, ptls) \
     47        do { \
     48                (c)->pc = (sysarg_t) (_pc); \
     49                (c)->sp = ((sysarg_t) (stack)) + (size) - SP_DELTA; \
     50                (c)->tls = (sysarg_t) (ptls); \
     51                (c)->rbp = 0; \
     52        } while (0)
     53
    4654/* We include only registers that must be preserved
    4755 * during function call
  • uspace/lib/libc/arch/amd64/src/entry.s

    r26b50cb r40cb845e  
    3838#
    3939__entry:
     40        #
     41        # Create the first stack frame.
     42        #
     43        pushq $0
     44        mov %rsp, %rbp
     45       
    4046        # %rdi was deliberately chosen as the first argument is also in %rdi
    4147        # Pass PCB pointer to __main (no operation)
  • uspace/lib/libc/arch/amd64/src/thread_entry.s

    r26b50cb r40cb845e  
    3636__thread_entry:
    3737        #
     38        # Create the first stack frame.
     39        #
     40        pushq $0
     41        movq %rsp, %rbp
     42
     43        #
    3844        # RAX contains address of uarg
    3945        #
  • uspace/lib/libc/arch/arm32/Makefile.inc

    r26b50cb r40cb845e  
    3737        arch/$(UARCH)/src/fibril.S \
    3838        arch/$(UARCH)/src/tls.c \
    39         arch/$(UARCH)/src/eabi.S
     39        arch/$(UARCH)/src/eabi.S \
     40        arch/$(UARCH)/src/stacktrace.S
    4041
    4142GCC_CFLAGS += -ffixed-r9 -mtp=soft
  • uspace/lib/libc/arch/ia32/Makefile.inc

    r26b50cb r40cb845e  
    3737        arch/$(UARCH)/src/fibril.S \
    3838        arch/$(UARCH)/src/tls.c \
    39         arch/$(UARCH)/src/setjmp.S
     39        arch/$(UARCH)/src/setjmp.S \
     40        arch/$(UARCH)/src/stacktrace.S
    4041
    4142GCC_CFLAGS += -march=pentium
  • uspace/lib/libc/arch/ia32/include/fibril.h

    r26b50cb r40cb845e  
    4444#define SP_DELTA     (12)
    4545
     46#define context_set(c, _pc, stack, size, ptls) \
     47        do { \
     48                (c)->pc = (sysarg_t) (_pc); \
     49                (c)->sp = ((sysarg_t) (stack)) + (size) - SP_DELTA; \
     50                (c)->tls = (sysarg_t) (ptls); \
     51                (c)->ebp = 0; \
     52        } while (0)
     53       
    4654/* We include only registers that must be preserved
    4755 * during function call
  • uspace/lib/libc/arch/ia32/src/entry.s

    r26b50cb r40cb845e  
    5555        movl $__syscall_fast, (%eax)
    56560:
     57        #
     58        # Create the first stack frame.
     59        #
     60        pushl $0
     61        movl %esp, %ebp
    5762
    5863        # Pass the PCB pointer to __main as the first argument
  • uspace/lib/libc/arch/ia32/src/thread_entry.s

    r26b50cb r40cb845e  
    4242
    4343        #
     44        # Create the first stack frame.
     45        #
     46        pushl $0
     47        mov %esp, %ebp
     48
     49        #
    4450        # EAX contains address of uarg.
    4551        #
  • uspace/lib/libc/arch/ia64/Makefile.inc

    r26b50cb r40cb845e  
    3636        arch/$(UARCH)/src/fibril.S \
    3737        arch/$(UARCH)/src/tls.c \
    38         arch/$(UARCH)/src/ddi.c
     38        arch/$(UARCH)/src/ddi.c \
     39        arch/$(UARCH)/src/stacktrace.S
    3940
    4041GCC_CFLAGS += -fno-unwind-tables
  • uspace/lib/libc/arch/mips32/Makefile.inc

    r26b50cb r40cb845e  
    3535ARCH_SOURCES += arch/$(UARCH)/src/syscall.c \
    3636        arch/$(UARCH)/src/fibril.S \
    37         arch/$(UARCH)/src/tls.c
     37        arch/$(UARCH)/src/tls.c \
     38        arch/$(UARCH)/src/stacktrace.S
    3839
    3940GCC_CFLAGS += -mips3
  • uspace/lib/libc/arch/ppc32/Makefile.inc

    r26b50cb r40cb845e  
    3535ARCH_SOURCES += arch/$(UARCH)/src/syscall.c \
    3636        arch/$(UARCH)/src/fibril.S \
    37         arch/$(UARCH)/src/tls.c
     37        arch/$(UARCH)/src/tls.c \
     38        arch/$(UARCH)/src/stacktrace.S
    3839
    3940GCC_CFLAGS += -mcpu=powerpc -msoft-float -m32
  • uspace/lib/libc/arch/sparc64/Makefile.inc

    r26b50cb r40cb845e  
    3434
    3535ARCH_SOURCES += arch/$(UARCH)/src/fibril.S \
    36         arch/$(UARCH)/src/tls.c
     36        arch/$(UARCH)/src/tls.c \
     37        arch/$(UARCH)/src/stacktrace.S
    3738
    3839GCC_CFLAGS += -mcpu=ultrasparc -m64
  • uspace/lib/libc/arch/sparc64/include/fibril.h

    r26b50cb r40cb845e  
    4646#endif
    4747
    48 #define context_set(c, _pc, stack, size, ptls)                  \
    49         (c)->pc = ((uintptr_t) _pc) - 8;                        \
    50         (c)->sp = ((uintptr_t) stack) + ALIGN_UP((size),        \
    51                 STACK_ALIGNMENT) - (STACK_BIAS + SP_DELTA);     \
    52         (c)->fp = -STACK_BIAS;                                  \
    53         (c)->tp = ptls
     48#define context_set(c, _pc, stack, size, ptls) \
     49        do { \
     50                (c)->pc = ((uintptr_t) _pc) - 8; \
     51                (c)->sp = ((uintptr_t) stack) + ALIGN_UP((size), \
     52                    STACK_ALIGNMENT) - (STACK_BIAS + SP_DELTA); \
     53                (c)->fp = -STACK_BIAS; \
     54                (c)->tp = ptls; \
     55        } while (0)
    5456       
    5557/*
  • uspace/lib/libc/arch/sparc64/src/entry.s

    r26b50cb r40cb845e  
    3939#
    4040__entry:
     41        #
     42        # Create the first stack frame.
     43        #
     44        save %sp, -176, %sp
     45        flushw
     46        add %g0, -0x7ff, %fp
     47
    4148        # Pass pcb_ptr as the first argument to __main()
    42         mov %o1, %o0
     49        mov %i1, %o0
    4350        sethi %hi(_gp), %l7
    4451        call __main
  • uspace/lib/libc/arch/sparc64/src/thread_entry.s

    r26b50cb r40cb845e  
    3535#
    3636__thread_entry:
     37        #
     38        # Create the first stack frame.
     39        #
     40        save %sp, -176, %sp
     41        flushw
     42        add %g0, -0x7ff, %fp
     43
    3744        sethi %hi(_gp), %l7
    3845        call __thread_main              ! %o0 contains address of uarg
  • uspace/lib/libc/include/stdlib.h

    r26b50cb r40cb845e  
    3838#include <unistd.h>
    3939#include <malloc.h>
     40#include <stacktrace.h>
    4041
    41 #define abort()       _exit(1)
     42#define abort() \
     43        do { \
     44                stack_trace(); \
     45                _exit(1); \
     46        } while (0)
     47
    4248#define exit(status)  _exit((status))
    4349
Note: See TracChangeset for help on using the changeset viewer.