diff options
Diffstat (limited to 'lldb/source/Core')
-rw-r--r-- | lldb/source/Core/Address.cpp | 8 | ||||
-rw-r--r-- | lldb/source/Core/Debugger.cpp | 8 | ||||
-rw-r--r-- | lldb/source/Core/InputReader.cpp | 2 | ||||
-rw-r--r-- | lldb/source/Core/SearchFilter.cpp | 34 | ||||
-rw-r--r-- | lldb/source/Core/UserSettingsController.cpp | 113 | ||||
-rw-r--r-- | lldb/source/Core/ValueObject.cpp | 20 |
6 files changed, 80 insertions, 105 deletions
diff --git a/lldb/source/Core/Address.cpp b/lldb/source/Core/Address.cpp index 0308812bc56..d9ff36ecd40 100644 --- a/lldb/source/Core/Address.cpp +++ b/lldb/source/Core/Address.cpp @@ -431,14 +431,6 @@ Address::Dump (Stream *s, ExecutionContextScope *exe_scope, DumpStyle style, Dum case DumpStyleResolvedDescriptionNoModule: if (IsSectionOffset()) { - AddressType addr_type = eAddressTypeLoad; - addr_t addr = GetLoadAddress (target); - if (addr == LLDB_INVALID_ADDRESS) - { - addr = GetFileAddress(); - addr_type = eAddressTypeFile; - } - uint32_t pointer_size = 4; ModuleSP module_sp (GetModule()); if (target) diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp index 3e3b0cb1aea..9cefaa30f14 100644 --- a/lldb/source/Core/Debugger.cpp +++ b/lldb/source/Core/Debugger.cpp @@ -1336,10 +1336,10 @@ Debugger::FormatPrompt } else if (is_pointer) // if pointer, value is the address stored { - var_success = target->DumpPrintableRepresentation(s, - val_obj_display, - custom_format, - ValueObject::ePrintableRepresentationSpecialCasesDisable); + target->DumpPrintableRepresentation (s, + val_obj_display, + custom_format, + ValueObject::ePrintableRepresentationSpecialCasesDisable); } else { diff --git a/lldb/source/Core/InputReader.cpp b/lldb/source/Core/InputReader.cpp index c9372e432bc..10847bdd61f 100644 --- a/lldb/source/Core/InputReader.cpp +++ b/lldb/source/Core/InputReader.cpp @@ -151,7 +151,7 @@ InputReader::HandleRawBytes (const char *bytes, size_t bytes_len) { if (end_token && end_token == p) { - p += m_end_token.size(); + m_end_token.size(); SetIsDone(true); break; } diff --git a/lldb/source/Core/SearchFilter.cpp b/lldb/source/Core/SearchFilter.cpp index f00f222bc30..9256899f196 100644 --- a/lldb/source/Core/SearchFilter.cpp +++ b/lldb/source/Core/SearchFilter.cpp @@ -186,11 +186,21 @@ SearchFilter::DoModuleIteration (const lldb::ModuleSP& module_sp, Searcher &sear Searcher::CallbackReturn SearchFilter::DoModuleIteration (const SymbolContext &context, Searcher &searcher) { - Searcher::CallbackReturn shouldContinue; - if (searcher.GetDepth () >= Searcher::eDepthModule) { - if (!context.module_sp) + if (context.module_sp) + { + if (searcher.GetDepth () == Searcher::eDepthModule) + { + SymbolContext matchingContext(context.module_sp.get()); + searcher.SearchCallback (*this, matchingContext, NULL, false); + } + else + { + return DoCUIteration(context.module_sp, context, searcher); + } + } + else { ModuleList &target_images = m_target_sp->GetImages(); Mutex::Locker modules_locker(target_images.GetMutex()); @@ -208,14 +218,14 @@ SearchFilter::DoModuleIteration (const SymbolContext &context, Searcher &searche { SymbolContext matchingContext(m_target_sp, module_sp); - shouldContinue = searcher.SearchCallback (*this, matchingContext, NULL, false); + Searcher::CallbackReturn shouldContinue = searcher.SearchCallback (*this, matchingContext, NULL, false); if (shouldContinue == Searcher::eCallbackReturnStop || shouldContinue == Searcher::eCallbackReturnPop) return shouldContinue; } else { - shouldContinue = DoCUIteration(module_sp, context, searcher); + Searcher::CallbackReturn shouldContinue = DoCUIteration(module_sp, context, searcher); if (shouldContinue == Searcher::eCallbackReturnStop) return shouldContinue; else if (shouldContinue == Searcher::eCallbackReturnPop) @@ -223,20 +233,6 @@ SearchFilter::DoModuleIteration (const SymbolContext &context, Searcher &searche } } } - else - { - if (searcher.GetDepth () == Searcher::eDepthModule) - { - SymbolContext matchingContext(context.module_sp.get()); - - shouldContinue = searcher.SearchCallback (*this, matchingContext, NULL, false); - } - else - { - return DoCUIteration(context.module_sp, context, searcher); - } - } - } return Searcher::eCallbackReturnContinue; } diff --git a/lldb/source/Core/UserSettingsController.cpp b/lldb/source/Core/UserSettingsController.cpp index 96d1f19c70b..2a5b7e9327e 100644 --- a/lldb/source/Core/UserSettingsController.cpp +++ b/lldb/source/Core/UserSettingsController.cpp @@ -173,16 +173,13 @@ UserSettingsController::RegisterChild (const UserSettingsControllerSP &child) // Verify child is not already in m_children. size_t num_children = m_children.size(); - bool found = false; for (size_t i = 0; i < num_children; ++i) - { - if (m_children[i].get() == child.get()) - found = true; - } - + { + if (m_children[i].get() == child.get()) + return; + } // Add child to m_children. - if (! found) - m_children.push_back (child); + m_children.push_back (child); } const ConstString & @@ -494,14 +491,12 @@ UserSettingsController::SetVariable (const char *full_dot_name, UserSettingsControllerSP child; ConstString child_prefix (names.GetArgumentAtIndex (0)); int num_children = GetNumChildren(); - bool found = false; - for (int i = 0; i < num_children && !found; ++i) + for (int i = 0; i < num_children; ++i) { child = GetChildAtIndex (i); ConstString current_prefix = child->GetLevelName(); if (current_prefix == child_prefix) { - found = true; std::string new_name; for (int j = 0; j < names.GetArgumentCount(); ++j) { @@ -513,12 +508,9 @@ UserSettingsController::SetVariable (const char *full_dot_name, index_value); } } - if (!found) - { - err.SetErrorStringWithFormat ("unable to find variable '%s', cannot assign value", - full_dot_name); - return err; - } + err.SetErrorStringWithFormat ("unable to find variable '%s', cannot assign value", + full_dot_name); + return err; } } } @@ -576,12 +568,10 @@ UserSettingsController::GetVariable if (names.GetArgumentCount() > 1) { ConstString child_prefix (names.GetArgumentAtIndex (0)); - bool found = false; - for (int i = 0; i < m_children.size() && !found; ++i) + for (int i = 0; i < m_children.size(); ++i) { if (child_prefix == m_children[i]->GetLevelName()) { - found = true; child = m_children[i]; std::string new_name; for (int j = 0; j < names.GetArgumentCount(); ++j) @@ -594,60 +584,57 @@ UserSettingsController::GetVariable } } - if (!found) + // Cannot be handled by a child, because name did not match any child prefixes. + // Cannot be a class-wide variable because there are too many name pieces. + + if (instance_entry != NULL) { - // Cannot be handled by a child, because name did not match any child prefixes. - // Cannot be a class-wide variable because there are too many name pieces. + var_type = instance_entry->var_type; + ConstString instance_name (names.GetArgumentAtIndex (0)); + InstanceSettings *current_settings = FindSettingsForInstance (instance_name); - if (instance_entry != NULL) + if (current_settings != NULL) { - var_type = instance_entry->var_type; - ConstString instance_name (names.GetArgumentAtIndex (0)); - InstanceSettings *current_settings = FindSettingsForInstance (instance_name); + current_settings->GetInstanceSettingsValue (*instance_entry, const_var_name, value, &err); + } + else + { + // Look for instance name setting in pending settings. - if (current_settings != NULL) + std::string inst_name_str = instance_name.GetCString(); + std::map<std::string, InstanceSettingsSP>::iterator pos; + + pos = m_pending_settings.find (inst_name_str); + if (pos != m_pending_settings.end()) { - current_settings->GetInstanceSettingsValue (*instance_entry, const_var_name, value, &err); + InstanceSettingsSP settings_sp = pos->second; + settings_sp->GetInstanceSettingsValue (*instance_entry, const_var_name, value, &err); } - else + else { - // Look for instance name setting in pending settings. - - std::string inst_name_str = instance_name.GetCString(); - std::map<std::string, InstanceSettingsSP>::iterator pos; - - pos = m_pending_settings.find (inst_name_str); - if (pos != m_pending_settings.end()) + if (m_settings.level_name.GetLength() > 0) { - InstanceSettingsSP settings_sp = pos->second; - settings_sp->GetInstanceSettingsValue (*instance_entry, const_var_name, value, &err); + // No valid instance name; assume they want the default settings. + m_default_settings->GetInstanceSettingsValue (*instance_entry, const_var_name, value, &err); } - else + else { - if (m_settings.level_name.GetLength() > 0) - { - // No valid instance name; assume they want the default settings. - m_default_settings->GetInstanceSettingsValue (*instance_entry, const_var_name, value, &err); - } + // We're at the Debugger level; use the debugger's instance settings. + StreamString tmp_name; + if (debugger_instance_name[0] != '[') + tmp_name.Printf ("[%s]", debugger_instance_name); else - { - // We're at the Debugger level; use the debugger's instance settings. - StreamString tmp_name; - if (debugger_instance_name[0] != '[') - tmp_name.Printf ("[%s]", debugger_instance_name); - else - tmp_name.Printf ("%s", debugger_instance_name); - ConstString dbg_name (debugger_instance_name); - InstanceSettings *dbg_settings = FindSettingsForInstance (dbg_name); - if (dbg_settings) - dbg_settings->GetInstanceSettingsValue (*instance_entry, const_var_name, value, &err); - } + tmp_name.Printf ("%s", debugger_instance_name); + ConstString dbg_name (debugger_instance_name); + InstanceSettings *dbg_settings = FindSettingsForInstance (dbg_name); + if (dbg_settings) + dbg_settings->GetInstanceSettingsValue (*instance_entry, const_var_name, value, &err); } } } - else - err.SetErrorString ("invalid variable name"); } + else + err.SetErrorString ("invalid variable name"); } else { @@ -1194,14 +1181,11 @@ UserSettingsController::FindSettingsDescriptions (CommandInterpreter &interprete else if (num_pieces == 1) { ConstString var_name (names.GetArgumentAtIndex (0)); - bool is_global = false; const SettingEntry *setting_entry = usc_sp->GetGlobalEntry (var_name); if (setting_entry == NULL) setting_entry = usc_sp->GetInstanceEntry (var_name); - else - is_global = true; // Check to see if it is a global or instance variable name. if (setting_entry != NULL) @@ -1773,21 +1757,18 @@ UserSettingsController::CompleteSettingsNames (const UserSettingsControllerSP& u else { // 'next_name' must be a child name. Find the correct child and pass the remaining piece to be resolved. - bool found = false; int num_children = my_usc_sp->GetNumChildren(); ConstString child_level (next_name.c_str()); for (int i = 0; i < num_children; ++i) { if (my_usc_sp->GetChildAtIndex (i)->GetLevelName() == child_level) { - found = true; return UserSettingsController::CompleteSettingsNames (my_usc_sp->GetChildAtIndex (i), partial_setting_name_pieces, word_complete, matches); } } - if (!found) - return 0; + return 0; } } else if (num_name_pieces == 1) diff --git a/lldb/source/Core/ValueObject.cpp b/lldb/source/Core/ValueObject.cpp index b3c0a0b8c34..9fc3a0f7f8e 100644 --- a/lldb/source/Core/ValueObject.cpp +++ b/lldb/source/Core/ValueObject.cpp @@ -2344,8 +2344,10 @@ ValueObject::GetValuesForExpressionPath(const char* expression, ValueObjectSP final_value = ret_val->Dereference(error); if (error.Fail() || !final_value.get()) { - *reason_to_stop = ValueObject::eExpressionPathScanEndReasonDereferencingFailed; - *final_value_type = ValueObject::eExpressionPathEndResultTypeInvalid; + if (reason_to_stop) + *reason_to_stop = ValueObject::eExpressionPathScanEndReasonDereferencingFailed; + if (final_value_type) + *final_value_type = ValueObject::eExpressionPathEndResultTypeInvalid; return 0; } else @@ -2361,8 +2363,10 @@ ValueObject::GetValuesForExpressionPath(const char* expression, ValueObjectSP final_value = ret_val->AddressOf(error); if (error.Fail() || !final_value.get()) { - *reason_to_stop = ValueObject::eExpressionPathScanEndReasonTakingAddressFailed; - *final_value_type = ValueObject::eExpressionPathEndResultTypeInvalid; + if (reason_to_stop) + *reason_to_stop = ValueObject::eExpressionPathScanEndReasonTakingAddressFailed; + if (final_value_type) + *final_value_type = ValueObject::eExpressionPathEndResultTypeInvalid; return 0; } else @@ -3770,9 +3774,9 @@ ValueObject::EvaluationPoint::SyncWithProcessState() if (current_mod_id.GetStopID() == 0) return false; - bool changed; - - if (m_mod_id.IsValid()) + bool changed = false; + const bool was_valid = m_mod_id.IsValid(); + if (was_valid) { if (m_mod_id == current_mod_id) { @@ -3804,6 +3808,7 @@ ValueObject::EvaluationPoint::SyncWithProcessState() { // We used to have a frame, but now it is gone SetInvalid(); + changed = was_valid; } } } @@ -3811,6 +3816,7 @@ ValueObject::EvaluationPoint::SyncWithProcessState() { // We used to have a thread, but now it is gone SetInvalid(); + changed = was_valid; } } |