mirror of
https://github.com/RGBCube/serenity
synced 2025-05-25 19:25:07 +00:00
Kernel: Surface errors when generating a process core dump :^)
This commit is contained in:
parent
fa517b213a
commit
d7568b28b4
2 changed files with 11 additions and 9 deletions
|
@ -541,16 +541,14 @@ ErrorOr<NonnullOwnPtr<KString>> Process::get_syscall_path_argument(Syscall::Stri
|
||||||
return get_syscall_path_argument(path_characters, path.length);
|
return get_syscall_path_argument(path_characters, path.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Process::dump_core()
|
ErrorOr<void> Process::dump_core()
|
||||||
{
|
{
|
||||||
VERIFY(is_dumpable());
|
VERIFY(is_dumpable());
|
||||||
VERIFY(should_generate_coredump());
|
VERIFY(should_generate_coredump());
|
||||||
dbgln("Generating coredump for pid: {}", pid().value());
|
dbgln("Generating coredump for pid: {}", pid().value());
|
||||||
auto coredump_path = String::formatted("/tmp/coredump/{}_{}_{}", name(), pid().value(), kgettimeofday().to_truncated_seconds());
|
auto coredump_path = TRY(KString::formatted("/tmp/coredump/{}_{}_{}", name(), pid().value(), kgettimeofday().to_truncated_seconds()));
|
||||||
auto coredump_or_error = Coredump::try_create(*this, coredump_path);
|
auto coredump = TRY(Coredump::try_create(*this, coredump_path->view()));
|
||||||
if (coredump_or_error.is_error())
|
return coredump->write();
|
||||||
return false;
|
|
||||||
return !coredump_or_error.value()->write().is_error();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Process::dump_perfcore()
|
bool Process::dump_perfcore()
|
||||||
|
@ -612,8 +610,12 @@ void Process::finalize()
|
||||||
dbgln("\x1b[01;31mProcess '{}' exited with the veil left open\x1b[0m", name());
|
dbgln("\x1b[01;31mProcess '{}' exited with the veil left open\x1b[0m", name());
|
||||||
|
|
||||||
if (is_dumpable()) {
|
if (is_dumpable()) {
|
||||||
if (m_should_generate_coredump)
|
if (m_should_generate_coredump) {
|
||||||
dump_core();
|
auto result = dump_core();
|
||||||
|
if (result.is_error()) {
|
||||||
|
critical_dmesgln("Failed to write coredump: {}", result.error());
|
||||||
|
}
|
||||||
|
}
|
||||||
if (m_perf_event_buffer) {
|
if (m_perf_event_buffer) {
|
||||||
dump_perfcore();
|
dump_perfcore();
|
||||||
TimeManagement::the().disable_profile_timer();
|
TimeManagement::the().disable_profile_timer();
|
||||||
|
|
|
@ -527,7 +527,7 @@ private:
|
||||||
|
|
||||||
void kill_threads_except_self();
|
void kill_threads_except_self();
|
||||||
void kill_all_threads();
|
void kill_all_threads();
|
||||||
bool dump_core();
|
ErrorOr<void> dump_core();
|
||||||
bool dump_perfcore();
|
bool dump_perfcore();
|
||||||
bool create_perf_events_buffer_if_needed();
|
bool create_perf_events_buffer_if_needed();
|
||||||
void delete_perf_events_buffer();
|
void delete_perf_events_buffer();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue