Browse Source

main: print malloc() stats after disassembly in verbose mode

master
Lephenixnoir 11 months ago
parent
commit
fc9b292846
Signed by: Lephenixnoir GPG Key ID: 1BBA026E13FC0495
  1. 5
      fxos/main.cpp
  2. 3
      include/fxos/log.h
  3. 6
      lib/log.cpp

5
fxos/main.cpp

@ -9,6 +9,7 @@
#include <fxos/os.h>
#include <getopt.h>
#include <malloc.h>
#include <filesystem>
#include <fstream>
@ -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)
{

3
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);

6
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)
{

Loading…
Cancel
Save