[Lldb-commits] [PATCH] D62501: Implement GetSharedLibraryInfoAddress

António Afonso via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Jun 10 09:14:26 PDT 2019


aadsm added a comment.

Initially one at a time but then thought it might be better to do it as a batch because I was afraid I was missing some dependency and would brake something unexpectedly. But I guess that since I've already landed D62168 <https://reviews.llvm.org/D62168> it's probably fine to land one at a time.



================
Comment at: lldb/unittests/Process/POSIX/NativeProcessELFTest.cpp:83-117
+  // We're going to set up a fake memory with 2 program headers and 1 entry in
+  // the dynamic section.
+  // For simplicity sake they will be consecutive in memory:
+  // +------------+
+  // | PT_PHDR    |
+  // +------------+
+  // | PT_DYNAMIC |
----------------
labath wrote:
> What if we just defined a struct which described the final memory layout, and then gave that as an argument to the FakeMemory object?
> 
> I'm thinking of something like:
> ```
> struct MemoryContents {
>   Elf32_Phdr phdr_load;
>   Elf32_Phdr phdr_dynamic;
>   Elf32_Dyn dyn_debug;
> } MC;
> MC.phdr_load.p_type = PT_DYNAMIC;
> ...
> FakeMemory M(&MC, sizeof MC, phdr_addr); // This assumes adding a (const void *, size_t) constructor to the class
> ```
Ah nice, why didn't I think about this before :D


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D62501/new/

https://reviews.llvm.org/D62501





More information about the lldb-commits mailing list