Since all the calls to the postmortem debug code have been removed by
various folks, the actual code can be removed as well.
This commit is contained in:
parent
0d4c6bb54a
commit
98c62c02c3
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: locore.S,v 1.30 1998/12/12 17:28:05 mycroft Exp $ */
|
||||
/* $NetBSD: locore.S,v 1.31 1999/03/01 10:01:53 mark Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1994-1997 Mark Brinicombe
|
||||
@ -207,170 +207,6 @@ Lcpu_reset_address:
|
||||
.word _cpu_reset_address
|
||||
#endif /* OFW */
|
||||
|
||||
/* Debug routine to print trace back information from stack */
|
||||
|
||||
ENTRY(traceback)
|
||||
stmfd sp!, {r4, r5, r6, lr}
|
||||
mov r4, r11
|
||||
ldr r5, Ltracebackmin
|
||||
ldr r6, Ltracebackmax
|
||||
|
||||
tbloop:
|
||||
mov r1, r4
|
||||
ldr r2, [r4, #-12]
|
||||
ldr r3, [r4, #-8]
|
||||
add r0, pc, #Ltb1 - . - 8
|
||||
bl _printf
|
||||
|
||||
ldr r1, [r4, #-4]
|
||||
ldr r2, [r4]
|
||||
add r0, pc, #Ltb2 - . - 8
|
||||
bl _printf
|
||||
|
||||
mov r3, r4
|
||||
ldr r4, [r4, #-12]
|
||||
teq r3, r4
|
||||
beq tbexit
|
||||
cmp r4, r5
|
||||
bls tbexit
|
||||
cmp r4, r6
|
||||
bge tbexit
|
||||
teq r4, #0x00000000
|
||||
bne tbloop
|
||||
|
||||
tbexit:
|
||||
mov r0, r4
|
||||
ldmfd sp!, {r4, r5, r6, pc}
|
||||
|
||||
Ltracebackmin:
|
||||
.word 0xf0000000
|
||||
|
||||
Ltracebackmax:
|
||||
.word 0xf4000000
|
||||
|
||||
Ltb1:
|
||||
.asciz "traceback: fp=%08x fp->fp=%08x fp->sp=%08x "
|
||||
|
||||
Ltb2:
|
||||
.asciz "fp->lr=%08x fp->pc=%08x\n"
|
||||
|
||||
.align 0
|
||||
|
||||
/* Debug routine to print trace back information from stack */
|
||||
|
||||
ENTRY(simpletraceback)
|
||||
stmfd sp!, {r4, r5, r6, lr}
|
||||
mov r4, r11
|
||||
ldr r5, Ltracebackmin
|
||||
ldr r6, Ltracebackmax
|
||||
|
||||
stbloop:
|
||||
ldr r1, [r4, #-4]
|
||||
ldr r2, [r4]
|
||||
add r0, pc, #Ltb2 - . - 8
|
||||
bl _printf
|
||||
|
||||
mov r3, r4
|
||||
ldr r4, [r4, #-12]
|
||||
teq r3, r4
|
||||
beq stbexit
|
||||
cmp r4, r5
|
||||
bls stbexit
|
||||
cmp r4, r6
|
||||
bge stbexit
|
||||
teq r4, #0x00000000
|
||||
bne stbloop
|
||||
|
||||
stbexit:
|
||||
mov r0, r4
|
||||
ldmfd sp!, {r4, r5, r6, pc}
|
||||
|
||||
|
||||
/* Debug routine to print trace back information from stack */
|
||||
|
||||
ENTRY(irqtraceback)
|
||||
stmfd sp!, {r4, r5, r6, lr}
|
||||
mov r4, r0
|
||||
mov r5, r1
|
||||
add r6, r5, #(NBPG)
|
||||
|
||||
itbloop:
|
||||
mov r1, r4
|
||||
ldr r2, [r4, #-12]
|
||||
ldr r3, [r4, #-8]
|
||||
add r0, pc, #Ltb1 - . - 8
|
||||
bl _printf
|
||||
|
||||
ldr r1, [r4, #-4]
|
||||
ldr r2, [r4]
|
||||
add r0, pc, #Ltb2 - . - 8
|
||||
bl _printf
|
||||
|
||||
mov r3, r4
|
||||
ldr r4, [r4, #-12]
|
||||
teq r3, r4
|
||||
beq itbexit
|
||||
cmp r4, r5
|
||||
bls itbexit
|
||||
cmp r4, r6
|
||||
bge itbexit
|
||||
teq r4, #0x00000000
|
||||
bne itbloop
|
||||
|
||||
itbexit:
|
||||
mov r0, r4
|
||||
ldmfd sp!, {r4, r5, r6, pc}
|
||||
|
||||
|
||||
ENTRY(user_traceback)
|
||||
stmfd sp!, {r4, r5, r6, lr}
|
||||
mov r4, r0
|
||||
ldr r5, Lusertracebackmin
|
||||
ldr r6, Lusertracebackmax
|
||||
|
||||
usertbloop:
|
||||
mov r1, r4
|
||||
ldr r2, [r4, #-12]
|
||||
ldr r3, [r4, #-8]
|
||||
add r0, pc, #Lusertb1 - . - 8
|
||||
bl _printf
|
||||
|
||||
ldr r1, [r4, #-4]
|
||||
ldr r2, [r4]
|
||||
add r0, pc, #Lusertb2 - . - 8
|
||||
bl _printf
|
||||
|
||||
mov r3, r4
|
||||
ldr r4, [r4, #-12]
|
||||
teq r3, r4
|
||||
beq usertbexit
|
||||
cmp r4, r5
|
||||
bls tbexit
|
||||
cmp r4, r6
|
||||
bge usertbexit
|
||||
teq r4, #0x00000000
|
||||
bne usertbloop
|
||||
|
||||
usertbexit:
|
||||
mov r0, r4
|
||||
ldmfd sp!, {r4, r5, r6, pc}
|
||||
|
||||
Lusertracebackmin:
|
||||
.word 0x00001000
|
||||
|
||||
Lusertracebackmax:
|
||||
.word 0xefbfe000
|
||||
|
||||
Lusertb1:
|
||||
.asciz "traceback: fp=%08x fp->fp=%08x fp->sp=%08x "
|
||||
|
||||
Lusertb2:
|
||||
.asciz "fp->lr=%08x fp->pc=%08x\n"
|
||||
|
||||
.align 0
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Signal trampoline; copied to top of user stack.
|
||||
*/
|
||||
|
@ -1,303 +0,0 @@
|
||||
/* $NetBSD: postmortem.c,v 1.16 1999/01/03 02:23:28 mark Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994,1995 Mark Brinicombe.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Mark Brinicombe.
|
||||
* 4. The name of the company nor the name of the author may be used to
|
||||
* endorse or promote products derived from this software without specific
|
||||
* prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* RiscBSD kernel project
|
||||
*
|
||||
* postmortem.c
|
||||
*
|
||||
* Postmortem routines
|
||||
*
|
||||
* Created : 17/09/94
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/user.h>
|
||||
#include <machine/db_machdep.h>
|
||||
#include <ddb/db_sym.h>
|
||||
#include <machine/frame.h>
|
||||
#include <machine/katelib.h>
|
||||
|
||||
#ifdef POSTMORTEM
|
||||
|
||||
#ifdef ROTTEN_INARDS
|
||||
#ifndef OFWGENCFG
|
||||
extern pv_addr_t irqstack;
|
||||
#endif
|
||||
extern pv_addr_t undstack;
|
||||
extern pv_addr_t abtstack;
|
||||
#endif
|
||||
|
||||
int usertraceback = 0;
|
||||
|
||||
/* dumpb - dumps memory in bytes */
|
||||
|
||||
void
|
||||
pm_dumpb(addr, count)
|
||||
u_char *addr;
|
||||
int count;
|
||||
{
|
||||
u_int byte;
|
||||
int loop;
|
||||
|
||||
for (; count > 0; count -= 16) {
|
||||
printf("%08x: ", (int)addr);
|
||||
|
||||
for (loop = 0; loop < 16; ++loop) {
|
||||
byte = addr[loop];
|
||||
printf("%02x ", byte);
|
||||
}
|
||||
|
||||
printf(" ");
|
||||
|
||||
for (loop = 0; loop < 16; ++loop) {
|
||||
byte = addr[loop];
|
||||
if (byte < 0x20)
|
||||
printf("%c", byte + '@');
|
||||
else if ((byte == 0x7f) || (byte == 0xff))
|
||||
printf("?");
|
||||
else if (byte < 0x80)
|
||||
printf("%c", byte);
|
||||
else if (byte < 0xa0)
|
||||
printf("%c", byte - '@');
|
||||
else
|
||||
printf("%c", byte & 0x7f);
|
||||
}
|
||||
|
||||
printf("\r\n");
|
||||
addr += 16;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* dumpw - dumps memory in bytes */
|
||||
|
||||
void
|
||||
pm_dumpw(addr, count)
|
||||
u_char *addr;
|
||||
int count;
|
||||
{
|
||||
u_int byte;
|
||||
int loop;
|
||||
|
||||
for (; count > 0; count -= 32) {
|
||||
printf("%08x: ", (int)addr);
|
||||
|
||||
for (loop = 0; loop < 8; ++loop) {
|
||||
byte = ((u_int *)addr)[loop];
|
||||
printf("%08x ", byte);
|
||||
}
|
||||
|
||||
printf(" ");
|
||||
|
||||
for (loop = 0; loop < 32; ++loop) {
|
||||
byte = addr[loop];
|
||||
if (byte < 0x20)
|
||||
printf("%c", byte + '@');
|
||||
else if ((byte == 0x7f) || (byte == 0xff))
|
||||
printf("?");
|
||||
else if (byte < 0x80)
|
||||
printf("%c", byte);
|
||||
else if (byte < 0xa0)
|
||||
printf("%c", byte - '@');
|
||||
else
|
||||
printf("%c", byte & 0x7f);
|
||||
}
|
||||
|
||||
printf("\r\n");
|
||||
addr += 32;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Dump a trap frame */
|
||||
|
||||
void
|
||||
dumpframe(frame)
|
||||
trapframe_t *frame;
|
||||
{
|
||||
int s;
|
||||
|
||||
s = splhigh();
|
||||
printf("frame address = %p ", frame);
|
||||
printf("spsr =%08x\n", frame->tf_spsr);
|
||||
printf("r0 =%08x r1 =%08x r2 =%08x r3 =%08x\n", frame->tf_r0,
|
||||
frame->tf_r1, frame->tf_r2, frame->tf_r3);
|
||||
printf("r4 =%08x r5 =%08x r6 =%08x r7 =%08x\n", frame->tf_r4,
|
||||
frame->tf_r5, frame->tf_r6, frame->tf_r7);
|
||||
printf("r8 =%08x r9 =%08x r10=%08x r11=%08x\n", frame->tf_r8,
|
||||
frame->tf_r9, frame->tf_r10, frame->tf_r11);
|
||||
printf("r12=%08x r13=%08x r14=%08x r15=%08x\n", frame->tf_r12,
|
||||
frame->tf_usr_sp, frame->tf_usr_lr, frame->tf_pc);
|
||||
printf("slr=%08x\n", frame->tf_svc_lr);
|
||||
|
||||
(void)splx(s);
|
||||
}
|
||||
|
||||
#ifdef STACKCHECKS
|
||||
void
|
||||
check_stacks(p)
|
||||
struct proc *p;
|
||||
{
|
||||
u_char *ptr;
|
||||
int loop;
|
||||
|
||||
if (p) {
|
||||
ptr = ((u_char *)p->p_addr) + USPACE_UNDEF_STACK_BOTTOM;
|
||||
for (loop = 0; loop < (USPACE_UNDEF_STACK_TOP -
|
||||
USPACE_UNDEF_STACK_BOTTOM) && *ptr == 0xdd; ++loop, ++ptr) ;
|
||||
printf("%d bytes of undefined stack fill pattern out of %d bytes\n",
|
||||
loop, USPACE_UNDEF_STACK_TOP - USPACE_UNDEF_STACK_BOTTOM);
|
||||
ptr = ((u_char *)p->p_addr) + USPACE_SVC_STACK_BOTTOM;
|
||||
for (loop = 0; loop < (USPACE_SVC_STACK_TOP -
|
||||
USPACE_SVC_STACK_BOTTOM) && *ptr == 0xdd; ++loop, ++ptr) ;
|
||||
printf("%d bytes of svc stack fill pattern out of %d bytes\n",
|
||||
loop, USPACE_SVC_STACK_TOP - USPACE_SVC_STACK_BOTTOM);
|
||||
}
|
||||
}
|
||||
#endif /* STACKCHECKS */
|
||||
|
||||
/* Perform a postmortem */
|
||||
|
||||
void
|
||||
postmortem(frame)
|
||||
trapframe_t *frame;
|
||||
{
|
||||
u_int s;
|
||||
u_int addr;
|
||||
static int postmortem_active = 0;
|
||||
|
||||
s = splhigh();
|
||||
|
||||
if (postmortem_active) {
|
||||
printf("postmortem aborted - re-entrancy detected\n");
|
||||
(void)splx(s);
|
||||
return;
|
||||
}
|
||||
++postmortem_active;
|
||||
|
||||
#ifdef STACKCHECKS
|
||||
/* Check the stack for a known pattern */
|
||||
|
||||
check_stacks(curproc);
|
||||
#endif /* STACKCHECKS */
|
||||
|
||||
#ifdef ROTTEN_INARDS
|
||||
addr = traceback();
|
||||
|
||||
dumpframe(frame);
|
||||
|
||||
if (curproc) {
|
||||
printf("curproc=%p paddr=%p pcb=%p curpcb=%p\n",
|
||||
curproc, curproc->p_addr, &curproc->p_addr->u_pcb,
|
||||
curpcb);
|
||||
printf("CPSR=%08x ", GetCPSR());
|
||||
|
||||
printf("Process = %p ", curproc);
|
||||
printf("pid = %d ", curproc->p_pid);
|
||||
printf("comm = %s\n", curproc->p_comm);
|
||||
} else {
|
||||
printf("curproc=%p curpcb=%p\n", curproc, curpcb);
|
||||
printf("CPSR=%08x ", GetCPSR());
|
||||
}
|
||||
|
||||
#ifndef OFWGENCFG
|
||||
pm_dumpw(irqstack.pv_va + NBPG - 0x100, 0x100);
|
||||
#endif
|
||||
pm_dumpw(undstack.pv_va + NBPG - 0x20, 0x20);
|
||||
pm_dumpw(abtstack.pv_va + NBPG - 0x20, 0x20);
|
||||
|
||||
printf("abt_sp=%08x irq_sp=%08x und_sp=%08x svc_sp=%08x\n",
|
||||
get_stackptr(PSR_ABT32_MODE),
|
||||
get_stackptr(PSR_IRQ32_MODE),
|
||||
get_stackptr(PSR_UND32_MODE),
|
||||
get_stackptr(PSR_SVC32_MODE));
|
||||
|
||||
if (curpcb)
|
||||
printf("curpcb=%p pcb_sp=%08x pcb_und_sp=%08x\n", curpcb,
|
||||
curpcb->pcb_sp, curpcb->pcb_und_sp);
|
||||
|
||||
printf("proc0=%p paddr=%p pcb=%p\n", &proc0,
|
||||
proc0.p_addr, &proc0.p_addr->u_pcb);
|
||||
|
||||
#else /* ROTTENS_INARDS */
|
||||
printf("Process = %p ", curproc);
|
||||
if (curproc) {
|
||||
printf("pid = %d ", curproc->p_pid);
|
||||
printf("comm = %s\n", curproc->p_comm);
|
||||
} else {
|
||||
printf("\n");
|
||||
}
|
||||
printf("CPSR=%08x ", GetCPSR());
|
||||
|
||||
printf("Traceback info (frame=%p)\n", frame);
|
||||
addr = simpletraceback();
|
||||
printf("Trapframe PC = %08x\n", frame->tf_pc);
|
||||
printf("Trapframe SPSR = %08x\n", frame->tf_spsr);
|
||||
|
||||
if (usertraceback) {
|
||||
printf("Attempting user trackback\n");
|
||||
user_traceback(frame->tf_r11);
|
||||
}
|
||||
|
||||
#endif /* ROTTEN_INARDS */
|
||||
--postmortem_active;
|
||||
(void)splx(s);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
buried_alive(p)
|
||||
struct proc *p;
|
||||
{
|
||||
printf("Ok major screw up detected on kernel stack\n");
|
||||
printf("Putting the process down to minimise further trashing\n");
|
||||
printf("Process was %p pid=%d comm=%s\n", p, p->p_pid, p->p_comm);
|
||||
}
|
||||
#else /* POSTMORTEM */
|
||||
void
|
||||
postmortem(frame)
|
||||
trapframe_t *frame;
|
||||
{
|
||||
printf("No postmortem support compiled in\n");
|
||||
}
|
||||
|
||||
void
|
||||
buried_alive(p)
|
||||
struct proc *p;
|
||||
{
|
||||
}
|
||||
#endif /* POSTMORTEM */
|
||||
|
||||
/* End of postmortem.c */
|
@ -1,4 +1,4 @@
|
||||
# $NetBSD: files.arm32,v 1.75 1999/01/23 22:18:43 sommerfe Exp $
|
||||
# $NetBSD: files.arm32,v 1.76 1999/03/01 10:01:52 mark Exp $
|
||||
#
|
||||
# First try for arm-specific configuration info
|
||||
#
|
||||
@ -386,7 +386,6 @@ file arch/arm32/kshell/kshell_debug.c kshell
|
||||
|
||||
# files related to debugging
|
||||
file arch/arm32/arm32/disassem.c
|
||||
file arch/arm32/arm32/postmortem.c postmortem
|
||||
|
||||
file dev/cons.c
|
||||
file dev/cninit.c !footbridge
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: katelib.h,v 1.12 1998/02/21 22:49:18 mark Exp $ */
|
||||
/* $NetBSD: katelib.h,v 1.13 1999/03/01 10:01:53 mark Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994-1996 Mark Brinicombe.
|
||||
@ -106,16 +106,6 @@ void outsl __P((u_int io, void *src, u_int size));
|
||||
#define inl(port) ReadWord((port))
|
||||
#define outl(port, lword) WriteWord((port), (lword))
|
||||
|
||||
/* Prototypes that are wandering the streets */
|
||||
|
||||
#ifdef _ARM32_FRAME_H_
|
||||
void postmortem __P((trapframe_t *frame));
|
||||
#endif
|
||||
u_int traceback __P((void));
|
||||
u_int simpletraceback __P((void));
|
||||
u_int irqtraceback __P((u_int, u_int));
|
||||
u_int user_traceback __P((u_int));
|
||||
void kstack_stuff __P((struct proc */*p*/));
|
||||
#endif
|
||||
|
||||
/* End of katelib.h */
|
||||
|
Loading…
Reference in New Issue
Block a user