mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-20 01:37:39 +03:00
Kernel: Store process arguments and environment in coredumps
Currently they're only pushed onto the stack but not easily accessible from the Process class, so this adds a Vector<String> for both.
This commit is contained in:
parent
7668e968af
commit
1ccc2e6482
Notes:
sideshowbarker
2024-07-18 23:47:31 +09:00
Author: https://github.com/linusg Commit: https://github.com/SerenityOS/serenity/commit/1ccc2e6482a Pull-request: https://github.com/SerenityOS/serenity/pull/4963
@ -1,6 +1,7 @@
|
||||
/*
|
||||
* Copyright (c) 2019-2020, Jesse Buhagiar <jooster669@gmail.com>
|
||||
* Copyright (c) 2020, Itamar S. <itamar8910@gmail.com>
|
||||
* Copyright (c) 2020-2021, Linus Groh <mail@linusgroh.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -26,6 +27,7 @@
|
||||
*/
|
||||
|
||||
#include <AK/ByteBuffer.h>
|
||||
#include <AK/JsonArray.h>
|
||||
#include <AK/JsonObject.h>
|
||||
#include <Kernel/CoreDump.h>
|
||||
#include <Kernel/FileSystem/Custody.h>
|
||||
@ -225,6 +227,8 @@ ByteBuffer CoreDump::create_notes_process_data() const
|
||||
process_obj.set("pid", m_process->pid().value());
|
||||
process_obj.set("termination_signal", m_process->termination_signal());
|
||||
process_obj.set("executable_path", m_process->executable() ? m_process->executable()->absolute_path() : String::empty());
|
||||
process_obj.set("arguments", JsonArray(m_process->arguments()));
|
||||
process_obj.set("environment", JsonArray(m_process->environment()));
|
||||
|
||||
auto json_data = process_obj.to_string();
|
||||
process_data.append(json_data.characters(), json_data.length() + 1);
|
||||
|
@ -641,6 +641,8 @@ void Process::finalize()
|
||||
m_cwd = nullptr;
|
||||
m_root_directory = nullptr;
|
||||
m_root_directory_relative_to_global_root = nullptr;
|
||||
m_arguments.clear();
|
||||
m_environment.clear();
|
||||
|
||||
m_dead = true;
|
||||
|
||||
|
@ -400,6 +400,9 @@ public:
|
||||
Custody* executable() { return m_executable.ptr(); }
|
||||
const Custody* executable() const { return m_executable.ptr(); }
|
||||
|
||||
const Vector<String>& arguments() const { return m_arguments; };
|
||||
const Vector<String>& environment() const { return m_environment; };
|
||||
|
||||
int number_of_open_file_descriptors() const;
|
||||
int max_open_file_descriptors() const
|
||||
{
|
||||
@ -614,6 +617,9 @@ private:
|
||||
RefPtr<Custody> m_root_directory;
|
||||
RefPtr<Custody> m_root_directory_relative_to_global_root;
|
||||
|
||||
Vector<String> m_arguments;
|
||||
Vector<String> m_environment;
|
||||
|
||||
RefPtr<TTY> m_tty;
|
||||
|
||||
Region* find_region_from_range(const Range&);
|
||||
|
@ -507,6 +507,8 @@ int Process::do_exec(NonnullRefPtr<FileDescription> main_program_description, Ve
|
||||
#endif
|
||||
|
||||
m_executable = main_program_description->custody();
|
||||
m_arguments = arguments;
|
||||
m_environment = environment;
|
||||
|
||||
m_promises = m_execpromises;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user