Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion systemc-components/common/include/remote.h
Original file line number Diff line number Diff line change
Expand Up @@ -1064,7 +1064,9 @@ class PassRPC : public sc_core::sc_module, public transaction_forwarder_if<PASS>
m_partner_process_manager.set_partner_process(partner_handle);
m_partner_process_manager.on_partner_exit([&]() {
std::cerr << "remote process (" << get_current_process_id() << ") detected parent ("
<< GetProcessId(partner_handle) << ") exit!" << std::endl;
<< GetProcessId(m_partner_process_manager.get_partner_process()) << ") exit!"
<< std::endl;
stop_and_exit();
});
return;
});
Expand Down
2 changes: 1 addition & 1 deletion systemc-components/common/include/runonsysc.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ class runonsysc : public sc_core::sc_module
return core && (std::this_thread::get_id() == core->thread_id);
}

void end_of_simulation()
void end_of_simulation() override
Comment thread
markfoodyburton marked this conversation as resolved.
{
auto core = m_core;
if (!core) return;
Expand Down
21 changes: 16 additions & 5 deletions systemc-components/common/src/dynlib_loader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <filesystem>

#include <dynlib_loader.h>
#include <scp/report.h>

#if defined(_WIN32)
#include <Lmcons.h>
Expand Down Expand Up @@ -45,12 +46,20 @@ static fs::path get_cleanup_helper_path()
{
char exe_path[MAX_PATH];
DWORD len = GetModuleFileNameA(NULL, exe_path, MAX_PATH);
if (len == 0 || len >= MAX_PATH) {
return "";
if (len > 0 && len < MAX_PATH) {
fs::path helper_path = fs::path(exe_path).parent_path() / "dll_cleanup_helper.exe";
if (fs::exists(helper_path)) {
return helper_path;
}
}

// Fallback: search PATH
char found[MAX_PATH];
if (SearchPathA(NULL, "dll_cleanup_helper.exe", NULL, MAX_PATH, found, NULL)) {
return fs::path(found);
}

fs::path helper_path = fs::path(exe_path).parent_path() / "dll_cleanup_helper.exe";
return helper_path;
return "";
}

/**
Expand Down Expand Up @@ -136,6 +145,8 @@ class Library : public qemu::LibraryIface

class DefaultLibraryLoader : public qemu::LibraryLoaderIface
{
SCP_LOGGER(());

private:
std::string m_last_error;

Expand Down Expand Up @@ -278,7 +289,7 @@ class DefaultLibraryLoader : public qemu::LibraryLoaderIface

// Spawn a cleanup process that will delete the DLL after this process exits
if (!spawn_cleanup_process(temp_path)) {
std::cerr << "Warning: Failed to spawn cleanup process for: " << temp_path.string() << std::endl;
SCP_FATAL(()) << "Failed to spawn cleanup process for: " << temp_path.string();
}

return std::make_shared<Library>(handle);
Expand Down
Loading