blob: 4d4e49bb0b381d454b735e6b761e887938d6fab2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
/* -*- linux-c -*-
* ppc64 stack tracing functions
*
* This file is part of systemtap, and is free software. You can
* redistribute it and/or modify it under the terms of the GNU General
* Public License (GPL); either version 2, or (at your option) any
* later version.
*/
static void __stp_stack_print (struct pt_regs *regs, int verbose, int levels)
{
unsigned long ip, newsp, lr = 0;
int count = 0;
int firstframe = 1;
unsigned long *_sp = (unsigned long *)®_SP(regs);
unsigned long sp = (unsigned long)_sp;
lr = 0;
do {
if (sp < KERNELBASE)
return;
_sp = (unsigned long *) sp;
newsp = _sp[0];
ip = _sp[2];
if (!firstframe || ip != lr) {
if (verbose) {
_stp_printf("[%p] [%p] ", sp, ip);
_stp_symbol_print(ip);
if (firstframe)
_stp_print(" (unreliable)");
_stp_print_char('\n');
}
else
_stp_printf("%p ", ip);
}
firstframe = 0;
/*
* See if this is an exception frame.
* We look for the "regshere" marker in the current frame.
*/
if ( _sp[12] == 0x7265677368657265ul) {
struct pt_regs *regs = (struct pt_regs *)
(sp + STACK_FRAME_OVERHEAD);
if (verbose) {
_stp_printf("--- Exception: %lx at ",regs->trap);
_stp_symbol_print(regs->nip);
_stp_print_char('\n');
lr = regs->link;
_stp_print(" LR =");
_stp_symbol_print(lr);
_stp_print_char('\n');
firstframe = 1;
}
else {
_stp_printf("%p ",regs->nip);
_stp_printf("%p ",regs->link);
}
}
sp = newsp;
} while (count++ < MAXBACKTRACE);
}
|