diff options
author | Ed Maste <emaste@freebsd.org> | 2015-02-23 15:33:11 +0000 |
---|---|---|
committer | Ed Maste <emaste@freebsd.org> | 2015-02-23 15:33:11 +0000 |
commit | 3a8ab6ee2a40acc39533e0fa6825b2face4b6b53 (patch) | |
tree | f86d4a32ca2ad58925a955185cd59b8edea4d836 /lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp | |
parent | aec140380f31a24949a7b36c69d1bf588d20cccb (diff) | |
download | bcm5719-llvm-3a8ab6ee2a40acc39533e0fa6825b2face4b6b53.tar.gz bcm5719-llvm-3a8ab6ee2a40acc39533e0fa6825b2face4b6b53.zip |
Exit early from DumpELFProgramHeaders if parse fails
This matches the way DumpELFSectionHeaders is implemented and is
recommended by the LLVM coding conventions.
llvm-svn: 230228
Diffstat (limited to 'lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp')
-rw-r--r-- | lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp index e7bf20e1800..bf466c7ee9b 100644 --- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp +++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp @@ -2631,22 +2631,22 @@ ObjectFileELF::DumpELFProgramHeader_p_flags(Stream *s, elf_word p_flags) void ObjectFileELF::DumpELFProgramHeaders(Stream *s) { - if (ParseProgramHeaders()) + 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->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(); - } + s->Printf("[%2u] ", idx); + ObjectFileELF::DumpELFProgramHeader(s, *I); + s->EOL(); } } |