mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 07:17:35 +00:00
Kernel: Don't allocate so much when generating coredumps
Instead of creating a bunch of ByteBuffers and concatenating them to generate the "notes" segment, we now simply create a KBufferBuilder and tell each of the notes generator helpers to write into the builder. This allows the code to flow more naturally, with some bonus additional error propagation. :^)
This commit is contained in:
parent
9db8a14264
commit
69b9b2888c
2 changed files with 40 additions and 84 deletions
|
@ -24,16 +24,16 @@ private:
|
|||
Coredump(NonnullRefPtr<Process>, NonnullRefPtr<FileDescription>);
|
||||
static KResultOr<NonnullRefPtr<FileDescription>> try_create_target_file(Process const&, StringView output_path);
|
||||
|
||||
[[nodiscard]] KResult write_elf_header();
|
||||
[[nodiscard]] KResult write_program_headers(size_t notes_size);
|
||||
[[nodiscard]] KResult write_regions();
|
||||
[[nodiscard]] KResult write_notes_segment(ByteBuffer&);
|
||||
KResult write_elf_header();
|
||||
KResult write_program_headers(size_t notes_size);
|
||||
KResult write_regions();
|
||||
KResult write_notes_segment(ReadonlyBytes);
|
||||
|
||||
KResultOr<ByteBuffer> create_notes_segment_data() const;
|
||||
KResultOr<ByteBuffer> create_notes_process_data() const;
|
||||
KResultOr<ByteBuffer> create_notes_threads_data() const;
|
||||
KResultOr<ByteBuffer> create_notes_regions_data() const;
|
||||
KResultOr<ByteBuffer> create_notes_metadata_data() const;
|
||||
KResult create_notes_segment_data(auto&) const;
|
||||
KResult create_notes_process_data(auto&) const;
|
||||
KResult create_notes_threads_data(auto&) const;
|
||||
KResult create_notes_regions_data(auto&) const;
|
||||
KResult create_notes_metadata_data(auto&) const;
|
||||
|
||||
NonnullRefPtr<Process> m_process;
|
||||
NonnullRefPtr<FileDescription> m_description;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue