Diffstat (limited to 'libopie2/opiecore/odebug.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opiecore/odebug.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/libopie2/opiecore/odebug.cpp b/libopie2/opiecore/odebug.cpp index a40ef53..cac985b 100644 --- a/libopie2/opiecore/odebug.cpp +++ b/libopie2/opiecore/odebug.cpp | |||
@@ -44,49 +44,50 @@ | |||
44 | #include <opie2/oapplication.h> | 44 | #include <opie2/oapplication.h> |
45 | #include <opie2/oglobalsettings.h> | 45 | #include <opie2/oglobalsettings.h> |
46 | #include <opie2/oconfig.h> | 46 | #include <opie2/oconfig.h> |
47 | 47 | ||
48 | /* QT */ | 48 | /* QT */ |
49 | 49 | ||
50 | #include <qfile.h> | 50 | #include <qfile.h> |
51 | #include <qmessagebox.h> | 51 | #include <qmessagebox.h> |
52 | #include <qsocketdevice.h> | 52 | #include <qsocketdevice.h> |
53 | 53 | ||
54 | /* UNIX */ | 54 | /* UNIX */ |
55 | 55 | ||
56 | #include <stdlib.h> // abort | 56 | #include <stdlib.h> // abort |
57 | #include <unistd.h> // getpid | 57 | #include <unistd.h> // getpid |
58 | #include <stdarg.h> // vararg stuff | 58 | #include <stdarg.h> // vararg stuff |
59 | #include <ctype.h> // isprint | 59 | #include <ctype.h> // isprint |
60 | #include <syslog.h> | 60 | #include <syslog.h> |
61 | #include <errno.h> | 61 | #include <errno.h> |
62 | #include <string.h> | 62 | #include <string.h> |
63 | 63 | ||
64 | #ifndef OPIE_NO_BACKTRACE | 64 | #ifndef OPIE_NO_BACKTRACE |
65 | #include <execinfo.h> | 65 | #include <execinfo.h> |
66 | #endif | 66 | #endif |
67 | 67 | ||
68 | 68 | namespace Opie { | |
69 | namespace Core { | ||
69 | /*====================================================================================== | 70 | /*====================================================================================== |
70 | * debug levels | 71 | * debug levels |
71 | *======================================================================================*/ | 72 | *======================================================================================*/ |
72 | 73 | ||
73 | enum DebugLevels { | 74 | enum DebugLevels { |
74 | ODEBUG_INFO = 0, | 75 | ODEBUG_INFO = 0, |
75 | ODEBUG_WARN = 1, | 76 | ODEBUG_WARN = 1, |
76 | ODEBUG_ERROR = 2, | 77 | ODEBUG_ERROR = 2, |
77 | ODEBUG_FATAL = 3 | 78 | ODEBUG_FATAL = 3 |
78 | }; | 79 | }; |
79 | 80 | ||
80 | /*====================================================================================== | 81 | /*====================================================================================== |
81 | * oDebug private data | 82 | * oDebug private data |
82 | *======================================================================================*/ | 83 | *======================================================================================*/ |
83 | 84 | ||
84 | /*====================================================================================== | 85 | /*====================================================================================== |
85 | * the main debug function | 86 | * the main debug function |
86 | *======================================================================================*/ | 87 | *======================================================================================*/ |
87 | 88 | ||
88 | static void oDebugBackend( unsigned short level, unsigned int area, const char *data) | 89 | static void oDebugBackend( unsigned short level, unsigned int area, const char *data) |
89 | { | 90 | { |
90 | //qDebug( "oDebugBackend: Level=%d, Area=%d, Data=%s", level, area, data ); | 91 | //qDebug( "oDebugBackend: Level=%d, Area=%d, Data=%s", level, area, data ); |
91 | 92 | ||
92 | // ML: OPIE doesn't use areacodes at the moment. See the KDE debug classes for an | 93 | // ML: OPIE doesn't use areacodes at the moment. See the KDE debug classes for an |
@@ -593,28 +594,32 @@ QString odBacktrace( int levels ) | |||
593 | char** strings = backtrace_symbols (trace, n); | 594 | char** strings = backtrace_symbols (trace, n); |
594 | 595 | ||
595 | if ( levels != -1 ) | 596 | if ( levels != -1 ) |
596 | n = QMIN( n, levels ); | 597 | n = QMIN( n, levels ); |
597 | s = "[\n"; | 598 | s = "[\n"; |
598 | 599 | ||
599 | for (int i = 0; i < n; ++i) | 600 | for (int i = 0; i < n; ++i) |
600 | s += QString::number(i) + | 601 | s += QString::number(i) + |
601 | QString::fromLatin1(": ") + | 602 | QString::fromLatin1(": ") + |
602 | QString::fromLatin1(strings[i]) + QString::fromLatin1("\n"); | 603 | QString::fromLatin1(strings[i]) + QString::fromLatin1("\n"); |
603 | s += "]\n"; | 604 | s += "]\n"; |
604 | free (strings); | 605 | free (strings); |
605 | #endif | 606 | #endif |
606 | return s; | 607 | return s; |
607 | } | 608 | } |
608 | 609 | ||
609 | void odClearDebugConfig() | 610 | void odClearDebugConfig() |
610 | { | 611 | { |
611 | /* | 612 | /* |
612 | delete oDebug_data->config; | 613 | delete oDebug_data->config; |
613 | oDebug_data->config = 0; | 614 | oDebug_data->config = 0; |
614 | */ | 615 | */ |
615 | } | 616 | } |
616 | 617 | ||
618 | |||
617 | #ifdef OPIE_NO_DEBUG | 619 | #ifdef OPIE_NO_DEBUG |
618 | #define odDebug ondDebug | 620 | #define odDebug ondDebug |
619 | #define odBacktrace ondBacktrace | 621 | #define odBacktrace ondBacktrace |
620 | #endif | 622 | #endif |
623 | |||
624 | } | ||
625 | } \ No newline at end of file | ||