diff options
author | Bill Wendling <isanbard@gmail.com> | 2013-05-22 22:15:26 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2013-05-22 22:15:26 +0000 |
commit | ce59b5576b717bc4ee8159d740d208d33daa9c3d (patch) | |
tree | a60cf13546d46765cc7e7b61ae728ec4e32f8d4e | |
parent | 04df32daa12408b2f971c82625ba877168f7c1c7 (diff) | |
download | llvm-ce59b5576b717bc4ee8159d740d208d33daa9c3d.tar.gz |
Reverting these patches. They were causing regressions. :-(llvmorg-3.3.0-rc2
--- Reverse-merging r182522 into '.':
U source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
U .
--- Reverse-merging r182521 into '.':
U source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp
G .
--- Reverse-merging r182520 into '.':
U source/Core/ValueObjectVariable.cpp
G .
--- Reverse-merging r182519 into '.':
U source/Symbol/Variable.cpp
G .
--- Reverse-merging r182518 into '.':
U source/Plugins/Process/Linux/ProcessMonitor.cpp
U source/Plugins/Process/Linux/ProcessLinux.h
G .
--- Reverse-merging r182517 into '.':
G source/Plugins/Process/Linux/ProcessMonitor.cpp
G .
--- Reverse-merging r182516 into '.':
U source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
U source/Expression/DWARFExpression.cpp
U source/Expression/Materializer.cpp
U source/Expression/ClangExpressionDeclMap.cpp
G .
llvm-svn: 182525
10 files changed, 230 insertions, 219 deletions
diff --git a/lldb/source/Core/ValueObjectVariable.cpp b/lldb/source/Core/ValueObjectVariable.cpp index 4b18fb85a667..daff740399eb 100644 --- a/lldb/source/Core/ValueObjectVariable.cpp +++ b/lldb/source/Core/ValueObjectVariable.cpp @@ -187,7 +187,7 @@ ValueObjectVariable::UpdateValue () switch (value_type) { default: - m_error.SetErrorStringWithFormat("Variable %s has an expression result value %d which is currently unhandled",variable->GetName().GetCString(),value_type); + assert(!"Unhandled expression result value kind..."); break; case Value::eValueTypeScalar: diff --git a/lldb/source/Expression/ClangExpressionDeclMap.cpp b/lldb/source/Expression/ClangExpressionDeclMap.cpp index a1ccb007634f..dc1b89e935a4 100644 --- a/lldb/source/Expression/ClangExpressionDeclMap.cpp +++ b/lldb/source/Expression/ClangExpressionDeclMap.cpp @@ -1493,7 +1493,13 @@ ClangExpressionDeclMap::GetVariableValue return NULL; } } - + else if (!var_location_expr.Evaluate(&m_parser_vars->m_exe_ctx, ast, NULL, NULL, NULL, loclist_base_load_addr, NULL, *var_location.get(), &err)) + { + if (log) + log->Printf("Error evaluating location: %s", err.AsCString()); + return NULL; + } + void *type_to_use = NULL; if (parser_ast_context) diff --git a/lldb/source/Expression/DWARFExpression.cpp b/lldb/source/Expression/DWARFExpression.cpp index 07cb6881efe2..7951965ffec8 100644 --- a/lldb/source/Expression/DWARFExpression.cpp +++ b/lldb/source/Expression/DWARFExpression.cpp @@ -1303,13 +1303,6 @@ DWARFExpression::Evaluate Error *error_ptr ) { - - if (opcodes_length == 0) - { - if (error_ptr) - error_ptr->SetErrorString ("no location, value may have been optimized out"); - return false; - } std::vector<Value> stack; Process *process = NULL; @@ -1335,7 +1328,7 @@ DWARFExpression::Evaluate if (!opcodes.ValidOffsetForDataOfSize(opcodes_offset, opcodes_length)) { if (error_ptr) - error_ptr->SetErrorString ("invalid offset and/or length for opcodes buffer."); + error_ptr->SetErrorString ("Invalid offset and/or length for opcodes buffer."); return false; } Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS)); diff --git a/lldb/source/Expression/Materializer.cpp b/lldb/source/Expression/Materializer.cpp index f41a6134e12e..20ccc1fb1470 100644 --- a/lldb/source/Expression/Materializer.cpp +++ b/lldb/source/Expression/Materializer.cpp @@ -89,7 +89,8 @@ public: if (!allocate_error.Success()) { - err.SetErrorStringWithFormat("couldn't allocate a memory area to store %s: %s", m_persistent_variable_sp->GetName().GetCString(), allocate_error.AsCString()); + err.SetErrorToGenericError(); + err.SetErrorStringWithFormat("Couldn't allocate a memory area to store %s: %s", m_persistent_variable_sp->GetName().GetCString(), allocate_error.AsCString()); return; } @@ -122,7 +123,8 @@ public: if (!write_error.Success()) { - err.SetErrorStringWithFormat ("couldn't write %s to the target: %s", m_persistent_variable_sp->GetName().AsCString(), + err.SetErrorToGenericError(); + err.SetErrorStringWithFormat ("Couldn't write %s to the target: %s", m_persistent_variable_sp->GetName().AsCString(), write_error.AsCString()); return; } @@ -138,7 +140,8 @@ public: if (!deallocate_error.Success()) { - err.SetErrorStringWithFormat ("couldn't deallocate memory for %s: %s", m_persistent_variable_sp->GetName().GetCString(), deallocate_error.AsCString()); + err.SetErrorToGenericError(); + err.SetErrorStringWithFormat ("Couldn't deallocate memory for %s: %s", m_persistent_variable_sp->GetName().GetCString(), deallocate_error.AsCString()); } } @@ -175,12 +178,14 @@ public: if (!write_error.Success()) { - err.SetErrorStringWithFormat("couldn't write the location of %s to memory: %s", m_persistent_variable_sp->GetName().AsCString(), write_error.AsCString()); + err.SetErrorToGenericError(); + err.SetErrorStringWithFormat("Couldn't write the location of %s to memory: %s", m_persistent_variable_sp->GetName().AsCString(), write_error.AsCString()); } } else { - err.SetErrorStringWithFormat("no materialization happened for persistent variable %s", m_persistent_variable_sp->GetName().AsCString()); + err.SetErrorToGenericError(); + err.SetErrorStringWithFormat("No materialization happened for persistent variable %s", m_persistent_variable_sp->GetName().AsCString()); return; } } @@ -214,7 +219,8 @@ public: if (!read_error.Success()) { - err.SetErrorStringWithFormat("couldn't read the address of program-allocated variable %s: %s", m_persistent_variable_sp->GetName().GetCString(), read_error.AsCString()); + err.SetErrorToGenericError(); + err.SetErrorStringWithFormat("Couldn't read the address of program-allocated variable %s: %s", m_persistent_variable_sp->GetName().GetCString(), read_error.AsCString()); return; } @@ -245,13 +251,15 @@ public: if (!m_persistent_variable_sp->m_live_sp) { - err.SetErrorStringWithFormat("couldn't find the memory area used to store %s", m_persistent_variable_sp->GetName().GetCString()); + err.SetErrorToGenericError(); + err.SetErrorStringWithFormat("Couldn't find the memory area used to store %s", m_persistent_variable_sp->GetName().GetCString()); return; } if (m_persistent_variable_sp->m_live_sp->GetValue().GetValueAddressType() != eAddressTypeLoad) { - err.SetErrorStringWithFormat("the address of the memory area for %s is in an incorrect format", m_persistent_variable_sp->GetName().GetCString()); + err.SetErrorToGenericError(); + err.SetErrorStringWithFormat("The address of the memory area for %s is in an incorrect format", m_persistent_variable_sp->GetName().GetCString()); return; } @@ -274,7 +282,8 @@ public: if (!read_error.Success()) { - err.SetErrorStringWithFormat ("couldn't read the contents of %s from memory: %s", m_persistent_variable_sp->GetName().GetCString(), read_error.AsCString()); + err.SetErrorToGenericError(); + err.SetErrorStringWithFormat ("Couldn't read the contents of %s from memory: %s", m_persistent_variable_sp->GetName().GetCString(), read_error.AsCString()); return; } @@ -283,7 +292,8 @@ public: } else { - err.SetErrorStringWithFormat("no dematerialization happened for persistent variable %s", m_persistent_variable_sp->GetName().AsCString()); + err.SetErrorToGenericError(); + err.SetErrorStringWithFormat("No dematerialization happened for persistent variable %s", m_persistent_variable_sp->GetName().AsCString()); return; } @@ -425,7 +435,8 @@ public: if (!valobj_sp) { - err.SetErrorStringWithFormat("couldn't get a value object for variable %s", m_variable_sp->GetName().AsCString()); + err.SetErrorToGenericError(); + err.SetErrorStringWithFormat("Couldn't get a value object for variable %s", m_variable_sp->GetName().AsCString()); return; } @@ -441,7 +452,8 @@ public: if (!write_error.Success()) { - err.SetErrorStringWithFormat("couldn't write the contents of reference variable %s to memory: %s", m_variable_sp->GetName().AsCString(), write_error.AsCString()); + err.SetErrorToGenericError(); + err.SetErrorStringWithFormat("Couldn't write the contents of reference variable %s to memory: %s", m_variable_sp->GetName().AsCString(), write_error.AsCString()); return; } } @@ -461,7 +473,8 @@ public: if (!write_error.Success()) { - err.SetErrorStringWithFormat("couldn't write the address of variable %s to memory: %s", m_variable_sp->GetName().AsCString(), write_error.AsCString()); + err.SetErrorToGenericError(); + err.SetErrorStringWithFormat("Couldn't write the address of variable %s to memory: %s", m_variable_sp->GetName().AsCString(), write_error.AsCString()); return; } } @@ -472,20 +485,15 @@ public: if (m_temporary_allocation != LLDB_INVALID_ADDRESS) { - err.SetErrorStringWithFormat("trying to create a temporary region for %s but one exists", m_variable_sp->GetName().AsCString()); + err.SetErrorToGenericError(); + err.SetErrorStringWithFormat("Trying to create a temporary region for %s but one exists", m_variable_sp->GetName().AsCString()); return; } if (data.GetByteSize() != m_variable_sp->GetType()->GetByteSize()) { - if (data.GetByteSize() == 0 && m_variable_sp->LocationExpression().IsValid() == false) - { - err.SetErrorStringWithFormat("the variable '%s' has no location, it may have been optimized out", m_variable_sp->GetName().AsCString()); - } - else - { - err.SetErrorStringWithFormat("size of variable %s disagrees with the ValueObject's size", m_variable_sp->GetName().AsCString()); - } + err.SetErrorToGenericError(); + err.SetErrorStringWithFormat("Size of variable %s disagrees with the ValueObject's size", m_variable_sp->GetName().AsCString()); return; } @@ -499,7 +507,8 @@ public: if (!alloc_error.Success()) { - err.SetErrorStringWithFormat("couldn't allocate a temporary region for %s: %s", m_variable_sp->GetName().AsCString(), alloc_error.AsCString()); + err.SetErrorToGenericError(); + err.SetErrorStringWithFormat("Couldn't allocate a temporary region for %s: %s", m_variable_sp->GetName().AsCString(), alloc_error.AsCString()); return; } @@ -509,7 +518,8 @@ public: if (!write_error.Success()) { - err.SetErrorStringWithFormat("couldn't write to the temporary region for %s: %s", m_variable_sp->GetName().AsCString(), write_error.AsCString()); + err.SetErrorToGenericError(); + err.SetErrorStringWithFormat("Couldn't write to the temporary region for %s: %s", m_variable_sp->GetName().AsCString(), write_error.AsCString()); return; } @@ -519,7 +529,8 @@ public: if (!pointer_write_error.Success()) { - err.SetErrorStringWithFormat("couldn't write the address of the temporary region for %s: %s", m_variable_sp->GetName().AsCString(), pointer_write_error.AsCString()); + err.SetErrorToGenericError(); + err.SetErrorStringWithFormat("Couldn't write the address of the temporary region for %s: %s", m_variable_sp->GetName().AsCString(), pointer_write_error.AsCString()); } } } @@ -548,7 +559,8 @@ public: if (!valobj_sp) { - err.SetErrorStringWithFormat("couldn't get a value object for variable %s", m_variable_sp->GetName().AsCString()); + err.SetErrorToGenericError(); + err.SetErrorStringWithFormat("Couldn't get a value object for variable %s", m_variable_sp->GetName().AsCString()); return; } @@ -560,7 +572,8 @@ public: if (!extract_error.Success()) { - err.SetErrorStringWithFormat("couldn't get the data for variable %s", m_variable_sp->GetName().AsCString()); + err.SetErrorToGenericError(); + err.SetErrorStringWithFormat("Couldn't get the data for variable %s", m_variable_sp->GetName().AsCString()); return; } @@ -570,7 +583,8 @@ public: if (!set_error.Success()) { - err.SetErrorStringWithFormat("couldn't write the new contents of %s back into the variable", m_variable_sp->GetName().AsCString()); + err.SetErrorToGenericError(); + err.SetErrorStringWithFormat("Couldn't write the new contents of %s back into the variable", m_variable_sp->GetName().AsCString()); return; } @@ -580,7 +594,8 @@ public: if (!free_error.Success()) { - err.SetErrorStringWithFormat("couldn't free the temporary region for %s: %s", m_variable_sp->GetName().AsCString(), free_error.AsCString()); + err.SetErrorToGenericError(); + err.SetErrorStringWithFormat("Couldn't free the temporary region for %s: %s", m_variable_sp->GetName().AsCString(), free_error.AsCString()); return; } @@ -712,6 +727,7 @@ public: { if (m_temporary_allocation != LLDB_INVALID_ADDRESS) { + err.SetErrorToGenericError(); err.SetErrorString("Trying to create a temporary region for the result but one exists"); return; } @@ -727,7 +743,8 @@ public: if (!alloc_error.Success()) { - err.SetErrorStringWithFormat("couldn't allocate a temporary region for the result: %s", alloc_error.AsCString()); + err.SetErrorToGenericError(); + err.SetErrorStringWithFormat("Couldn't allocate a temporary region for the result: %s", alloc_error.AsCString()); return; } @@ -737,7 +754,8 @@ public: if (!pointer_write_error.Success()) { - err.SetErrorStringWithFormat("couldn't write the address of the temporary region for the result: %s", pointer_write_error.AsCString()); + err.SetErrorToGenericError(); + err.SetErrorStringWithFormat("Couldn't write the address of the temporary region for the result: %s", pointer_write_error.AsCString()); } } } @@ -745,6 +763,7 @@ public: void Dematerialize (lldb::StackFrameSP &frame_sp, IRMemoryMap &map, lldb::addr_t process_address, lldb::addr_t frame_top, lldb::addr_t frame_bottom, Error &err) { + err.SetErrorToGenericError(); err.SetErrorString("Tried to detmaterialize a result variable with the normal Dematerialize method"); } @@ -758,6 +777,7 @@ public: if (!exe_scope) { + err.SetErrorToGenericError(); err.SetErrorString("Couldn't dematerialize a result variable: invalid execution context scope"); return; } @@ -769,6 +789,7 @@ public: if (!read_error.Success()) { + err.SetErrorToGenericError(); err.SetErrorString("Couldn't dematerialize a result variable: couldn't read its address"); return; } @@ -777,6 +798,7 @@ public: if (!target_sp) { + err.SetErrorToGenericError(); err.SetErrorString("Couldn't dematerialize a result variable: no target"); return; } @@ -793,7 +815,8 @@ public: if (!ret) { - err.SetErrorStringWithFormat("couldn't dematerialize a result variable: failed to make persistent variable %s", name.AsCString()); + err.SetErrorToGenericError(); + err.SetErrorStringWithFormat("Couldn't dematerialize a result variable: failed to make persistent variable %s", name.AsCString()); return; } @@ -821,6 +844,7 @@ public: if (!read_error.Success()) { + err.SetErrorToGenericError(); err.SetErrorString("Couldn't dematerialize a result variable: couldn't read its memory"); return; } @@ -983,7 +1007,8 @@ public: if (!target_sp) { - err.SetErrorStringWithFormat("couldn't resolve symbol %s because there is no target", m_symbol.GetName().AsCString()); + err.SetErrorToGenericError(); + err.SetErrorStringWithFormat("Couldn't resolve symbol %s because there is no target", m_symbol.GetName().AsCString()); return; } @@ -998,7 +1023,8 @@ public: if (!pointer_write_error.Success()) { - err.SetErrorStringWithFormat("couldn't write the address of symbol %s: %s", m_symbol.GetName().AsCString(), pointer_write_error.AsCString()); + err.SetErrorToGenericError(); + err.SetErrorStringWithFormat("Couldn't write the address of symbol %s: %s", m_symbol.GetName().AsCString(), pointer_write_error.AsCString()); return; } } @@ -1094,7 +1120,8 @@ public: if (!frame_sp.get()) { - err.SetErrorStringWithFormat("couldn't materialize register %s without a stack frame", m_register_info.name); + err.SetErrorToGenericError(); + err.SetErrorStringWithFormat("Couldn't materialize register %s without a stack frame", m_register_info.name); return; } @@ -1102,7 +1129,8 @@ public: if (!reg_context_sp->ReadRegister(&m_register_info, reg_value)) { - err.SetErrorStringWithFormat("couldn't read the value of register %s", m_register_info.name); + err.SetErrorToGenericError(); + err.SetErrorStringWithFormat("Couldn't read the value of register %s", m_register_info.name); return; } @@ -1110,13 +1138,15 @@ public: if (!reg_value.GetData(register_data)) { - err.SetErrorStringWithFormat("couldn't get the data for register %s", m_register_info.name); + err.SetErrorToGenericError(); + err.SetErrorStringWithFormat("Couldn't get the data for register %s", m_register_info.name); return; } if (register_data.GetByteSize() != m_register_info.byte_size) { - err.SetErrorStringWithFormat("data for register %s had size %llu but we expected %llu", m_register_info.name, (unsigned long long)register_data.GetByteSize(), (unsigned long long)m_register_info.byte_size); + err.SetErrorToGenericError(); + err.SetErrorStringWithFormat("Data for register %s had size %llu but we expected %llu", m_register_info.name, (unsigned long long)register_data.GetByteSize(), (unsigned long long)m_register_info.byte_size); return; } @@ -1126,7 +1156,8 @@ public: if (!write_error.Success()) { - err.SetErrorStringWithFormat("couldn't write the contents of register %s: %s", m_register_info.name, write_error.AsCString()); + err.SetErrorToGenericError(); + err.SetErrorStringWithFormat("Couldn't write the contents of register %s: %s", m_register_info.name, write_error.AsCString()); return; } } @@ -1149,7 +1180,8 @@ public: if (!frame_sp.get()) { - err.SetErrorStringWithFormat("couldn't dematerialize register %s without a stack frame", m_register_info.name); + err.SetErrorToGenericError(); + err.SetErrorStringWithFormat("Couldn't dematerialize register %s without a stack frame", m_register_info.name); return; } @@ -1159,7 +1191,8 @@ public: if (!extract_error.Success()) { - err.SetErrorStringWithFormat("couldn't get the data for register %s: %s", m_register_info.name, extract_error.AsCString()); + err.SetErrorToGenericError(); + err.SetErrorStringWithFormat("Couldn't get the data for register %s: %s", m_register_info.name, extract_error.AsCString()); return; } @@ -1167,7 +1200,8 @@ public: if (!reg_context_sp->WriteRegister(&m_register_info, register_value)) { - err.SetErrorStringWithFormat("couldn't write the value of register %s", m_register_info.name); + err.SetErrorToGenericError(); + err.SetErrorStringWithFormat("Couldn't write the value of register %s", m_register_info.name); return; } } diff --git a/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp b/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp index fdd6186ae8de..109e429fc7f7 100644 --- a/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp +++ b/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp @@ -457,7 +457,7 @@ ObjectContainerBSDArchive::GetObjectFile (const FileSpec *file) module_sp->GetObjectModificationTime()); if (object) { - lldb::offset_t data_offset = object->ar_file_offset; + lldb::offset_t data_offset = m_offset + object->ar_file_offset; return ObjectFile::FindPlugin (module_sp, file, m_offset + object->ar_file_offset, diff --git a/lldb/source/Plugins/Process/Linux/ProcessLinux.h b/lldb/source/Plugins/Process/Linux/ProcessLinux.h index 7e8b593d6031..e65f1fac8b7c 100644 --- a/lldb/source/Plugins/Process/Linux/ProcessLinux.h +++ b/lldb/source/Plugins/Process/Linux/ProcessLinux.h @@ -75,15 +75,6 @@ public: EnablePluginLogging(lldb_private::Stream *strm, lldb_private::Args &command); - //------------------------------------------------------------------ - // Plug-in process overrides - //------------------------------------------------------------------ - virtual lldb_private::UnixSignals & - GetUnixSignals () - { - return m_linux_signals; - } - private: /// Linux-specific signal set. diff --git a/lldb/source/Plugins/Process/Linux/ProcessMonitor.cpp b/lldb/source/Plugins/Process/Linux/ProcessMonitor.cpp index f2577e262272..f7f7d8c6b733 100644 --- a/lldb/source/Plugins/Process/Linux/ProcessMonitor.cpp +++ b/lldb/source/Plugins/Process/Linux/ProcessMonitor.cpp @@ -1208,13 +1208,7 @@ ProcessMonitor::Launch(LaunchArgs *args) ptrace_opts |= PTRACE_O_TRACEEXIT; // Have the tracer trace threads which spawn in the inferior process. - // TODO: if we want to support tracing the inferiors' child, add the - // appropriate ptrace flags here (PTRACE_O_TRACEFORK, PTRACE_O_TRACEVFORK) - ptrace_opts |= PTRACE_O_TRACECLONE; - - // Have the tracer notify us before execve returns - // (needed to disable legacy SIGTRAP generation) - ptrace_opts |= PTRACE_O_TRACEEXEC; + ptrace_opts |= PTRACE_O_TRACEFORK | PTRACE_O_TRACEVFORK | PTRACE_O_TRACECLONE; if (PTRACE(PTRACE_SETOPTIONS, pid, NULL, (void*)ptrace_opts, 0) < 0) { @@ -1396,11 +1390,8 @@ ProcessMonitor::MonitorSIGTRAP(ProcessMonitor *monitor, assert(false && "Unexpected SIGTRAP code!"); break; - // TODO: these two cases are required if we want to support tracing - // of the inferiors' children - // case (SIGTRAP | (PTRACE_EVENT_FORK << 8)): - // case (SIGTRAP | (PTRACE_EVENT_VFORK << 8)): - + case (SIGTRAP | (PTRACE_EVENT_FORK << 8)): + case (SIGTRAP | (PTRACE_EVENT_VFORK << 8)): case (SIGTRAP | (PTRACE_EVENT_CLONE << 8)): { unsigned long tid = 0; @@ -1410,11 +1401,6 @@ ProcessMonitor::MonitorSIGTRAP(ProcessMonitor *monitor, break; } - case (SIGTRAP | (PTRACE_EVENT_EXEC << 8)): - // Don't follow the child by default and resume - monitor->Resume(pid, SIGCONT); - break; - case (SIGTRAP | (PTRACE_EVENT_EXIT << 8)): { // The inferior process is about to exit. Maintain the process in a diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp index 392d2c93c3d0..9dd1dd481453 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -7175,171 +7175,174 @@ SymbolFileDWARF::ParseVariableDIE } } - ValueType scope = eValueTypeInvalid; - - const DWARFDebugInfoEntry *sc_parent_die = GetParentSymbolContextDIE(die); - dw_tag_t parent_tag = sc_parent_die ? sc_parent_die->Tag() : 0; - SymbolContextScope * symbol_context_scope = NULL; - - // DWARF doesn't specify if a DW_TAG_variable is a local, global - // or static variable, so we have to do a little digging by - // looking at the location of a varaible to see if it contains - // a DW_OP_addr opcode _somewhere_ in the definition. I say - // somewhere because clang likes to combine small global variables - // into the same symbol and have locations like: - // DW_OP_addr(0x1000), DW_OP_constu(2), DW_OP_plus - // So if we don't have a DW_TAG_formal_parameter, we can look at - // the location to see if it contains a DW_OP_addr opcode, and - // then we can correctly classify our variables. - if (tag == DW_TAG_formal_parameter) - scope = eValueTypeVariableArgument; - else + if (location.IsValid()) { - bool op_error = false; - // Check if the location has a DW_OP_addr with any address value... - lldb::addr_t location_DW_OP_addr = LLDB_INVALID_ADDRESS; - if (!location_is_const_value_data) + ValueType scope = eValueTypeInvalid; + + const DWARFDebugInfoEntry *sc_parent_die = GetParentSymbolContextDIE(die); + dw_tag_t parent_tag = sc_parent_die ? sc_parent_die->Tag() : 0; + SymbolContextScope * symbol_context_scope = NULL; + + // DWARF doesn't specify if a DW_TAG_variable is a local, global + // or static variable, so we have to do a little digging by + // looking at the location of a varaible to see if it contains + // a DW_OP_addr opcode _somewhere_ in the definition. I say + // somewhere because clang likes to combine small global variables + // into the same symbol and have locations like: + // DW_OP_addr(0x1000), DW_OP_constu(2), DW_OP_plus + // So if we don't have a DW_TAG_formal_parameter, we can look at + // the location to see if it contains a DW_OP_addr opcode, and + // then we can correctly classify our variables. + if (tag == DW_TAG_formal_parameter) + scope = eValueTypeVariableArgument; + else { - location_DW_OP_addr = location.GetLocation_DW_OP_addr (0, op_error); - if (op_error) + bool op_error = false; + // Check if the location has a DW_OP_addr with any address value... + lldb::addr_t location_DW_OP_addr = LLDB_INVALID_ADDRESS; + if (!location_is_const_value_data) { - StreamString strm; - location.DumpLocationForAddress (&strm, eDescriptionLevelFull, 0, 0, NULL); - GetObjectFile()->GetModule()->ReportError ("0x%8.8x: %s has an invalid location: %s", die->GetOffset(), DW_TAG_value_to_name(die->Tag()), strm.GetString().c_str()); + location_DW_OP_addr = location.GetLocation_DW_OP_addr (0, op_error); + if (op_error) + { + StreamString strm; + location.DumpLocationForAddress (&strm, eDescriptionLevelFull, 0, 0, NULL); + GetObjectFile()->GetModule()->ReportError ("0x%8.8x: %s has an invalid location: %s", die->GetOffset(), DW_TAG_value_to_name(die->Tag()), strm.GetString().c_str()); + } } - } - if (location_DW_OP_addr != LLDB_INVALID_ADDRESS) - { - if (is_external) - scope = eValueTypeVariableGlobal; - else - scope = eValueTypeVariableStatic; - - - SymbolFileDWARFDebugMap *debug_map_symfile = GetDebugMapSymfile (); - - if (debug_map_symfile) + if (location_DW_OP_addr != LLDB_INVALID_ADDRESS) { - // When leaving the DWARF in the .o files on darwin, - // when we have a global variable that wasn't initialized, - // the .o file might not have allocated a virtual - // address for the global variable. In this case it will - // have created a symbol for the global variable - // that is undefined/data and external and the value will - // be the byte size of the variable. When we do the - // address map in SymbolFileDWARFDebugMap we rely on - // having an address, we need to do some magic here - // so we can get the correct address for our global - // variable. The address for all of these entries - // will be zero, and there will be an undefined symbol - // in this object file, and the executable will have - // a matching symbol with a good address. So here we - // dig up the correct address and replace it in the - // location for the variable, and set the variable's - // symbol context scope to be that of the main executable - // so the file address will resolve correctly. - bool linked_oso_file_addr = false; - if (is_external && location_DW_OP_addr == 0) + if (is_external) + scope = eValueTypeVariableGlobal; + else + scope = eValueTypeVariableStatic; + + + SymbolFileDWARFDebugMap *debug_map_symfile = GetDebugMapSymfile (); + + if (debug_map_symfile) { - - // we have a possible uninitialized extern global - ConstString const_name(mangled ? mangled : name); - ObjectFile *debug_map_objfile = debug_map_symfile->GetObjectFile(); - if (debug_map_objfile) + // When leaving the DWARF in the .o files on darwin, + // when we have a global variable that wasn't initialized, + // the .o file might not have allocated a virtual + // address for the global variable. In this case it will + // have created a symbol for the global variable + // that is undefined/data and external and the value will + // be the byte size of the variable. When we do the + // address map in SymbolFileDWARFDebugMap we rely on + // having an address, we need to do some magic here + // so we can get the correct address for our global + // variable. The address for all of these entries + // will be zero, and there will be an undefined symbol + // in this object file, and the executable will have + // a matching symbol with a good address. So here we + // dig up the correct address and replace it in the + // location for the variable, and set the variable's + // symbol context scope to be that of the main executable + // so the file address will resolve correctly. + bool linked_oso_file_addr = false; + if (is_external && location_DW_OP_addr == 0) { - Symtab *debug_map_symtab = debug_map_objfile->GetSymtab(); - if (debug_map_symtab) + + // we have a possible uninitialized extern global + ConstString const_name(mangled ? mangled : name); + ObjectFile *debug_map_objfile = debug_map_symfile->GetObjectFile(); + if (debug_map_objfile) { - Symbol *exe_symbol = debug_map_symtab->FindFirstSymbolWithNameAndType (const_name, - eSymbolTypeData, - Symtab::eDebugYes, - Symtab::eVisibilityExtern); - if (exe_symbol) + Symtab *debug_map_symtab = debug_map_objfile->GetSymtab(); + if (debug_map_symtab) { - if (exe_symbol->ValueIsAddress()) + Symbol *exe_symbol = debug_map_symtab->FindFirstSymbolWithNameAndType (const_name, + eSymbolTypeData, + Symtab::eDebugYes, + Symtab::eVisibilityExtern); + if (exe_symbol) { - const addr_t exe_file_addr = exe_symbol->GetAddress().GetFileAddress(); - if (exe_file_addr != LLDB_INVALID_ADDRESS) + if (exe_symbol->ValueIsAddress()) { - if (location.Update_DW_OP_addr (exe_file_addr)) + const addr_t exe_file_addr = exe_symbol->GetAddress().GetFileAddress(); + if (exe_file_addr != LLDB_INVALID_ADDRESS) { - linked_oso_file_addr = true; - symbol_context_scope = exe_symbol; + if (location.Update_DW_OP_addr (exe_file_addr)) + { + linked_oso_file_addr = true; + symbol_context_scope = exe_symbol; + } } } } } } } - } - if (!linked_oso_file_addr) - { - // The DW_OP_addr is not zero, but it contains a .o file address which - // needs to be linked up correctly. - const lldb::addr_t exe_file_addr = debug_map_symfile->LinkOSOFileAddress(this, location_DW_OP_addr); - if (exe_file_addr != LLDB_INVALID_ADDRESS) + if (!linked_oso_file_addr) { - // Update the file address for this variable - location.Update_DW_OP_addr (exe_file_addr); - } - else - { - // Variable didn't make it into the final executable - return var_sp; + // The DW_OP_addr is not zero, but it contains a .o file address which + // needs to be linked up correctly. + const lldb::addr_t exe_file_addr = debug_map_symfile->LinkOSOFileAddress(this, location_DW_OP_addr); + if (exe_file_addr != LLDB_INVALID_ADDRESS) + { + // Update the file address for this variable + location.Update_DW_OP_addr (exe_file_addr); + } + else + { + // Variable didn't make it into the final executable + return var_sp; + } } } } + else + { + scope = eValueTypeVariableLocal; + } } - else - { - scope = eValueTypeVariableLocal; - } - } - if (symbol_context_scope == NULL) - { - switch (parent_tag) + if (symbol_context_scope == NULL) { - case DW_TAG_subprogram: - case DW_TAG_inlined_subroutine: - case DW_TAG_lexical_block: - if (sc.function) + switch (parent_tag) { - symbol_context_scope = sc.function->GetBlock(true).FindBlockByID(MakeUserID(sc_parent_die->GetOffset())); - if (symbol_context_scope == NULL) - symbol_context_scope = sc.function; + case DW_TAG_subprogram: + case DW_TAG_inlined_subroutine: + case DW_TAG_lexical_block: + if (sc.function) + { + symbol_context_scope = sc.function->GetBlock(true).FindBlockByID(MakeUserID(sc_parent_die->GetOffset())); + if (symbol_context_scope == NULL) + symbol_context_scope = sc.function; + } + break; + + default: + symbol_context_scope = sc.comp_unit; + break; } - break; - - default: - symbol_context_scope = sc.comp_unit; - break; } - } - if (symbol_context_scope) - { - var_sp.reset (new Variable (MakeUserID(die->GetOffset()), - name, - mangled, - SymbolFileTypeSP (new SymbolFileType(*this, type_uid)), - scope, - symbol_context_scope, - &decl, - location, - is_external, - is_artificial)); - - var_sp->SetLocationIsConstantValueData (location_is_const_value_data); - } - else - { - // Not ready to parse this variable yet. It might be a global - // or static variable that is in a function scope and the function - // in the symbol context wasn't filled in yet - return var_sp; + if (symbol_context_scope) + { + var_sp.reset (new Variable (MakeUserID(die->GetOffset()), + name, + mangled, + SymbolFileTypeSP (new SymbolFileType(*this, type_uid)), + scope, + symbol_context_scope, + &decl, + location, + is_external, + is_artificial)); + + var_sp->SetLocationIsConstantValueData (location_is_const_value_data); + } + else + { + // Not ready to parse this variable yet. It might be a global + // or static variable that is in a function scope and the function + // in the symbol context wasn't filled in yet + return var_sp; + } } } // Cache var_sp even if NULL (the variable was just a specification or diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp index 61f95f355cf3..3afe396f2231 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp @@ -54,8 +54,6 @@ SymbolFileDWARFDebugMap::CompileUnitInfo::GetFileRangeMap(SymbolFileDWARFDebugMa return file_range_map; ObjectFile *oso_objfile = oso_module->GetObjectFile(); - if (!oso_objfile) - return file_range_map; Log *log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_MAP)); if (log) diff --git a/lldb/source/Symbol/Variable.cpp b/lldb/source/Symbol/Variable.cpp index 8b827db59311..9b7f4c5e9b0c 100644 --- a/lldb/source/Symbol/Variable.cpp +++ b/lldb/source/Symbol/Variable.cpp @@ -416,8 +416,8 @@ Variable::GetValuesForVariableExpressionPath (const char *variable_expr_path, ValueObjectSP variable_valobj_sp(ValueObjectVariable::Create (scope, var_sp)); if (variable_valobj_sp) { - const char *variable_sub_expr_path = variable_expr_path + variable_name.size(); - if (*variable_sub_expr_path) + variable_expr_path += variable_name.size(); + if (*variable_expr_path) { const char* first_unparsed = NULL; ValueObject::ExpressionPathScanEndReason reason_to_stop; @@ -425,7 +425,7 @@ Variable::GetValuesForVariableExpressionPath (const char *variable_expr_path, ValueObject::GetValueForExpressionPathOptions options; ValueObject::ExpressionPathAftermath final_task_on_target; - valobj_sp = variable_valobj_sp->GetValueForExpressionPath (variable_sub_expr_path, + valobj_sp = variable_valobj_sp->GetValueForExpressionPath (variable_expr_path, &first_unparsed, &reason_to_stop, &final_value_type, @@ -434,7 +434,7 @@ Variable::GetValuesForVariableExpressionPath (const char *variable_expr_path, if (!valobj_sp) { error.SetErrorStringWithFormat ("invalid expression path '%s' for variable '%s'", - variable_sub_expr_path, + variable_expr_path, var_sp->GetName().GetCString()); } } |