refactor(inject): Use new core thread and log modules
Keep this a separate commit because this also removes inject's own logging engine and replaces it with the streamlined core API. The core API provides all the features of inject's own logging engine which also performed horribly. The entire logging operation was locked which included expensive operations that formatted the log messages and required memory allocations and copying around data. The core API's implementation at least only synchronizes the actual IO operations (though this can be improved further with an actual async logging sink, TBD)
This commit is contained in:
@@ -8,10 +8,11 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "core/log-bt.h"
|
||||
#include "core/log.h"
|
||||
|
||||
#include "inject/debugger.h"
|
||||
#include "inject/logger.h"
|
||||
|
||||
#include "util/log.h"
|
||||
#include "util/mem.h"
|
||||
#include "util/proc.h"
|
||||
#include "util/signal.h"
|
||||
@@ -178,6 +179,7 @@ static bool log_debug_str(HANDLE process, const OUTPUT_DEBUG_STRING_INFO *odsi)
|
||||
log_assert(odsi);
|
||||
|
||||
char *debug_str;
|
||||
size_t debug_str_len;
|
||||
|
||||
if (odsi->fUnicode) {
|
||||
debug_str = read_debug_wstr(process, odsi);
|
||||
@@ -186,7 +188,9 @@ static bool log_debug_str(HANDLE process, const OUTPUT_DEBUG_STRING_INFO *odsi)
|
||||
}
|
||||
|
||||
if (debug_str) {
|
||||
logger_log(debug_str);
|
||||
debug_str_len = strlen(debug_str);
|
||||
|
||||
core_log_bt_direct_sink_write(debug_str, debug_str_len);
|
||||
|
||||
free(debug_str);
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user