Fix silencing

This commit is contained in:
momo5502
2024-12-24 09:23:38 +01:00
parent ebbc5e4e61
commit 6111f2fad3
2 changed files with 13 additions and 10 deletions

View File

@@ -720,10 +720,10 @@ windows_emulator::windows_emulator(const emulator_settings& settings,
std::unique_ptr<x64_emulator> emu)
: windows_emulator(std::move(emu))
{
this->silent_until_main = settings.silent_until_main && !settings.disable_logging;
this->silent_until_main_ = settings.silent_until_main && !settings.disable_logging;
this->stdout_callback_ = std::move(settings.stdout_callback);
this->use_relative_time_ = settings.use_relative_time;
this->logger.disable_output(settings.disable_logging || this->silent_until_main);
this->logger.disable_output(settings.disable_logging || this->silent_until_main_);
this->setup_process(settings);
}
@@ -884,6 +884,15 @@ void windows_emulator::setup_hooks()
if (binary)
{
const auto is_entry_point = address == binary->entry_point;
if (this->silent_until_main_ && is_entry_point && binary == this->process_
.executable)
{
this->silent_until_main_ = false;
this->logger.disable_output(false);
}
const auto export_entry = binary->address_names.find(address);
if (export_entry != binary->address_names.end())
{
@@ -892,14 +901,8 @@ void windows_emulator::setup_hooks()
binary->name.c_str(),
export_entry->second.c_str(), address);
}
else if (address == binary->entry_point)
else if (is_entry_point)
{
if (this->silent_until_main && binary == this->process_.executable)
{
this->silent_until_main = false;
this->logger.disable_output(true);
}
logger.print(is_interesting_call ? color::yellow : color::gray,
"Executing entry point: %s (0x%llX)\n",
binary->name.c_str(),

View File

@@ -103,7 +103,6 @@ public:
bool buffer_stdout{false};
bool fuzzing{false};
bool switch_thread{false};
bool silent_until_main{false};
void yield_thread();
void perform_thread_switch();
@@ -115,6 +114,7 @@ public:
private:
bool use_relative_time_{false};
bool silent_until_main_{false};
std::unique_ptr<x64_emulator> emu_{};
std::vector<instruction_hook_callback> syscall_hooks_{};
std::function<void(std::string_view)> stdout_callback_{};