mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 07:48:11 +00:00
UserspaceEmulator: Support dynamically loaded programs
When loading dynamic objects, the emulator loads the interpreter, generates an auxiliary vector and starts executing the loader. Additionally, this commits also makes the MallocTracer and backtrace symbolication work for dynamically loaded programs.
This commit is contained in:
parent
28cda567c1
commit
72ca45e300
9 changed files with 247 additions and 64 deletions
|
@ -50,14 +50,6 @@ int main(int argc, char** argv, char** env)
|
|||
|
||||
auto executable_path = Core::find_executable_in_path(command[0]);
|
||||
|
||||
MappedFile mapped_file(executable_path);
|
||||
if (!mapped_file.is_valid()) {
|
||||
reportln("Unable to map {}", executable_path);
|
||||
return 1;
|
||||
}
|
||||
|
||||
auto elf = ELF::Loader::create((const u8*)mapped_file.data(), mapped_file.size());
|
||||
|
||||
Vector<String> arguments;
|
||||
for (auto arg : command) {
|
||||
arguments.append(arg);
|
||||
|
@ -69,7 +61,7 @@ int main(int argc, char** argv, char** env)
|
|||
}
|
||||
|
||||
// FIXME: It might be nice to tear down the emulator properly.
|
||||
auto& emulator = *new UserspaceEmulator::Emulator(arguments, environment, move(elf));
|
||||
auto& emulator = *new UserspaceEmulator::Emulator(executable_path, arguments, environment);
|
||||
if (!emulator.load_elf())
|
||||
return 1;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue