================
@@ -402,6 +413,29 @@ class ObjectFileELF : public lldb_private::ObjectFile {
   /// .gnu_debugdata section or \c nullptr if an error occured or if there's no
   /// section with that name.
   std::shared_ptr<ObjectFileELF> GetGnuDebugDataObjectFile();
+
+  /// Get the bytes that represent the .dynamic section.
+  ///
+  /// This function will fetch the data for the .dynamic section in an ELF 
file.
+  /// If the ELF file is loaded from a file on disk, it will use the PT_DYNAMIC
+  /// program header to extract the data and fall back to using the section
+  /// headers. If the ELF file is loaded from memory, it will use the 
PT_DYNAMIC
+  /// program header to get the information.
+  ///
+  /// \return The bytes that represent the string table data or \c std::nullopt
+  ///         if an error occured.
+  std::optional<lldb_private::DataExtractor> GetDynamicData();
----------------
labath wrote:

I don't feel strongly, but my thinking is like:
- we should handle both the case where the dynamic section is missing (for 
whatever reason) and when it is present, but empty (for whatever reason)
- we probably want to handle both cases the same way (probably by doing nothing 
and bailing out)
- if we coalesce the two cases into one, the caller is more likely to get both 
of them right

https://github.com/llvm/llvm-project/pull/101237
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to