MKSYSDEBUG: conditionally compile more debug code
This commit is contained in:
parent
90cde23c19
commit
92fa3189ab
@ -136,6 +136,7 @@ PRIVATE void inkernel_disaster(struct proc *saved_proc,
|
|||||||
struct exception_frame * frame, struct ex_s *ep,
|
struct exception_frame * frame, struct ex_s *ep,
|
||||||
int is_nested)
|
int is_nested)
|
||||||
{
|
{
|
||||||
|
#if USE_SYSDEBUG
|
||||||
if(ep) {
|
if(ep) {
|
||||||
if (ep->msg == NULL || machine.processor < ep->minprocessor)
|
if (ep->msg == NULL || machine.processor < ep->minprocessor)
|
||||||
printf("\nIntel-reserved exception %d\n", frame->vector);
|
printf("\nIntel-reserved exception %d\n", frame->vector);
|
||||||
@ -177,6 +178,7 @@ PRIVATE void inkernel_disaster(struct proc *saved_proc,
|
|||||||
|
|
||||||
/* in an early stage of boot process we don't have processes yet */
|
/* in an early stage of boot process we don't have processes yet */
|
||||||
panic("exception in kernel while booting, no saved_proc yet");
|
panic("exception in kernel while booting, no saved_proc yet");
|
||||||
|
#endif /* USE_SYSDEBUG */
|
||||||
}
|
}
|
||||||
|
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
@ -261,6 +263,7 @@ PUBLIC void exception_handler(int is_nested, struct exception_frame * frame)
|
|||||||
panic("return from inkernel_disaster");
|
panic("return from inkernel_disaster");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if USE_SYSDEBUG
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* proc_stacktrace_execute *
|
* proc_stacktrace_execute *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
@ -303,13 +306,16 @@ PRIVATE void proc_stacktrace_execute(struct proc *whichproc, reg_t v_bp, reg_t p
|
|||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
#endif /* USE_SYSDEBUG */
|
||||||
|
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* proc_stacktrace *
|
* proc_stacktrace *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
PUBLIC void proc_stacktrace(struct proc *whichproc)
|
PUBLIC void proc_stacktrace(struct proc *whichproc)
|
||||||
{
|
{
|
||||||
|
#if USE_SYSDEBUG
|
||||||
proc_stacktrace_execute(whichproc, whichproc->p_reg.fp, whichproc->p_reg.pc);
|
proc_stacktrace_execute(whichproc, whichproc->p_reg.fp, whichproc->p_reg.pc);
|
||||||
|
#endif /* USE_SYSDEBUG */
|
||||||
}
|
}
|
||||||
|
|
||||||
PUBLIC void enable_fpu_exception(void)
|
PUBLIC void enable_fpu_exception(void)
|
||||||
|
@ -19,7 +19,9 @@
|
|||||||
#include "libexec.h"
|
#include "libexec.h"
|
||||||
#include <machine/multiboot.h>
|
#include <machine/multiboot.h>
|
||||||
|
|
||||||
|
#if USE_SYSDEBUG
|
||||||
#define MULTIBOOT_VERBOSE 1
|
#define MULTIBOOT_VERBOSE 1
|
||||||
|
#endif
|
||||||
|
|
||||||
/* FIXME: Share this define with kernel linker script */
|
/* FIXME: Share this define with kernel linker script */
|
||||||
#define MULTIBOOT_KERNEL_ADDR 0x00200000UL
|
#define MULTIBOOT_KERNEL_ADDR 0x00200000UL
|
||||||
@ -142,6 +144,7 @@ PRIVATE void mb_scroll_up(int lines)
|
|||||||
|
|
||||||
PRIVATE void mb_print(char *str)
|
PRIVATE void mb_print(char *str)
|
||||||
{
|
{
|
||||||
|
#if MULTIBOOT_VERBOSE
|
||||||
while (*str) {
|
while (*str) {
|
||||||
if (*str == '\n') {
|
if (*str == '\n') {
|
||||||
str++;
|
str++;
|
||||||
@ -157,6 +160,7 @@ PRIVATE void mb_print(char *str)
|
|||||||
while (print_line >= MULTIBOOT_CONSOLE_LINES)
|
while (print_line >= MULTIBOOT_CONSOLE_LINES)
|
||||||
mb_scroll_up(1);
|
mb_scroll_up(1);
|
||||||
}
|
}
|
||||||
|
#endif /* MULTIBOOT_VERBOSE */
|
||||||
}
|
}
|
||||||
|
|
||||||
PRIVATE void mb_print_hex(u32_t value)
|
PRIVATE void mb_print_hex(u32_t value)
|
||||||
|
@ -366,6 +366,7 @@ for (rp = BEG_PROC_ADDR; rp < END_PROC_ADDR; ++rp) {
|
|||||||
PUBLIC void printseg(char *banner, const int iscs, struct proc *pr,
|
PUBLIC void printseg(char *banner, const int iscs, struct proc *pr,
|
||||||
const u32_t selector)
|
const u32_t selector)
|
||||||
{
|
{
|
||||||
|
#if USE_SYSDEBUG
|
||||||
u32_t base, limit, index, dpl;
|
u32_t base, limit, index, dpl;
|
||||||
struct segdesc_s *desc;
|
struct segdesc_s *desc;
|
||||||
|
|
||||||
@ -446,6 +447,7 @@ PUBLIC void printseg(char *banner, const int iscs, struct proc *pr,
|
|||||||
printf("DPL %d\n", dpl);
|
printf("DPL %d\n", dpl);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
#endif /* USE_SYSDEBUG */
|
||||||
}
|
}
|
||||||
|
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
|
@ -136,6 +136,10 @@ CPPFLAGS+= -DUSE_COVERAGE
|
|||||||
CPPFLAGS+= -DUSE_LIVEUPDATE
|
CPPFLAGS+= -DUSE_LIVEUPDATE
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
|
.if ${USE_SYSDEBUG} != "no"
|
||||||
|
CPPFLAGS+= -DUSE_SYSDEBUG
|
||||||
|
.endif
|
||||||
|
|
||||||
CPPFLAGS.sched_start.c+= -I${MINIXSRCDIR}
|
CPPFLAGS.sched_start.c+= -I${MINIXSRCDIR}
|
||||||
|
|
||||||
.if (${CC} == "gcc") || (${CC} == "clang")
|
.if (${CC} == "gcc") || (${CC} == "clang")
|
||||||
|
@ -34,6 +34,7 @@ typedef unsigned int reg_t;
|
|||||||
|
|
||||||
void util_nstrcat(char *str, unsigned long number)
|
void util_nstrcat(char *str, unsigned long number)
|
||||||
{
|
{
|
||||||
|
#if USE_SYSDEBUG
|
||||||
int n = 10, lead = 1;
|
int n = 10, lead = 1;
|
||||||
char nbuf[12], *p;
|
char nbuf[12], *p;
|
||||||
p = nbuf;
|
p = nbuf;
|
||||||
@ -51,16 +52,21 @@ void util_nstrcat(char *str, unsigned long number)
|
|||||||
*p++ = ' ';
|
*p++ = ' ';
|
||||||
*p++ = '\0';
|
*p++ = '\0';
|
||||||
strcat(str, nbuf);
|
strcat(str, nbuf);
|
||||||
|
#endif /* USE_SYSDEBUG */
|
||||||
}
|
}
|
||||||
|
|
||||||
void util_stacktrace(void)
|
void util_stacktrace(void)
|
||||||
{
|
{
|
||||||
|
#if USE_SYSDEBUG
|
||||||
FUNC_STACKTRACE(printf("0x%lx ", (unsigned long) pc));
|
FUNC_STACKTRACE(printf("0x%lx ", (unsigned long) pc));
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
#endif /* USE_SYSDEBUG */
|
||||||
}
|
}
|
||||||
|
|
||||||
void util_stacktrace_strcat(char *str)
|
void util_stacktrace_strcat(char *str)
|
||||||
{
|
{
|
||||||
|
#if USE_SYSDEBUG
|
||||||
FUNC_STACKTRACE(util_nstrcat(str, pc));
|
FUNC_STACKTRACE(util_nstrcat(str, pc));
|
||||||
|
#endif /* USE_SYSDEBUG */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user