Index: compiled/debug.h |
=================================================================== |
--- a/compiled/debug.h |
+++ b/compiled/debug.h |
@@ -12,72 +12,102 @@ |
* GNU General Public License for more details. |
* |
* You should have received a copy of the GNU General Public License |
* along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
*/ |
#pragma once |
-#include <emscripten.h> |
-#include <emscripten/trace.h> |
+#include "library.h" |
#if defined(assert) |
#undef assert |
#endif |
class String; |
struct console_type |
{ |
static void log(const String& str) |
{ |
- EM_ASM_ARGS(console.log(readString($0)), &str); |
+ LogString(str); |
} |
static void log(int i) |
{ |
- EM_ASM_ARGS(console.log($0), i); |
+ LogInteger(i); |
} |
- static void log(void* ptr) |
+ static void log(const void* ptr) |
{ |
- EM_ASM_ARGS(console.log($0), ptr); |
+ LogPointer(ptr); |
} |
static void error(const String& str) |
{ |
- EM_ASM_ARGS(console.error(new Error(readString($0)).stack), &str); |
+ LogError(str); |
} |
}; |
static console_type console; |
#if defined(DEBUG) |
inline void assert(bool condition, const String& str) |
{ |
if (!condition) |
console.error(str); |
} |
#else |
#define assert(condition, str) |
#endif |
+#if defined(__EMSCRIPTEN_TRACING__) |
+#include <emscripten/trace.h> |
+ |
+inline void init_tracing() |
+{ |
+ emscripten_trace_configure("http://127.0.0.1:5000/", "MyApplication"); |
+} |
+ |
+inline void shutdown_tracing() |
+{ |
+ emscripten_trace_close(); |
+} |
+ |
inline void annotate_address(void* address, const char* name) |
{ |
-#if defined(__EMSCRIPTEN_TRACING__) |
emscripten_trace_annotate_address_type(address, name); |
-#endif |
} |
inline void enter_context(const char* context) |
{ |
-#if defined(__EMSCRIPTEN_TRACING__) |
emscripten_trace_enter_context(context); |
-#endif |
} |
inline void exit_context() |
{ |
-#if defined(__EMSCRIPTEN_TRACING__) |
emscripten_trace_exit_context(); |
-#endif |
} |
+ |
+#else // defined(__EMSCRIPTEN_TRACING__) |
+ |
+inline void init_tracing() |
+{ |
+} |
+ |
+inline void shutdown_tracing() |
+{ |
+} |
+ |
+inline void annotate_address(void* address, const char* name) |
+{ |
+} |
+ |
+inline void enter_context(const char* context) |
+{ |
+} |
+ |
+inline void exit_context() |
+{ |
+} |
+ |
+#endif // defined(__EMSCRIPTEN_TRACING__) |