git.ucc.asn.au
/
tpg
/
acess2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Kernel/PTYs - Add initial dims/mode to PTY_Create
[tpg/acess2.git]
/
KernelLand
/
Kernel
/
debug.c
diff --git
a/KernelLand/Kernel/debug.c
b/KernelLand/Kernel/debug.c
index
7e8acba
..
5bcbcb8
100644
(file)
--- a/
KernelLand/Kernel/debug.c
+++ b/
KernelLand/Kernel/debug.c
@@
-7,7
+7,7
@@
#define DEBUG_MAX_LINE_LEN 256
#define LOCK_DEBUG_OUTPUT 1 // Avoid interleaving of output lines?
#define DEBUG_MAX_LINE_LEN 256
#define LOCK_DEBUG_OUTPUT 1 // Avoid interleaving of output lines?
-#define TRACE_TO_KTERM
1
// Send ENTER/DEBUG/LEAVE to debug?
+#define TRACE_TO_KTERM
0
// Send ENTER/DEBUG/LEAVE to debug?
// === IMPORTS ===
extern void Threads_Dump(void);
// === IMPORTS ===
extern void Threads_Dump(void);
@@
-94,12
+94,13
@@
void Debug_DbgOnlyFmt(const char *format, va_list args)
void Debug_Fmt(int bUseKTerm, const char *format, va_list args)
{
char buf[DEBUG_MAX_LINE_LEN];
void Debug_Fmt(int bUseKTerm, const char *format, va_list args)
{
char buf[DEBUG_MAX_LINE_LEN];
-// int len;
buf[DEBUG_MAX_LINE_LEN-1] = 0;
buf[DEBUG_MAX_LINE_LEN-1] = 0;
- /*len = */vsnprintf(buf, DEBUG_MAX_LINE_LEN-1, format, args);
- //if( len < DEBUG_MAX_LINE )
- // do something
+ int len = vsnprintf(buf, DEBUG_MAX_LINE_LEN-1, format, args);
Debug_Puts(bUseKTerm, buf);
Debug_Puts(bUseKTerm, buf);
+ if( len > DEBUG_MAX_LINE_LEN-1 ) {
+ // do something
+ Debug_Puts(bUseKTerm, "[...]");
+ }
return ;
}
return ;
}
@@
-113,17
+114,17
@@
void Debug_FmtS(int bUseKTerm, const char *format, ...)
void Debug_KernelPanic(void)
{
void Debug_KernelPanic(void)
{
- if( !gbDebug_IsKPanic )
+ // 5 nested panics? Fuck it
+ if( gbDebug_IsKPanic > 5 )
+ HALT_CPU();
+ gbDebug_IsKPanic ++;
+ if( gbDebug_IsKPanic == 1 )
{
#if LOCK_DEBUG_OUTPUT
SHORTREL(&glDebug_Lock);
#endif
VT_SetTerminal(7);
}
{
#if LOCK_DEBUG_OUTPUT
SHORTREL(&glDebug_Lock);
#endif
VT_SetTerminal(7);
}
- // 5 nested panics? Fuck it
- if( gbDebug_IsKPanic > 5 )
- for(;;);
- gbDebug_IsKPanic ++;
KernelPanic_SetMode();
}
KernelPanic_SetMode();
}
@@
-136,6
+137,7
@@
void LogF(const char *Fmt, ...)
va_list args;
#if LOCK_DEBUG_OUTPUT
va_list args;
#if LOCK_DEBUG_OUTPUT
+ if(CPU_HAS_LOCK(&glDebug_Lock)) return ;
SHORTLOCK(&glDebug_Lock);
#endif
SHORTLOCK(&glDebug_Lock);
#endif
@@
-158,7
+160,8
@@
void Debug(const char *Fmt, ...)
va_list args;
#if LOCK_DEBUG_OUTPUT
va_list args;
#if LOCK_DEBUG_OUTPUT
- if(!CPU_HAS_LOCK(&glDebug_Lock)) SHORTLOCK(&glDebug_Lock);
+ if(CPU_HAS_LOCK(&glDebug_Lock)) return ;
+ SHORTLOCK(&glDebug_Lock);
#endif
Debug_Puts(0, "Debug: ");
#endif
Debug_Puts(0, "Debug: ");
@@
-176,6
+179,7
@@
void Debug(const char *Fmt, ...)
void LogFV(const char *Fmt, va_list args)
{
#if LOCK_DEBUG_OUTPUT
void LogFV(const char *Fmt, va_list args)
{
#if LOCK_DEBUG_OUTPUT
+ if(CPU_HAS_LOCK(&glDebug_Lock)) return ;
SHORTLOCK(&glDebug_Lock);
#endif
SHORTLOCK(&glDebug_Lock);
#endif
@@
-189,6
+193,7
@@
void LogFV(const char *Fmt, va_list args)
void LogV(const char *Fmt, va_list args)
{
#if LOCK_DEBUG_OUTPUT
void LogV(const char *Fmt, va_list args)
{
#if LOCK_DEBUG_OUTPUT
+ if(CPU_HAS_LOCK(&glDebug_Lock)) return ;
SHORTLOCK(&glDebug_Lock);
#endif
SHORTLOCK(&glDebug_Lock);
#endif
@@
-217,6
+222,7
@@
void Warning(const char *Fmt, ...)
va_list args;
#if LOCK_DEBUG_OUTPUT
va_list args;
#if LOCK_DEBUG_OUTPUT
+ if(CPU_HAS_LOCK(&glDebug_Lock)) return ;
SHORTLOCK(&glDebug_Lock);
#endif
SHORTLOCK(&glDebug_Lock);
#endif
@@
-250,10
+256,11
@@
void Panic(const char *Fmt, ...)
Debug_Putchar('\r');
Debug_Putchar('\n');
Debug_Putchar('\r');
Debug_Putchar('\n');
+ Proc_PrintBacktrace();
//Threads_Dump();
//Heap_Dump();
//Threads_Dump();
//Heap_Dump();
-
for(;;)
;
+
HALT_CPU()
;
}
void Debug_SetKTerminal(const char *File)
}
void Debug_SetKTerminal(const char *File)
@@
-278,6
+285,7
@@
void Debug_Enter(const char *FuncName, const char *ArgTypes, ...)
tTID tid = Threads_GetTID();
#if LOCK_DEBUG_OUTPUT
tTID tid = Threads_GetTID();
#if LOCK_DEBUG_OUTPUT
+ if(CPU_HAS_LOCK(&glDebug_Lock)) return ;
SHORTLOCK(&glDebug_Lock);
#endif
SHORTLOCK(&glDebug_Lock);
#endif
@@
-338,6
+346,7
@@
void Debug_Log(const char *FuncName, const char *Fmt, ...)
tTID tid = Threads_GetTID();
#if LOCK_DEBUG_OUTPUT
tTID tid = Threads_GetTID();
#if LOCK_DEBUG_OUTPUT
+ if(CPU_HAS_LOCK(&glDebug_Lock)) return ;
SHORTLOCK(&glDebug_Lock);
#endif
SHORTLOCK(&glDebug_Lock);
#endif
@@
-366,6
+375,7
@@
void Debug_Leave(const char *FuncName, char RetType, ...)
tTID tid = Threads_GetTID();
#if LOCK_DEBUG_OUTPUT
tTID tid = Threads_GetTID();
#if LOCK_DEBUG_OUTPUT
+ if(CPU_HAS_LOCK(&glDebug_Lock)) return ;
SHORTLOCK(&glDebug_Lock);
#endif
SHORTLOCK(&glDebug_Lock);
#endif
UCC
git Repository :: git.ucc.asn.au