1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-22 02:32:36 +01:00

Linux: delete /tmp/perf.map on exit

This commit is contained in:
Nekotekina 2022-09-08 14:34:17 +03:00 committed by Ivan
parent eb4131e1c7
commit 5d91caebe9
2 changed files with 36 additions and 6 deletions

View File

@ -20,6 +20,34 @@ LOG_CHANNEL(jit_log, "JIT");
void jit_announce(uptr func, usz size, std::string_view name)
{
#ifdef __linux__
static const struct tmp_perf_map
{
std::string name{fmt::format("/tmp/perf-%d.map", getpid())};
fs::file data{name, fs::rewrite + fs::append};
tmp_perf_map() = default;
tmp_perf_map(const tmp_perf_map&) = delete;
tmp_perf_map& operator=(const tmp_perf_map&) = delete;
~tmp_perf_map()
{
fs::remove_file(name);
}
} s_map;
if (size && name.size())
{
s_map.data.write(fmt::format("%x %x %s\n", func, size, name));
}
if (!func && !size && !name.size())
{
fs::remove_file(s_map.name);
return;
}
#endif
if (!size)
{
jit_log.error("Empty function announced: %s (%p)", name, func);
@ -83,12 +111,6 @@ void jit_announce(uptr func, usz size, std::string_view name)
dump.write(reinterpret_cast<uchar*>(func), size);
}
}
#ifdef __linux__
static const fs::file s_map(fmt::format("/tmp/perf-%d.map", getpid()), fs::rewrite + fs::append);
s_map.write(fmt::format("%x %x %s\n", func, size, name));
#endif
}
static u8* get_jit_memory()

View File

@ -92,6 +92,8 @@ LOG_CHANNEL(q_debug, "QDEBUG");
[[noreturn]] extern void report_fatal_error(std::string_view _text)
{
extern void jit_announce(uptr, usz, std::string_view);
std::string buf;
// Check if thread id is in string
@ -124,6 +126,9 @@ LOG_CHANNEL(q_debug, "QDEBUG");
[[maybe_unused]] const auto con_out = freopen("conout$", "w", stderr);
#endif
std::cerr << fmt::format("RPCS3: %s\n", text);
#ifdef __linux__
jit_announce(0, 0, "");
#endif
std::abort();
}
@ -207,6 +212,9 @@ LOG_CHANNEL(q_debug, "QDEBUG");
#endif
}
#ifdef __linux__
jit_announce(0, 0, "");
#endif
std::abort();
}