diff --git a/fxos/main.cpp b/fxos/main.cpp index 398c12d..7d16c64 100644 --- a/fxos/main.cpp +++ b/fxos/main.cpp @@ -9,6 +9,7 @@ #include #include +#include #include #include @@ -347,7 +348,9 @@ int main_disassembly(int argc, char **argv) try { - return disassembly(lib, target, ref, passes); + int rc = disassembly(lib, target, ref, passes); + if(log_getminlevel() <= LEVEL_LOG) malloc_stats(); + return rc; } catch(LangError &e) { diff --git a/include/fxos/log.h b/include/fxos/log.h index c709879..9278f0d 100644 --- a/include/fxos/log.h +++ b/include/fxos/log.h @@ -23,6 +23,9 @@ namespace FxOS::Log { /* Select the log level */ void log_setminlevel(int level); +/* Get the minimum log level */ +int log_getminlevel(); + /* General message logger */ void logmsg(int level, char const *function, std::string message); diff --git a/lib/log.cpp b/lib/log.cpp index 9443d13..02bf9e1 100644 --- a/lib/log.cpp +++ b/lib/log.cpp @@ -21,6 +21,12 @@ void log_setminlevel(int level) loglevel = level; } +/* Get the minimum log level */ +int log_getminlevel() +{ + return loglevel; +} + /* General message logger */ void logmsg(int level, char const *function, std::string message) {