[Lldb-commits] [lldb] [lldb] Make ELF files able to load section headers from memory. (PR #129166)

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Mon Mar 10 08:03:48 PDT 2025


================
@@ -556,6 +556,28 @@ static bool GetOsFromOSABI(unsigned char osabi_byte,
   return ostype != llvm::Triple::OSType::UnknownOS;
 }
 
+/// Read the bytes for the section headers from the ELF object file data.
+static DataExtractor GetSectionHeadersFromELFData(
+  const elf::ELFHeader &header, const DataExtractor &object_data) {
+  DataExtractor sh_data;
+  const elf_off sh_offset = header.e_shoff;
+  const size_t sh_size = header.GetSectionHeaderByteSize();
+  sh_data.SetData(object_data, sh_offset, sh_size);
+  return sh_data;
----------------
labath wrote:

```suggestion
  return DataExtractor(object_data, header.e_shoff, header.GetSectionHeaderByteSize());
```

https://github.com/llvm/llvm-project/pull/129166


More information about the lldb-commits mailing list