#include <e32svr.h> // RDebug\r
#include "debug.h"\r
\r
+//#define LOG_FILE "C:\\logs\\pico.log"\r
+#define LOG_FILE _L("D:\\pico.log")\r
+\r
#ifdef __WINS__\r
\r
void ExceptionHandler(TExcType exc) {}\r
};\r
\r
\r
+#if 0\r
static void getASpace(TUint *code_start, TUint *code_end, TUint *stack_start, TUint *stack_end)\r
{\r
TUint pc, sp;\r
chunk.Close();\r
}\r
}\r
+#endif\r
\r
// tmp\r
#if defined(__DEBUG_PRINT)\r
-extern "C" char *debugString();\r
+extern "C" char *PDebugMain();\r
#endif\r
\r
// our very own exception handler\r
void ExceptionHandler(TExcType exc)\r
{\r
+ DEBUGPRINT(_L("ExceptionHandler() called!!!")); // this seems to never be called\r
+\r
+#if 0\r
TUint lr, sp, i;\r
TUint stack_end = 0; // ending address of our stack chunk\r
TUint code_start = 0, code_end = 0; // starting and ending addresses of our code chunk\r
TUint guessed_address = 0;\r
\r
- DEBUGPRINT(_L("ExceptionHandler()")); // this seems to never be called\r
-\r
asm volatile ("str lr, %0" : "=m" (lr) );\r
asm volatile ("str sp, %0" : "=m" (sp) );\r
\r
\r
// tmp\r
#if defined(__DEBUG_PRINT)\r
- char *ps, *cstr = debugString();\r
+ char *ps, *cstr = PDebugMain();\r
for(ps = cstr; *ps; ps++) {\r
if(*ps == '\n') {\r
*ps = 0;\r
- dprintf(cstr);\r
+ lprintf(cstr);\r
cstr = ps+1;\r
}\r
}\r
// more descriptive replacement of "KERN-EXEC 3" panic\r
buff1.Format(_L("K-EX3: %S"), &ptrExc);\r
User::Panic(buff1, exc);\r
+#endif\r
}\r
\r
#endif // ifdef __WINS__\r
\r
\r
-#if defined(__DEBUG_PRINT) || defined(__WINS__)\r
-\r
-#ifndef __DLL__\r
- // c string dumper for RDebug::Print()\r
- static TBuf<1024> sTextBuffer;\r
- TDesC* DO_CONV(const char* s)\r
- {\r
- TPtrC8 text8((TUint8*) (s));\r
- sTextBuffer.Copy(text8);\r
- return &sTextBuffer;\r
- }\r
-#endif\r
-\r
-#ifdef __DEBUG_PRINT_C\r
+#if 1 // def __DEBUG_PRINT_C\r
#include <stdarg.h> // va_*\r
#include <stdio.h> // vsprintf\r
\r
// debug print from c code\r
- extern "C" void dprintf(char *format, ...)\r
+ extern "C" void lprintf(const char *format, ...)\r
{\r
va_list args;\r
char buffer[512];\r
+ int len;\r
\r
va_start(args,format);\r
- vsprintf(buffer,format,args);\r
+ len = vsprintf(buffer,format,args);\r
va_end(args);\r
+ if (buffer[len-1] == '\n')\r
+ buffer[len-1] = 0;\r
\r
DEBUGPRINT(_L("%S"), DO_CONV(buffer));\r
}\r
#endif\r
\r
+\r
+#if defined(__DEBUG_PRINT) || defined(__WINS__)\r
+\r
+#ifndef __DLL__\r
+ // c string dumper for RDebug::Print()\r
+ static TBuf<1024> sTextBuffer;\r
+ TDesC* DO_CONV(const char* s)\r
+ {\r
+ TPtrC8 text8((TUint8*) (s));\r
+ sTextBuffer.Copy(text8);\r
+ return &sTextBuffer;\r
+ }\r
+#endif\r
+\r
#ifdef __DEBUG_PRINT_FILE\r
#include <f32file.h>\r
\r
{\r
// try to open\r
logMutex.CreateLocal();\r
- RFs fserv;\r
+ /*RFs fserv;\r
fserv.Connect();\r
RFile logFile;\r
- logFile.Replace(fserv, _L("C:\\logs\\pico.log"), EFileWrite|EFileShareAny);\r
+ logFile.Replace(fserv, LOG_FILE, EFileWrite|EFileShareAny);\r
logFile.Close();\r
- fserv.Close();\r
+ fserv.Close();*/\r
}\r
\r
// debug print to file\r
\r
RThread thisThread;\r
RFile logFile;\r
- res = logFile.Open(fserv, _L("C:\\logs\\pico.log"), EFileWrite|EFileShareAny);\r
+ res = logFile.Open(fserv, LOG_FILE, EFileWrite|EFileShareAny);\r
if(res) goto fail1;\r
\r
logFile.Size(size); logFile.Seek(ESeekStart, size);\r