[Lldb-commits] [lldb] r230228 - Exit early from DumpELFProgramHeaders if parse fails

Ed Maste emaste at freebsd.org
Mon Feb 23 07:33:11 PST 2015


Author: emaste
Date: Mon Feb 23 09:33:11 2015
New Revision: 230228

URL: http://llvm.org/viewvc/llvm-project?rev=230228&view=rev
Log:
Exit early from DumpELFProgramHeaders if parse fails

This matches the way DumpELFSectionHeaders is implemented and is
recommended by the LLVM coding conventions.

Modified:
    lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp

Modified: lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp?rev=230228&r1=230227&r2=230228&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp Mon Feb 23 09:33:11 2015
@@ -2631,22 +2631,22 @@ ObjectFileELF::DumpELFProgramHeader_p_fl
 void
 ObjectFileELF::DumpELFProgramHeaders(Stream *s)
 {
-    if (ParseProgramHeaders())
-    {
-        s->PutCString("Program Headers\n");
-        s->PutCString("IDX  p_type          p_offset p_vaddr  p_paddr  "
-                      "p_filesz p_memsz  p_flags                   p_align\n");
-        s->PutCString("==== --------------- -------- -------- -------- "
-                      "-------- -------- ------------------------- --------\n");
+    if (!ParseProgramHeaders())
+        return;
+
+    s->PutCString("Program Headers\n");
+    s->PutCString("IDX  p_type          p_offset p_vaddr  p_paddr  "
+                  "p_filesz p_memsz  p_flags                   p_align\n");
+    s->PutCString("==== --------------- -------- -------- -------- "
+                  "-------- -------- ------------------------- --------\n");
 
-        uint32_t idx = 0;
-        for (ProgramHeaderCollConstIter I = m_program_headers.begin();
-             I != m_program_headers.end(); ++I, ++idx)
-        {
-            s->Printf("[%2u] ", idx);
-            ObjectFileELF::DumpELFProgramHeader(s, *I);
-            s->EOL();
-        }
+    uint32_t idx = 0;
+    for (ProgramHeaderCollConstIter I = m_program_headers.begin();
+         I != m_program_headers.end(); ++I, ++idx)
+    {
+        s->Printf("[%2u] ", idx);
+        ObjectFileELF::DumpELFProgramHeader(s, *I);
+        s->EOL();
     }
 }
 





More information about the lldb-commits mailing list