mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-25 04:02:42 +01:00
Linux: delete /tmp/perf.map on exit
This commit is contained in:
parent
eb4131e1c7
commit
5d91caebe9
@ -20,6 +20,34 @@ LOG_CHANNEL(jit_log, "JIT");
|
|||||||
|
|
||||||
void jit_announce(uptr func, usz size, std::string_view name)
|
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)
|
if (!size)
|
||||||
{
|
{
|
||||||
jit_log.error("Empty function announced: %s (%p)", name, func);
|
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);
|
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()
|
static u8* get_jit_memory()
|
||||||
|
@ -92,6 +92,8 @@ LOG_CHANNEL(q_debug, "QDEBUG");
|
|||||||
|
|
||||||
[[noreturn]] extern void report_fatal_error(std::string_view _text)
|
[[noreturn]] extern void report_fatal_error(std::string_view _text)
|
||||||
{
|
{
|
||||||
|
extern void jit_announce(uptr, usz, std::string_view);
|
||||||
|
|
||||||
std::string buf;
|
std::string buf;
|
||||||
|
|
||||||
// Check if thread id is in string
|
// 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);
|
[[maybe_unused]] const auto con_out = freopen("conout$", "w", stderr);
|
||||||
#endif
|
#endif
|
||||||
std::cerr << fmt::format("RPCS3: %s\n", text);
|
std::cerr << fmt::format("RPCS3: %s\n", text);
|
||||||
|
#ifdef __linux__
|
||||||
|
jit_announce(0, 0, "");
|
||||||
|
#endif
|
||||||
std::abort();
|
std::abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -207,6 +212,9 @@ LOG_CHANNEL(q_debug, "QDEBUG");
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef __linux__
|
||||||
|
jit_announce(0, 0, "");
|
||||||
|
#endif
|
||||||
std::abort();
|
std::abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user