Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
592ca1fe
Commit
592ca1fe
authored
May 06, 2002
by
Roman Zippel
Committed by
Linus Torvalds
May 06, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] m68k: add show_trace/show_trace_task [19/20]
extract show_trace()/show_trace_task() out of dump_stack().
parent
d0b4cacf
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
66 additions
and
32 deletions
+66
-32
arch/m68k/kernel/traps.c
arch/m68k/kernel/traps.c
+66
-32
No files found.
arch/m68k/kernel/traps.c
View file @
592ca1fe
...
@@ -23,7 +23,7 @@
...
@@ -23,7 +23,7 @@
#include <linux/signal.h>
#include <linux/signal.h>
#include <linux/kernel.h>
#include <linux/kernel.h>
#include <linux/mm.h>
#include <linux/mm.h>
#include <linux/
types
.h>
#include <linux/
module
.h>
#include <linux/a.out.h>
#include <linux/a.out.h>
#include <linux/user.h>
#include <linux/user.h>
#include <linux/string.h>
#include <linux/string.h>
...
@@ -816,15 +816,71 @@ asmlinkage void buserr_c(struct frame *fp)
...
@@ -816,15 +816,71 @@ asmlinkage void buserr_c(struct frame *fp)
int
kstack_depth_to_print
=
48
;
int
kstack_depth_to_print
=
48
;
extern
struct
module
kernel_module
;
/* MODULE_RANGE is a guess of how much space is likely to be
static
inline
int
kernel_text_address
(
unsigned
long
addr
)
vmalloced. */
{
#define MODULE_RANGE (8*1024*1024)
struct
module
*
mod
;
int
retval
=
0
;
extern
char
_stext
,
_etext
;
if
(
addr
>=
(
unsigned
long
)
&
_stext
&&
addr
<=
(
unsigned
long
)
&
_etext
)
return
1
;
#ifdef CONFIG_MODULES
for
(
mod
=
module_list
;
mod
!=
&
kernel_module
;
mod
=
mod
->
next
)
{
/* mod_bound tests for addr being inside the vmalloc'ed
* module area. Of course it'd be better to test only
* for the .text subset... */
if
(
mod_bound
(
addr
,
0
,
mod
))
{
retval
=
1
;
break
;
}
}
#endif
return
retval
;
}
void
show_trace
(
unsigned
long
*
stack
)
{
unsigned
long
*
endstack
;
unsigned
long
addr
;
int
i
;
printk
(
"Call Trace:"
);
addr
=
(
unsigned
long
)
stack
+
THREAD_SIZE
-
1
;
endstack
=
(
unsigned
long
*
)(
addr
&
-
THREAD_SIZE
);
i
=
0
;
while
(
stack
+
1
<=
endstack
)
{
addr
=
*
stack
++
;
/*
* If the address is either in the text segment of the
* kernel, or in the region which contains vmalloc'ed
* memory, it *may* be the address of a calling
* routine; if so, print it so that someone tracing
* down the cause of the crash will be able to figure
* out the call path that was taken.
*/
if
(
kernel_text_address
(
addr
))
{
if
(
i
%
4
==
0
)
printk
(
"
\n
"
);
printk
(
" [<%08lx>]"
,
addr
);
i
++
;
}
}
printk
(
"
\n
"
);
}
void
show_trace_task
(
struct
task_struct
*
tsk
)
{
show_trace
((
unsigned
long
*
)
tsk
->
thread
.
esp0
);
}
static
void
dump_stack
(
struct
frame
*
fp
)
static
void
dump_stack
(
struct
frame
*
fp
)
{
{
unsigned
long
*
stack
,
*
endstack
,
addr
,
module_start
,
module_end
;
unsigned
long
*
stack
,
*
endstack
,
addr
;
extern
char
_start
,
_etext
;
int
i
;
int
i
;
addr
=
(
unsigned
long
)
&
fp
->
un
;
addr
=
(
unsigned
long
)
&
fp
->
un
;
...
@@ -881,7 +937,7 @@ static void dump_stack(struct frame *fp)
...
@@ -881,7 +937,7 @@ static void dump_stack(struct frame *fp)
}
}
stack
=
(
unsigned
long
*
)
addr
;
stack
=
(
unsigned
long
*
)
addr
;
endstack
=
(
unsigned
long
*
)
PAGE_ALIGN
(
addr
);
endstack
=
(
unsigned
long
*
)
((
addr
+
THREAD_SIZE
-
1
)
&
-
THREAD_SIZE
);
printk
(
"Stack from %08lx:"
,
(
unsigned
long
)
stack
);
printk
(
"Stack from %08lx:"
,
(
unsigned
long
)
stack
);
for
(
i
=
0
;
i
<
kstack_depth_to_print
;
i
++
)
{
for
(
i
=
0
;
i
<
kstack_depth_to_print
;
i
++
)
{
...
@@ -891,32 +947,10 @@ static void dump_stack(struct frame *fp)
...
@@ -891,32 +947,10 @@ static void dump_stack(struct frame *fp)
printk
(
"
\n
"
);
printk
(
"
\n
"
);
printk
(
" %08lx"
,
*
stack
++
);
printk
(
" %08lx"
,
*
stack
++
);
}
}
printk
(
"
\n
"
);
show_trace
((
unsigned
long
*
)
addr
);
printk
(
"
\n
Call Trace:"
);
printk
(
"Code: "
);
stack
=
(
unsigned
long
*
)
addr
;
i
=
0
;
module_start
=
VMALLOC_START
;
module_end
=
module_start
+
MODULE_RANGE
;
while
(
stack
+
1
<=
endstack
)
{
addr
=
*
stack
++
;
/*
* If the address is either in the text segment of the
* kernel, or in the region which contains vmalloc'ed
* memory, it *may* be the address of a calling
* routine; if so, print it so that someone tracing
* down the cause of the crash will be able to figure
* out the call path that was taken.
*/
if
(((
addr
>=
(
unsigned
long
)
&
_start
)
&&
(
addr
<=
(
unsigned
long
)
&
_etext
))
||
((
addr
>=
module_start
)
&&
(
addr
<=
module_end
)))
{
if
(
i
%
4
==
0
)
printk
(
"
\n
"
);
printk
(
" [<%08lx>]"
,
addr
);
i
++
;
}
}
printk
(
"
\n
Code: "
);
for
(
i
=
0
;
i
<
10
;
i
++
)
for
(
i
=
0
;
i
<
10
;
i
++
)
printk
(
"%04x "
,
0xffff
&
((
short
*
)
fp
->
ptregs
.
pc
)[
i
]);
printk
(
"%04x "
,
0xffff
&
((
short
*
)
fp
->
ptregs
.
pc
)[
i
]);
printk
(
"
\n
"
);
printk
(
"
\n
"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment