forked from OSchip/llvm-project
Bunch of cleanups for warnings found by the llvm static analyzer.
llvm-svn: 165808
This commit is contained in:
parent
e87f41f43e
commit
28eb57114d
|
@ -50,11 +50,6 @@ public:
|
|||
lldb::VariableSP
|
||||
FindVariable (const ConstString& name);
|
||||
|
||||
// Find the argument variable that represents the language specific
|
||||
// object pointer ("this" in C++, or "self" in Objective C).
|
||||
lldb::VariableSP
|
||||
FindArtificialObjectVariable (lldb::LanguageType language) const;
|
||||
|
||||
uint32_t
|
||||
FindVariableIndex (const lldb::VariableSP &var_sp);
|
||||
|
||||
|
|
|
@ -4544,7 +4544,6 @@
|
|||
);
|
||||
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.7;
|
||||
OTHER_CFLAGS = "";
|
||||
OTHER_LDFLAGS = "";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
|
@ -4562,7 +4561,6 @@
|
|||
CURRENT_PROJECT_VERSION = 168;
|
||||
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.7;
|
||||
OTHER_CFLAGS = "";
|
||||
OTHER_LDFLAGS = "";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
|
@ -4580,7 +4578,6 @@
|
|||
CURRENT_PROJECT_VERSION = 168;
|
||||
GCC_ENABLE_OBJC_EXCEPTIONS = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.7;
|
||||
OTHER_CFLAGS = "";
|
||||
OTHER_LDFLAGS = "";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
|
@ -4604,7 +4601,6 @@
|
|||
HEADER_SEARCH_PATHS = /usr/include/libxml2;
|
||||
LD_DYLIB_INSTALL_NAME = "$(DEVELOPER_DIR)/Library/PrivateFrameworks/LLDB.framework/Resources/lldb-core.a";
|
||||
MACH_O_TYPE = staticlib;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.7;
|
||||
OTHER_CPLUSPLUSFLAGS = (
|
||||
"-fno-rtti",
|
||||
"-Wglobal-constructors",
|
||||
|
@ -4635,7 +4631,6 @@
|
|||
HEADER_SEARCH_PATHS = /usr/include/libxml2;
|
||||
LD_DYLIB_INSTALL_NAME = "$(DEVELOPER_DIR)/Library/PrivateFrameworks/LLDB.framework/Resources/lldb-core.a";
|
||||
MACH_O_TYPE = staticlib;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.7;
|
||||
OTHER_CPLUSPLUSFLAGS = (
|
||||
"-fno-rtti",
|
||||
"-Wglobal-constructors",
|
||||
|
@ -4666,7 +4661,6 @@
|
|||
HEADER_SEARCH_PATHS = /usr/include/libxml2;
|
||||
LD_DYLIB_INSTALL_NAME = "$(DEVELOPER_DIR)/Library/PrivateFrameworks/LLDB.framework/Resources/lldb-core.a";
|
||||
MACH_O_TYPE = staticlib;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.7;
|
||||
OTHER_CPLUSPLUSFLAGS = (
|
||||
"-fno-rtti",
|
||||
"-Wglobal-constructors",
|
||||
|
@ -5363,7 +5357,6 @@
|
|||
HEADER_SEARCH_PATHS = /usr/include/libxml2;
|
||||
LD_DYLIB_INSTALL_NAME = "$(DEVELOPER_DIR)/Library/PrivateFrameworks/LLDB.framework/Resources/lldb-core.a";
|
||||
MACH_O_TYPE = staticlib;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.7;
|
||||
OTHER_CPLUSPLUSFLAGS = (
|
||||
"-fno-rtti",
|
||||
"-Wglobal-constructors",
|
||||
|
@ -5532,7 +5525,6 @@
|
|||
);
|
||||
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.7;
|
||||
OTHER_CFLAGS = "";
|
||||
OTHER_LDFLAGS = "";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
|
|
|
@ -116,6 +116,8 @@ SBTypeNameSpecifier::IsEqualTo (lldb::SBTypeNameSpecifier &rhs)
|
|||
|
||||
if (IsRegex() != rhs.IsRegex())
|
||||
return false;
|
||||
if (GetName() == NULL || rhs.GetName() == NULL)
|
||||
return false;
|
||||
|
||||
return (strcmp(GetName(), rhs.GetName()) == 0);
|
||||
}
|
||||
|
|
|
@ -233,7 +233,7 @@ SBTypeSummary::IsEqualTo (lldb::SBTypeSummary &rhs)
|
|||
if (IsFunctionName() != rhs.IsFunctionName())
|
||||
return false;
|
||||
|
||||
if ( strcmp(GetData(), rhs.GetData()) )
|
||||
if ( GetData() == NULL || rhs.GetData() == NULL || strcmp(GetData(), rhs.GetData()) )
|
||||
return false;
|
||||
|
||||
return GetOptions() == rhs.GetOptions();
|
||||
|
|
|
@ -1227,7 +1227,7 @@ DumpModuleArchitecture (Stream &strm, Module *module, bool full_triple, uint32_t
|
|||
static void
|
||||
DumpModuleUUID (Stream &strm, Module *module)
|
||||
{
|
||||
if (module->GetUUID().IsValid())
|
||||
if (module && module->GetUUID().IsValid())
|
||||
module->GetUUID().Dump (&strm);
|
||||
else
|
||||
strm.PutCString(" ");
|
||||
|
@ -2720,8 +2720,14 @@ protected:
|
|||
}
|
||||
else
|
||||
{
|
||||
module->GetFileSpec().GetPath (path, sizeof(path));
|
||||
result.AppendErrorWithFormat ("invalid module '%s'.\n", path);
|
||||
FileSpec *module_spec_file = module_spec.GetFileSpecPtr();
|
||||
if (module_spec_file)
|
||||
{
|
||||
module_spec_file->GetPath (path, sizeof(path));
|
||||
result.AppendErrorWithFormat ("invalid module '%s'.\n", path);
|
||||
}
|
||||
else
|
||||
result.AppendError ("no module spec");
|
||||
result.SetStatus (eReturnStatusFailed);
|
||||
}
|
||||
}
|
||||
|
@ -3033,6 +3039,12 @@ protected:
|
|||
PrintModule (Target *target, Module *module, uint32_t idx, int indent, Stream &strm)
|
||||
{
|
||||
|
||||
if (module == NULL)
|
||||
{
|
||||
strm.PutCString("Null module");
|
||||
return;
|
||||
}
|
||||
|
||||
bool dump_object_name = false;
|
||||
if (m_options.m_format_array.empty())
|
||||
{
|
||||
|
|
|
@ -117,12 +117,14 @@ ClangExpressionDeclMap::DidParse()
|
|||
++entity_index)
|
||||
{
|
||||
ClangExpressionVariableSP var_sp(m_found_entities.GetVariableAtIndex(entity_index));
|
||||
if (var_sp &&
|
||||
var_sp->m_parser_vars.get() &&
|
||||
var_sp->m_parser_vars->m_lldb_value)
|
||||
if (var_sp)
|
||||
{
|
||||
if (var_sp->m_parser_vars.get() &&
|
||||
var_sp->m_parser_vars->m_lldb_value)
|
||||
delete var_sp->m_parser_vars->m_lldb_value;
|
||||
|
||||
var_sp->DisableParserVars();
|
||||
var_sp->DisableParserVars();
|
||||
}
|
||||
}
|
||||
|
||||
for (size_t pvar_index = 0, num_pvars = m_parser_vars->m_persistent_vars->GetSize();
|
||||
|
@ -2706,7 +2708,7 @@ ClangExpressionDeclMap::FindExternalVisibleDecls (NameSearchContext &context,
|
|||
append,
|
||||
sc_list);
|
||||
}
|
||||
else if (!namespace_decl)
|
||||
else if (target && !namespace_decl)
|
||||
{
|
||||
const bool include_symbols = true;
|
||||
|
||||
|
|
|
@ -755,6 +755,7 @@ ClangExpressionParser::DisassembleFunction (Stream &stream, ExecutionContext &ex
|
|||
{
|
||||
ret.SetErrorToGenericError();
|
||||
ret.SetErrorString("Couldn't find the target");
|
||||
return ret;
|
||||
}
|
||||
|
||||
lldb::DataBufferSP buffer_sp(new DataBufferHeap(func_range.second, 0));
|
||||
|
|
|
@ -552,7 +552,7 @@ ClangUserExpression::Execute (Stream &error_stream,
|
|||
|
||||
if (m_jit_start_addr != LLDB_INVALID_ADDRESS)
|
||||
{
|
||||
lldb::addr_t struct_address;
|
||||
lldb::addr_t struct_address = LLDB_INVALID_ADDRESS;
|
||||
|
||||
lldb::addr_t object_ptr = 0;
|
||||
lldb::addr_t cmd_ptr = 0;
|
||||
|
|
|
@ -78,11 +78,14 @@ static std::string
|
|||
PrintValue(const Value *value, bool truncate = false)
|
||||
{
|
||||
std::string s;
|
||||
raw_string_ostream rso(s);
|
||||
value->print(rso);
|
||||
rso.flush();
|
||||
if (truncate)
|
||||
s.resize(s.length() - 1);
|
||||
if (value)
|
||||
{
|
||||
raw_string_ostream rso(s);
|
||||
value->print(rso);
|
||||
rso.flush();
|
||||
if (truncate)
|
||||
s.resize(s.length() - 1);
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
|
@ -238,7 +241,7 @@ IRForTarget::GetFunctionAddress (llvm::Function *fun,
|
|||
// Check for an alternate mangling for "std::basic_string<char>"
|
||||
// that is part of the itanium C++ name mangling scheme
|
||||
const char *name_cstr = name.GetCString();
|
||||
if (strncmp(name_cstr, "_ZNKSbIcE", strlen("_ZNKSbIcE")) == 0)
|
||||
if (name_cstr && strncmp(name_cstr, "_ZNKSbIcE", strlen("_ZNKSbIcE")) == 0)
|
||||
{
|
||||
std::string alternate_mangling("_ZNKSs");
|
||||
alternate_mangling.append (name_cstr + strlen("_ZNKSbIcE"));
|
||||
|
@ -492,6 +495,9 @@ IRForTarget::MaybeSetCastResult (lldb_private::TypeFromParser type)
|
|||
}
|
||||
}
|
||||
|
||||
if (!original_load)
|
||||
return;
|
||||
|
||||
Value *loaded_value = original_load->getPointerOperand();
|
||||
GlobalVariable *loaded_global = dyn_cast<GlobalVariable>(loaded_value);
|
||||
|
||||
|
|
|
@ -55,6 +55,7 @@ CommandObjectScript::DoExecute
|
|||
{
|
||||
result.AppendError("no script interpreter");
|
||||
result.SetStatus (eReturnStatusFailed);
|
||||
return false;
|
||||
}
|
||||
|
||||
DataVisualization::ForceUpdate(); // script might change Python code we use for formatting.. make sure we keep up to date with it
|
||||
|
|
|
@ -439,7 +439,8 @@ Options::GenerateOptionUsage
|
|||
|
||||
// Different option sets may require different args.
|
||||
StreamString args_str;
|
||||
cmd->GetFormattedCommandArguments(args_str, opt_set_mask);
|
||||
if (cmd)
|
||||
cmd->GetFormattedCommandArguments(args_str, opt_set_mask);
|
||||
|
||||
// First go through and print all options that take no arguments as
|
||||
// a single string. If a command has "-a" "-b" and "-c", this will show
|
||||
|
@ -569,7 +570,8 @@ Options::GenerateOptionUsage
|
|||
}
|
||||
}
|
||||
|
||||
if (cmd->WantsRawCommandString() &&
|
||||
if (cmd &&
|
||||
cmd->WantsRawCommandString() &&
|
||||
arguments_str.GetSize() > 0)
|
||||
{
|
||||
strm.PutChar('\n');
|
||||
|
|
|
@ -618,9 +618,8 @@ ABISysV_x86_64::SetReturnValueObject(lldb::StackFrameSP &frame_sp, lldb::ValueOb
|
|||
|
||||
unsigned char buffer[16];
|
||||
ByteOrder byte_order = data.GetByteOrder();
|
||||
uint32_t return_bytes;
|
||||
|
||||
return_bytes = data.CopyByteOrderedData (0, num_bytes, buffer, 16, byte_order);
|
||||
data.CopyByteOrderedData (0, num_bytes, buffer, 16, byte_order);
|
||||
xmm0_value.SetBytes(buffer, 16, byte_order);
|
||||
reg_ctx->WriteRegister(xmm0_info, xmm0_value);
|
||||
set_it_simple = true;
|
||||
|
|
|
@ -178,11 +178,15 @@ InstructionLLVM::CalculateMnemonicOperandsAndComment (const ExecutionContext* ex
|
|||
uint32_t addr_nibble_size = 8;
|
||||
addr_t base_addr = LLDB_INVALID_ADDRESS;
|
||||
Target *target = exe_ctx ? exe_ctx->GetTargetPtr() : NULL;
|
||||
if (target && !target->GetSectionLoadList().IsEmpty())
|
||||
base_addr = GetAddress().GetLoadAddress (target);
|
||||
if (target)
|
||||
{
|
||||
addr_nibble_size = target->GetArchitecture().GetAddressByteSize() * 2;
|
||||
if (!target->GetSectionLoadList().IsEmpty())
|
||||
base_addr = GetAddress().GetLoadAddress (target);
|
||||
}
|
||||
|
||||
if (base_addr == LLDB_INVALID_ADDRESS)
|
||||
base_addr = GetAddress().GetFileAddress ();
|
||||
addr_nibble_size = target->GetArchitecture().GetAddressByteSize() * 2;
|
||||
|
||||
lldb::addr_t PC = base_addr + EDInstByteSize(m_inst);
|
||||
|
||||
|
|
|
@ -446,7 +446,7 @@ DynamicLoaderDarwinKernel::LoadKernelModuleIfNeeded()
|
|||
}
|
||||
}
|
||||
|
||||
if (m_kernel.IsLoaded())
|
||||
if (m_kernel.IsLoaded() && m_kernel.module_sp)
|
||||
{
|
||||
static ConstString kext_summary_symbol ("gLoadedKextSummaries");
|
||||
const Symbol *symbol = m_kernel.module_sp->FindFirstSymbolWithNameAndType (kext_summary_symbol, eSymbolTypeData);
|
||||
|
|
|
@ -3570,24 +3570,27 @@ ObjectFileMachO::GetThreadContextAtIndex (uint32_t idx, lldb_private::Thread &th
|
|||
GetNumThreadContexts ();
|
||||
|
||||
const FileRangeArray::Entry *thread_context_file_range = m_thread_context_offsets.GetEntryAtIndex (idx);
|
||||
|
||||
DataExtractor data (m_data,
|
||||
thread_context_file_range->GetRangeBase(),
|
||||
thread_context_file_range->GetByteSize());
|
||||
|
||||
switch (m_header.cputype)
|
||||
if (thread_context_file_range)
|
||||
{
|
||||
case llvm::MachO::CPUTypeARM:
|
||||
reg_ctx_sp.reset (new RegisterContextDarwin_arm_Mach (thread, data));
|
||||
break;
|
||||
|
||||
case llvm::MachO::CPUTypeI386:
|
||||
reg_ctx_sp.reset (new RegisterContextDarwin_i386_Mach (thread, data));
|
||||
break;
|
||||
|
||||
case llvm::MachO::CPUTypeX86_64:
|
||||
reg_ctx_sp.reset (new RegisterContextDarwin_x86_64_Mach (thread, data));
|
||||
break;
|
||||
|
||||
DataExtractor data (m_data,
|
||||
thread_context_file_range->GetRangeBase(),
|
||||
thread_context_file_range->GetByteSize());
|
||||
|
||||
switch (m_header.cputype)
|
||||
{
|
||||
case llvm::MachO::CPUTypeARM:
|
||||
reg_ctx_sp.reset (new RegisterContextDarwin_arm_Mach (thread, data));
|
||||
break;
|
||||
|
||||
case llvm::MachO::CPUTypeI386:
|
||||
reg_ctx_sp.reset (new RegisterContextDarwin_i386_Mach (thread, data));
|
||||
break;
|
||||
|
||||
case llvm::MachO::CPUTypeX86_64:
|
||||
reg_ctx_sp.reset (new RegisterContextDarwin_x86_64_Mach (thread, data));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return reg_ctx_sp;
|
||||
|
|
|
@ -779,7 +779,7 @@ RegisterContextLLDB::GetFullUnwindPlanForFrame ()
|
|||
// right thing. It'd be nice if there was a way to ask the eh_frame directly if it is asynchronous
|
||||
// (can be trusted at every instruction point) or synchronous (the normal case - only at call sites).
|
||||
// But there is not.
|
||||
if (process->GetDynamicLoader() && process->GetDynamicLoader()->AlwaysRelyOnEHUnwindInfo (m_sym_ctx))
|
||||
if (process && process->GetDynamicLoader() && process->GetDynamicLoader()->AlwaysRelyOnEHUnwindInfo (m_sym_ctx))
|
||||
{
|
||||
unwind_plan_sp = func_unwinders_sp->GetUnwindPlanAtCallSite (m_current_offset_backed_up_one);
|
||||
if (unwind_plan_sp && unwind_plan_sp->PlanValidAtAddress (m_current_pc))
|
||||
|
|
|
@ -175,7 +175,7 @@ UnwindLLDB::AddOneMoreFrame (ABI *abi)
|
|||
{
|
||||
if (m_frames.back()->cfa == cursor_sp->cfa)
|
||||
goto unwind_done; // Infinite loop where the current cursor is the same as the previous one...
|
||||
else if (abi->StackUsesFrames())
|
||||
else if (abi && abi->StackUsesFrames())
|
||||
{
|
||||
// We might have a CFA that is not using the frame pointer and
|
||||
// we want to validate that the frame pointer is valid.
|
||||
|
|
|
@ -386,7 +386,9 @@ DWARFCompileUnit::BuildAddressRangeTable (SymbolFileDWARF* dwarf2Data,
|
|||
// down.
|
||||
const bool clear_dies = ExtractDIEsIfNeeded (false) > 1;
|
||||
|
||||
DIE()->BuildAddressRangeTable(dwarf2Data, this, debug_aranges);
|
||||
const DWARFDebugInfoEntry* die = DIE();
|
||||
if (die)
|
||||
die->BuildAddressRangeTable(dwarf2Data, this, debug_aranges);
|
||||
|
||||
// Keep memory down by clearing DIEs if this generate function
|
||||
// caused them to be parsed
|
||||
|
@ -410,7 +412,9 @@ DWARFCompileUnit::GetFunctionAranges ()
|
|||
"DWARFCompileUnit::GetFunctionAranges() for compile unit at .debug_info[0x%8.8x]",
|
||||
GetOffset());
|
||||
}
|
||||
DIE()->BuildFunctionAddressRangeTable (m_dwarf2Data, this, m_func_aranges_ap.get());
|
||||
const DWARFDebugInfoEntry* die = DIE();
|
||||
if (die)
|
||||
die->BuildFunctionAddressRangeTable (m_dwarf2Data, this, m_func_aranges_ap.get());
|
||||
const bool minimize = false;
|
||||
m_func_aranges_ap->Sort(minimize);
|
||||
}
|
||||
|
|
|
@ -117,10 +117,11 @@ DWARFDebugAranges::Dump (Log *log) const
|
|||
for (size_t i=0; i<num_entries; ++i)
|
||||
{
|
||||
const RangeToDIE::Entry *entry = m_aranges.GetEntryAtIndex(i);
|
||||
log->Printf ("0x%8.8x: [0x%llx - 0x%llx)",
|
||||
entry->data,
|
||||
entry->GetRangeBase(),
|
||||
entry->GetRangeEnd());
|
||||
if (entry)
|
||||
log->Printf ("0x%8.8x: [0x%llx - 0x%llx)",
|
||||
entry->data,
|
||||
entry->GetRangeBase(),
|
||||
entry->GetRangeEnd());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -701,7 +701,10 @@ DWARFDebugInfo::Dump (Stream *s, const uint32_t die_offset, const uint32_t recur
|
|||
{
|
||||
const DWARFCompileUnitSP& cu_sp = *pos;
|
||||
DumpCallback(m_dwarf2Data, (DWARFCompileUnitSP&)cu_sp, NULL, 0, curr_depth, &dumpInfo);
|
||||
cu_sp->DIE()->Dump(m_dwarf2Data, cu_sp.get(), *s, recurse_depth);
|
||||
|
||||
const DWARFDebugInfoEntry* die = cu_sp->DIE();
|
||||
if (die)
|
||||
die->Dump(m_dwarf2Data, cu_sp.get(), *s, recurse_depth);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1035,6 +1035,7 @@ DWARFDebugInfoEntry::DumpAttribute
|
|||
{
|
||||
bool verbose = s.GetVerbose();
|
||||
bool show_form = s.GetFlags().Test(DWARFDebugInfo::eDumpFlag_ShowForm);
|
||||
|
||||
const DataExtractor* debug_str_data = dwarf2Data ? &dwarf2Data->get_debug_str_data() : NULL;
|
||||
if (verbose)
|
||||
s.Offset (*offset_ptr);
|
||||
|
@ -1158,7 +1159,8 @@ DWARFDebugInfoEntry::DumpAttribute
|
|||
form_value.Dump(s, debug_str_data, cu);
|
||||
uint32_t ranges_offset = form_value.Unsigned();
|
||||
dw_addr_t base_addr = cu ? cu->GetBaseAddress() : 0;
|
||||
DWARFDebugRanges::Dump(s, dwarf2Data->get_debug_ranges_data(), &ranges_offset, base_addr);
|
||||
if (dwarf2Data)
|
||||
DWARFDebugRanges::Dump(s, dwarf2Data->get_debug_ranges_data(), &ranges_offset, base_addr);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -1509,6 +1511,9 @@ DWARFDebugInfoEntry::GetPubname
|
|||
) const
|
||||
{
|
||||
const char* name = NULL;
|
||||
if (!dwarf2Data)
|
||||
return name;
|
||||
|
||||
DWARFFormValue form_value;
|
||||
|
||||
if (GetAttributeValue(dwarf2Data, cu, DW_AT_MIPS_linkage_name, form_value))
|
||||
|
@ -1546,6 +1551,12 @@ DWARFDebugInfoEntry::GetName
|
|||
Stream &s
|
||||
)
|
||||
{
|
||||
if (dwarf2Data == NULL)
|
||||
{
|
||||
s.PutCString("NULL");
|
||||
return false;
|
||||
}
|
||||
|
||||
DWARFDebugInfoEntry die;
|
||||
uint32_t offset = die_offset;
|
||||
if (die.Extract(dwarf2Data, cu, &offset))
|
||||
|
@ -1589,6 +1600,12 @@ DWARFDebugInfoEntry::AppendTypeName
|
|||
Stream &s
|
||||
)
|
||||
{
|
||||
if (dwarf2Data == NULL)
|
||||
{
|
||||
s.PutCString("NULL");
|
||||
return false;
|
||||
}
|
||||
|
||||
DWARFDebugInfoEntry die;
|
||||
uint32_t offset = die_offset;
|
||||
if (die.Extract(dwarf2Data, cu, &offset))
|
||||
|
@ -1609,6 +1626,9 @@ DWARFDebugInfoEntry::AppendTypeName
|
|||
{
|
||||
bool result = true;
|
||||
const DWARFAbbreviationDeclaration* abbrevDecl = die.GetAbbreviationDeclarationPtr(dwarf2Data, cu, offset);
|
||||
|
||||
if (abbrevDecl == NULL)
|
||||
return false;
|
||||
|
||||
switch (abbrevDecl->Tag())
|
||||
{
|
||||
|
@ -2142,23 +2162,26 @@ DWARFDebugInfoEntry::GetAbbreviationDeclarationPtr (SymbolFileDWARF* dwarf2Data,
|
|||
const DWARFCompileUnit *cu,
|
||||
dw_offset_t &offset) const
|
||||
{
|
||||
offset = GetOffset();
|
||||
|
||||
const DWARFAbbreviationDeclaration* abbrev_decl = cu->GetAbbreviations()->GetAbbreviationDeclaration (m_abbr_idx);
|
||||
if (abbrev_decl)
|
||||
if (dwarf2Data)
|
||||
{
|
||||
// Make sure the abbreviation code still matches. If it doesn't and
|
||||
// the DWARF data was mmap'ed, the backing file might have been modified
|
||||
// which is bad news.
|
||||
const uint64_t abbrev_code = dwarf2Data->get_debug_info_data().GetULEB128 (&offset);
|
||||
|
||||
if (abbrev_decl->Code() == abbrev_code)
|
||||
return abbrev_decl;
|
||||
offset = GetOffset();
|
||||
|
||||
dwarf2Data->GetObjectFile()->GetModule()->ReportErrorIfModifyDetected ("0x%8.8x: the DWARF debug information has been modified (abbrev code was %u, and is now %u)",
|
||||
GetOffset(),
|
||||
(uint32_t)abbrev_decl->Code(),
|
||||
(uint32_t)abbrev_code);
|
||||
const DWARFAbbreviationDeclaration* abbrev_decl = cu->GetAbbreviations()->GetAbbreviationDeclaration (m_abbr_idx);
|
||||
if (abbrev_decl)
|
||||
{
|
||||
// Make sure the abbreviation code still matches. If it doesn't and
|
||||
// the DWARF data was mmap'ed, the backing file might have been modified
|
||||
// which is bad news.
|
||||
const uint64_t abbrev_code = dwarf2Data->get_debug_info_data().GetULEB128 (&offset);
|
||||
|
||||
if (abbrev_decl->Code() == abbrev_code)
|
||||
return abbrev_decl;
|
||||
|
||||
dwarf2Data->GetObjectFile()->GetModule()->ReportErrorIfModifyDetected ("0x%8.8x: the DWARF debug information has been modified (abbrev code was %u, and is now %u)",
|
||||
GetOffset(),
|
||||
(uint32_t)abbrev_decl->Code(),
|
||||
(uint32_t)abbrev_code);
|
||||
}
|
||||
}
|
||||
offset = DW_INVALID_OFFSET;
|
||||
return NULL;
|
||||
|
|
|
@ -34,11 +34,12 @@ DWARFLocationList::Dump(Stream &s, const DWARFCompileUnit* cu, const DataExtract
|
|||
|
||||
s.PutCString("\n ");
|
||||
s.Indent();
|
||||
s.AddressRange (start_addr + base_addr,
|
||||
end_addr + base_addr,
|
||||
cu->GetAddressByteSize(),
|
||||
NULL,
|
||||
": ");
|
||||
if (cu)
|
||||
s.AddressRange (start_addr + base_addr,
|
||||
end_addr + base_addr,
|
||||
cu->GetAddressByteSize(),
|
||||
NULL,
|
||||
": ");
|
||||
uint32_t loc_length = debug_loc_data.GetU16(&offset);
|
||||
|
||||
DataExtractor locationData(debug_loc_data, offset, loc_length);
|
||||
|
|
|
@ -921,9 +921,12 @@ SymbolFileDWARF::ParseCompileUnitLanguage (const SymbolContext& sc)
|
|||
if (dwarf_cu)
|
||||
{
|
||||
const DWARFDebugInfoEntry *die = dwarf_cu->GetCompileUnitDIEOnly();
|
||||
const uint32_t language = die->GetAttributeValueAsUnsigned(this, dwarf_cu, DW_AT_language, 0);
|
||||
if (language)
|
||||
return (lldb::LanguageType)language;
|
||||
if (die)
|
||||
{
|
||||
const uint32_t language = die->GetAttributeValueAsUnsigned(this, dwarf_cu, DW_AT_language, 0);
|
||||
if (language)
|
||||
return (lldb::LanguageType)language;
|
||||
}
|
||||
}
|
||||
return eLanguageTypeUnknown;
|
||||
}
|
||||
|
|
|
@ -316,6 +316,7 @@ ClangASTImporter::GetNamespaceMap(const clang::NamespaceDecl *decl)
|
|||
void
|
||||
ClangASTImporter::BuildNamespaceMap(const clang::NamespaceDecl *decl)
|
||||
{
|
||||
assert (decl);
|
||||
ASTContextMetadataSP context_md = GetContextMetadata(&decl->getASTContext());
|
||||
|
||||
const DeclContext *parent_context = decl->getDeclContext();
|
||||
|
|
|
@ -343,7 +343,9 @@ void
|
|||
Function::GetDescription(Stream *s, lldb::DescriptionLevel level, Target *target)
|
||||
{
|
||||
Type* func_type = GetType();
|
||||
*s << "id = " << (const UserID&)*this << ", name = \"" << func_type->GetName() << "\", range = ";
|
||||
const char *name = func_type ? func_type->GetName().AsCString() : "<unknown>";
|
||||
|
||||
*s << "id = " << (const UserID&)*this << ", name = \"" << name << "\", range = ";
|
||||
|
||||
Address::DumpStyle fallback_style;
|
||||
if (level == eDescriptionLevelVerbose)
|
||||
|
@ -493,10 +495,14 @@ Function::GetType() const
|
|||
clang_type_t
|
||||
Function::GetReturnClangType ()
|
||||
{
|
||||
clang::QualType clang_type (clang::QualType::getFromOpaquePtr(GetType()->GetClangFullType()));
|
||||
const clang::FunctionType *function_type = llvm::dyn_cast<clang::FunctionType> (clang_type);
|
||||
if (function_type)
|
||||
return function_type->getResultType().getAsOpaquePtr();
|
||||
Type *type = GetType();
|
||||
if (type)
|
||||
{
|
||||
clang::QualType clang_type (clang::QualType::getFromOpaquePtr(type->GetClangFullType()));
|
||||
const clang::FunctionType *function_type = llvm::dyn_cast<clang::FunctionType> (clang_type);
|
||||
if (function_type)
|
||||
return function_type->getResultType().getAsOpaquePtr();
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -178,41 +178,3 @@ VariableList::Dump(Stream *s, bool show_context) const
|
|||
(*pos)->Dump(s, show_context);
|
||||
}
|
||||
}
|
||||
|
||||
lldb::VariableSP
|
||||
VariableList::FindArtificialObjectVariable (lldb::LanguageType language) const
|
||||
{
|
||||
lldb::VariableSP object_variable_sp;
|
||||
ConstString object_variable_name;
|
||||
switch (language)
|
||||
{
|
||||
case eLanguageTypeC_plus_plus:
|
||||
object_variable_name.SetCString("this");
|
||||
break;
|
||||
|
||||
case eLanguageTypeObjC:
|
||||
case eLanguageTypeObjC_plus_plus:
|
||||
object_variable_name.SetCString("self");
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (object_variable_name)
|
||||
{
|
||||
const_iterator pos, end = m_variables.end();
|
||||
for (pos = m_variables.begin(); pos != end; ++pos)
|
||||
{
|
||||
Variable *variable = pos->get();
|
||||
if (variable->IsArtificial() &&
|
||||
variable->GetScope() == eValueTypeVariableArgument &&
|
||||
variable->GetName() == object_variable_name)
|
||||
{
|
||||
object_variable_sp = *pos;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return object_variable_sp;
|
||||
}
|
||||
|
||||
|
|
|
@ -274,8 +274,6 @@ StackFrameList::GetFramesUpTo(uint32_t end_idx)
|
|||
if (end_idx > 0)
|
||||
end_idx += inlined_depth;
|
||||
}
|
||||
else
|
||||
inlined_depth = 0;
|
||||
}
|
||||
|
||||
StackFrameSP unwind_frame_sp;
|
||||
|
|
|
@ -1451,6 +1451,7 @@ Thread::ReturnFromFrame (lldb::StackFrameSP frame_sp, lldb::ValueObjectSP return
|
|||
if (!abi)
|
||||
{
|
||||
return_error.SetErrorString("Could not find ABI to set return value.");
|
||||
return return_error;
|
||||
}
|
||||
SymbolContext sc = frame_sp->GetSymbolContext(eSymbolContextFunction);
|
||||
|
||||
|
|
|
@ -72,9 +72,12 @@ ThreadPlanTracer::Log()
|
|||
bool show_fullpaths = false;
|
||||
|
||||
Stream *stream = GetLogStream();
|
||||
m_thread.GetStackFrameAtIndex(0)->Dump (stream, show_frame_index, show_fullpaths);
|
||||
stream->Printf("\n");
|
||||
stream->Flush();
|
||||
if (stream)
|
||||
{
|
||||
m_thread.GetStackFrameAtIndex(0)->Dump (stream, show_frame_index, show_fullpaths);
|
||||
stream->Printf("\n");
|
||||
stream->Flush();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@ class AbbreviationsTestCase(TestBase):
|
|||
patterns = [ "Current executable set to .*a.out.*" ])
|
||||
|
||||
# By default, the setting interpreter.expand-regex-aliases is false.
|
||||
self.expect("_regexp-b product", matching=False,
|
||||
self.expect("_regexp-br product", matching=False,
|
||||
substrs = [ "breakpoint set --name" ])
|
||||
|
||||
match_object = lldbutil.run_break_set_command (self, "br s -n sum")
|
||||
|
|
Loading…
Reference in New Issue