Skip to content

Commit 4c1d656

Browse files
QuzarDCQuzarDC
authored andcommitted
stack: Don't skip frames when tracing.
Despite the `__noinline` tag, it was still possible for `arch_stk_trace` to get inlined, which would lead to accidentally skipping frames from the userland when tracing. The worst downside is that it's now possible that we get `arch_stk_trace` in the trace, which isn't much of a problem. Additionally cleaned up some comments that referenced frame pointers.
1 parent 0f68dfb commit 4c1d656

1 file changed

Lines changed: 3 additions & 8 deletions

File tree

  • kernel/arch/dreamcast/kernel

kernel/arch/dreamcast/kernel/stack.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,7 @@
44
(c)2002 Megan Potter
55
*/
66

7-
/* Functions to tinker with the stack, including obtaining a stack
8-
trace when frame pointers are enabled. If frame pointers are enabled,
9-
then you'll need to also define FRAME_POINTERS to get support for stack
10-
traces. */
7+
/* Functions to tinker with the stack, including obtaining a stack trace. */
118

129
#include <kos/dbgio.h>
1310
#include <arch/arch.h>
@@ -129,12 +126,10 @@ void arch_stk_setup(kthread_t *nt) {
129126

130127
/* Do a stack trace from the current function; leave off the first n frames
131128
(i.e., in assert()). */
132-
__noinline void arch_stk_trace(int n) {
129+
void arch_stk_trace(int n) {
133130
register uintptr_t sp asm("r15");
134131

135-
/* Keep previous behaviour: arch_stk_trace skipped one extra frame
136-
(the tracer itself), so pass n+1 to arch_stk_trace_at. */
137-
arch_stk_trace_at(sp, n + 1);
132+
arch_stk_trace_at(sp, n);
138133
}
139134

140135
/* Do a stack trace from the given stack pointer. Leave off the first

0 commit comments

Comments
 (0)