clarify the purpose of this project
[nyanglibc.git] / debug / backtrace.s
bloba52b398108de50f2f882c49702d7b068210500a2
1 .text
2 .p2align 4,,15
3 .type backtrace_helper, @function
4 backtrace_helper:
5 .LFB49:
6 pushq %rbp
7 movq %rsp, %rbp
8 pushq %r12
9 pushq %rbx
10 movl 16(%rsi), %edx
11 movq %rsi, %rbx
12 cmpl $-1, %edx
13 jne .L11
14 addl $1, %edx
15 cmpl 20(%rbx), %edx
16 movl %edx, 16(%rbx)
17 je .L5
18 .L13:
19 popq %rbx
20 xorl %eax, %eax
21 popq %r12
22 popq %rbp
23 ret
24 .p2align 4,,10
25 .p2align 3
26 .L11:
27 movq %rdi, %r12
28 call _Unwind_GetIP@PLT
29 movslq 16(%rbx), %rcx
30 movq (%rbx), %rdx
31 movq %r12, %rdi
32 movq %rax, (%rdx,%rcx,8)
33 call _Unwind_GetCFA@PLT
34 movl 16(%rbx), %edx
35 testl %edx, %edx
36 jle .L3
37 movq (%rbx), %rcx
38 movslq %edx, %rsi
39 movq (%rcx,%rsi,8), %rdi
40 cmpq %rdi, -8(%rcx,%rsi,8)
41 je .L12
42 .L3:
43 addl $1, %edx
44 cmpl 20(%rbx), %edx
45 movq %rax, 8(%rbx)
46 movl %edx, 16(%rbx)
47 jne .L13
48 .L5:
49 popq %rbx
50 movl $5, %eax
51 popq %r12
52 popq %rbp
53 ret
54 .p2align 4,,10
55 .p2align 3
56 .L12:
57 cmpq %rax, 8(%rbx)
58 jne .L3
59 jmp .L5
60 .LFE49:
61 .size backtrace_helper, .-backtrace_helper
62 .p2align 4,,15
63 .globl __backtrace
64 .hidden __backtrace
65 .type __backtrace, @function
66 __backtrace:
67 .LFB50:
68 pushq %rbp
69 movq %rsp, %rbp
70 subq $32, %rsp
71 testl %esi, %esi
72 movq %rdi, -32(%rbp)
73 movq $0, -24(%rbp)
74 movl $-1, -16(%rbp)
75 movl %esi, -12(%rbp)
76 jle .L15
77 leaq -32(%rbp), %rsi
78 leaq backtrace_helper(%rip), %rdi
79 call _Unwind_Backtrace@PLT
80 movl -16(%rbp), %eax
81 cmpl $1, %eax
82 jle .L16
83 movq -32(%rbp), %rcx
84 movslq %eax, %rdx
85 cmpq $0, -8(%rcx,%rdx,8)
86 je .L20
87 .L14:
88 leave
89 ret
90 .p2align 4,,10
91 .p2align 3
92 .L16:
93 cmpl $-1, %eax
94 jne .L14
95 .L15:
96 xorl %eax, %eax
97 leave
98 ret
99 .p2align 4,,10
100 .p2align 3
101 .L20:
102 subl $1, %eax
103 leave
105 .LFE50:
106 .size __backtrace, .-__backtrace
107 .weak backtrace
108 .set backtrace,__backtrace