Skip to content

Commit 05dc16d

Browse files
Randolph ChungKyle McMartin
authored andcommitted
[PARISC] unwinder improvements
Add special-case handling for "handle_interruption" so that we can rewind past the interruption. This is useful for seeing what caused a BUG() or WARN_ON(); otherwise the unwind stops at the interruption. Signed-off-by: Randolph Chung <tausq@debian.org> Signed-off-by: Kyle McMartin <kyle@parisc-linux.org>
1 parent e036306 commit 05dc16d

1 file changed

Lines changed: 34 additions & 7 deletions

File tree

‎arch/parisc/kernel/unwind.c‎

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
#include <asm/uaccess.h>
1818
#include <asm/assembly.h>
19+
#include <asm/asm-offsets.h>
20+
#include <asm/ptrace.h>
1921

2022
#include <asm/unwind.h>
2123

@@ -199,6 +201,29 @@ static int unwind_init(void)
199201
return 0;
200202
}
201203

204+
#ifdef CONFIG_64BIT
205+
#define get_func_addr(fptr) fptr[2]
206+
#else
207+
#define get_func_addr(fptr) fptr[0]
208+
#endif
209+
210+
static int unwind_special(struct unwind_frame_info *info, unsigned long pc, int frame_size)
211+
{
212+
void handle_interruption(int, struct pt_regs *);
213+
static unsigned long *hi = (unsigned long)&handle_interruption;
214+
215+
if (pc == get_func_addr(hi)) {
216+
struct pt_regs *regs = (struct pt_regs *)(info->sp - frame_size - PT_SZ_ALGN);
217+
dbg("Unwinding through handle_interruption()\n");
218+
info->prev_sp = regs->gr[30];
219+
info->prev_ip = regs->iaoq[0];
220+
221+
return 1;
222+
}
223+
224+
return 0;
225+
}
226+
202227
static void unwind_frame_regs(struct unwind_frame_info *info)
203228
{
204229
const struct unwind_table_entry *e;
@@ -312,13 +337,15 @@ static void unwind_frame_regs(struct unwind_frame_info *info)
312337
}
313338
}
314339

315-
info->prev_sp = info->sp - frame_size;
316-
if (e->Millicode)
317-
info->rp = info->r31;
318-
else if (rpoffset)
319-
info->rp = *(unsigned long *)(info->prev_sp - rpoffset);
320-
info->prev_ip = info->rp;
321-
info->rp = 0;
340+
if (!unwind_special(info, e->region_start, frame_size)) {
341+
info->prev_sp = info->sp - frame_size;
342+
if (e->Millicode)
343+
info->rp = info->r31;
344+
else if (rpoffset)
345+
info->rp = *(unsigned long *)(info->prev_sp - rpoffset);
346+
info->prev_ip = info->rp;
347+
info->rp = 0;
348+
}
322349

323350
dbg("analyzing func @ %lx, setting prev_sp=%lx "
324351
"prev_ip=%lx npc=%lx\n", info->ip, info->prev_sp,

0 commit comments

Comments
 (0)