mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:27:35 +00:00
Kernel: Generate coredump backtraces from "threads for coredump" list
This broke with the change that gave each process a list of its own threads. Since threads are removed slightly earlier from that list during process teardown, we're not able to use it for generating coredump backtraces. Fortunately we have the "threads for coredump" list for just this purpose. :^)
This commit is contained in:
parent
b72f067f0d
commit
5ff355c0cd
4 changed files with 10 additions and 6 deletions
|
@ -240,7 +240,7 @@ ByteBuffer CoreDump::create_notes_threads_data() const
|
|||
{
|
||||
ByteBuffer threads_data;
|
||||
|
||||
m_process->for_each_thread([&](Thread& thread) {
|
||||
for (auto& thread : m_process->threads_for_coredump({})) {
|
||||
ByteBuffer entry_buff;
|
||||
|
||||
ELF::Core::ThreadInfo info {};
|
||||
|
@ -251,9 +251,7 @@ ByteBuffer CoreDump::create_notes_threads_data() const
|
|||
entry_buff.append((void*)&info, sizeof(info));
|
||||
|
||||
threads_data += entry_buff;
|
||||
|
||||
return IterationDecision::Continue;
|
||||
});
|
||||
}
|
||||
return threads_data;
|
||||
}
|
||||
|
||||
|
|
|
@ -677,7 +677,7 @@ void Process::die()
|
|||
m_tty = nullptr;
|
||||
|
||||
for_each_thread([&](auto& thread) {
|
||||
m_threads_for_coredump.append(&thread);
|
||||
m_threads_for_coredump.append(thread);
|
||||
return IterationDecision::Continue;
|
||||
});
|
||||
|
||||
|
|
|
@ -206,6 +206,9 @@ public:
|
|||
template<typename Callback>
|
||||
IterationDecision for_each_thread(Callback) const;
|
||||
|
||||
template<typename Callback>
|
||||
IterationDecision for_each_thread_in_coredump(Callback) const;
|
||||
|
||||
void die();
|
||||
void finalize();
|
||||
|
||||
|
@ -500,6 +503,8 @@ public:
|
|||
HashMap<String, String>& coredump_metadata() { return m_coredump_metadata; }
|
||||
const HashMap<String, String>& coredump_metadata() const { return m_coredump_metadata; }
|
||||
|
||||
const NonnullRefPtrVector<Thread>& threads_for_coredump(Badge<CoreDump>) const { return m_threads_for_coredump; }
|
||||
|
||||
PerformanceEventBuffer* perf_events() { return m_perf_event_buffer; }
|
||||
|
||||
private:
|
||||
|
@ -662,7 +667,7 @@ private:
|
|||
|
||||
HashMap<String, String> m_coredump_metadata;
|
||||
|
||||
Vector<RefPtr<Thread>> m_threads_for_coredump;
|
||||
NonnullRefPtrVector<Thread> m_threads_for_coredump;
|
||||
};
|
||||
|
||||
extern InlineLinkedList<Process>* g_processes;
|
||||
|
|
|
@ -785,6 +785,7 @@ public:
|
|||
u32 stack_ptr() const { return m_tss.esp; }
|
||||
|
||||
RegisterState& get_register_dump_from_stack();
|
||||
const RegisterState& get_register_dump_from_stack() const { return const_cast<Thread*>(this)->get_register_dump_from_stack(); }
|
||||
|
||||
TSS32& tss() { return m_tss; }
|
||||
const TSS32& tss() const { return m_tss; }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue