[Lldb-commits] [lldb] r219885 - It's possible for this function to not be passed a CompUnit*; add
Jason Molenda
jmolenda at apple.com
Wed Oct 15 18:21:26 PDT 2014
Author: jmolenda
Date: Wed Oct 15 20:21:25 2014
New Revision: 219885
URL: http://llvm.org/viewvc/llvm-project?rev=219885&view=rev
Log:
It's possible for this function to not be passed a CompUnit*; add
guards around a few additional uses of the cu local pointer.
clang static analyzer fixit.
Modified:
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp?rev=219885&r1=219884&r2=219885&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp Wed Oct 15 20:21:25 2014
@@ -556,8 +556,14 @@ static dw_offset_t DumpCallback
{
// We are dumping everything
if (cu)
+ {
cu->Dump(s);
- return cu->GetFirstDIEOffset(); // Return true to parse all DIEs in this Compile Unit
+ return cu->GetFirstDIEOffset(); // Return true to parse all DIEs in this Compile Unit
+ }
+ else
+ {
+ return DW_INVALID_OFFSET;
+ }
}
else
{
@@ -578,7 +584,7 @@ static dw_offset_t DumpCallback
else
{
// See if the DIE is in this compile unit?
- if (dumpInfo->die_offset < cu->GetNextCompileUnitOffset())
+ if (cu && dumpInfo->die_offset < cu->GetNextCompileUnitOffset())
{
// This DIE is in this compile unit!
if (s->GetVerbose())
@@ -591,7 +597,14 @@ static dw_offset_t DumpCallback
else
{
// Skip to the next compile unit as the DIE isn't in the current one!
- return cu->GetNextCompileUnitOffset();
+ if (cu)
+ {
+ return cu->GetNextCompileUnitOffset();
+ }
+ else
+ {
+ return DW_INVALID_OFFSET;
+ }
}
}
}
More information about the lldb-commits
mailing list