Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F178354487
D62457.1796562473.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
D62457.1796562473.diff
View Options
diff --git a/sys/cddl/dev/dtrace/powerpc/dtrace_isa.c b/sys/cddl/dev/dtrace/powerpc/dtrace_isa.c
--- a/sys/cddl/dev/dtrace/powerpc/dtrace_isa.c
+++ b/sys/cddl/dev/dtrace/powerpc/dtrace_isa.c
@@ -88,8 +88,6 @@
#else
callpc = *(vm_offset_t *)(sp + RETURN_OFFSET);
#endif
- if ((callpc & 3) || (callpc < 0x100))
- return (0);
/*
* trapexit() and asttrapexit() are sentinels
@@ -105,6 +103,16 @@
return (1);
}
+/*
+ * The LR save word of a frame is not always a return address: the function
+ * that was called from the frame may not have saved LR there.
+ */
+static __inline int
+dtrace_pc_valid(vm_offset_t callpc)
+{
+ return ((callpc & 3) == 0 && callpc >= 0x100);
+}
+
static __inline void
dtrace_next_sp_pc(uintptr_t sp, uintptr_t *nsp, uintptr_t *pc, uintptr_t *lr)
{
@@ -188,7 +196,7 @@
if (aframes > 0) {
aframes--;
}
- else {
+ else if (dtrace_pc_valid(callpc)) {
pcstack[depth++] = callpc;
}
}
@@ -525,7 +533,7 @@
dtrace_getstackdepth(int aframes)
{
int depth = 0;
- uintptr_t osp, sp;
+ uintptr_t osp, sp, lr = 0;
vm_offset_t callpc;
aframes++;
@@ -537,17 +545,20 @@
if (sp <= osp)
break;
- if (!dtrace_sp_inkernel(sp, 0))
+ if (!dtrace_sp_inkernel(sp, lr))
break;
- depth++;
osp = sp;
- dtrace_next_sp_pc(sp, &sp, NULL, NULL);
+ dtrace_next_sp_pc(osp, &sp, &callpc, &lr);
+
+ /* Count what dtrace_getpcstack() finds. */
+ if (aframes > 0)
+ aframes--;
+ else if (dtrace_pc_valid(callpc))
+ depth++;
}
- if (depth < aframes)
- return (0);
- return (depth - aframes);
+ return (depth);
}
ulong_t
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Dec 6, 1:07 PM (21 h, 17 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
42241342
Default Alt Text
D62457.1796562473.diff (1 KB)
Attached To
Mode
D62457: dtrace/powerpc: don't end a stack walk at an unused LR save word
Attached
Detach File
Event Timeline