mirror of
https://github.com/RGBCube/serenity
synced 2025-06-01 03:08:13 +00:00
LibCoreDump: Expose arguments and environment
We can pull those from the coredump's ProcessInfo JSON, do some basic sanity checks and expose them as ready-to-use Vector<String>s.
This commit is contained in:
parent
1ccc2e6482
commit
0187fd4fdd
2 changed files with 32 additions and 2 deletions
|
@ -184,7 +184,35 @@ String Reader::process_executable_path() const
|
|||
return executable_path.as_string_or({});
|
||||
}
|
||||
|
||||
const HashMap<String, String> Reader::metadata() const
|
||||
Vector<String> Reader::process_arguments() const
|
||||
{
|
||||
auto process_info = this->process_info();
|
||||
auto arguments = process_info.get("arguments");
|
||||
if (!arguments.is_array())
|
||||
return {};
|
||||
Vector<String> vector;
|
||||
arguments.as_array().for_each([&](auto& value) {
|
||||
if (value.is_string())
|
||||
vector.append(value.as_string());
|
||||
});
|
||||
return vector;
|
||||
}
|
||||
|
||||
Vector<String> Reader::process_environment() const
|
||||
{
|
||||
auto process_info = this->process_info();
|
||||
auto environment = process_info.get("environment");
|
||||
if (!environment.is_array())
|
||||
return {};
|
||||
Vector<String> vector;
|
||||
environment.as_array().for_each([&](auto& value) {
|
||||
if (value.is_string())
|
||||
vector.append(value.as_string());
|
||||
});
|
||||
return vector;
|
||||
}
|
||||
|
||||
HashMap<String, String> Reader::metadata() const
|
||||
{
|
||||
const ELF::Core::Metadata* metadata_notes_entry = nullptr;
|
||||
for (NotesEntryIterator it((const u8*)m_coredump_image.program_header(m_notes_segment_index).raw_data()); !it.at_end(); it.next()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue