[lldb-dev] Patch to add API to read ELF ProgramHeader/Segment

Thirumurthi, Ashok ashok.thirumurthi at intel.com
Wed Jul 10 14:16:14 PDT 2013


Welcome back, Samuel, and thanks for the patch.  A few minor thoughts:

Consider testing id first so that parsing isn't required on the failure path.  Also, prefer nullptr over NULL throughout:
+    if (!ParseProgramHeaders() || !id)
+        return NULL;

Consider adding a failure patch if GetProgramHeaderByIndex returns nullptr:
+    const elf::ELFProgramHeader *segment_header = GetProgramHeaderByIndex(id);
+    return DataExtractor(m_data, segment_header->p_offset, segment_header->p_filesz);

Maybe avoid the cross-post also so we have just one thread for the review.  Cheers,


-        Ashok

From: lldb-dev-bounces at cs.uiuc.edu [mailto:lldb-dev-bounces at cs.uiuc.edu] On Behalf Of Samuel Jacob
Sent: Wednesday, July 10, 2013 3:03 PM
To: lldb-dev; lldb-commits at cs.uiuc.edu
Subject: [lldb-dev] Patch to add API to read ELF ProgramHeader/Segment

The attached patch adds 3 new functions to ObjectFileELF which enables accessing ELF segment data possible.

Segment data is needed to support elf core files.

Please review and commit(if ok).

Thanks
Samuel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20130710/e9e19110/attachment.html>


More information about the lldb-dev mailing list