diff options
Diffstat (limited to 'lldb/source/Breakpoint')
| -rw-r--r-- | lldb/source/Breakpoint/Breakpoint.cpp | 3 | ||||
| -rw-r--r-- | lldb/source/Breakpoint/BreakpointList.cpp | 18 | ||||
| -rw-r--r-- | lldb/source/Breakpoint/BreakpointLocation.cpp | 4 | ||||
| -rw-r--r-- | lldb/source/Breakpoint/BreakpointOptions.cpp | 37 | ||||
| -rw-r--r-- | lldb/source/Breakpoint/BreakpointResolverFileRegex.cpp | 2 | ||||
| -rw-r--r-- | lldb/source/Breakpoint/WatchpointOptions.cpp | 28 |
6 files changed, 48 insertions, 44 deletions
diff --git a/lldb/source/Breakpoint/Breakpoint.cpp b/lldb/source/Breakpoint/Breakpoint.cpp index a112542803c4..13acf4bb92e2 100644 --- a/lldb/source/Breakpoint/Breakpoint.cpp +++ b/lldb/source/Breakpoint/Breakpoint.cpp @@ -638,7 +638,8 @@ static bool SymbolContextsMightBeEquivalent(SymbolContext &old_sc, } else { // Otherwise we will compare by name... if (old_sc.comp_unit && new_sc.comp_unit) { - if (FileSpec::Equal(*old_sc.comp_unit, *new_sc.comp_unit, true)) { + if (old_sc.comp_unit->GetPrimaryFile() == + new_sc.comp_unit->GetPrimaryFile()) { // Now check the functions: if (old_sc.function && new_sc.function && (old_sc.function->GetName() == new_sc.function->GetName())) { diff --git a/lldb/source/Breakpoint/BreakpointList.cpp b/lldb/source/Breakpoint/BreakpointList.cpp index c80fb917b490..5b23c633d14c 100644 --- a/lldb/source/Breakpoint/BreakpointList.cpp +++ b/lldb/source/Breakpoint/BreakpointList.cpp @@ -10,6 +10,8 @@ #include "lldb/Target/Target.h" +#include "llvm/Support/Errc.h" + using namespace lldb; using namespace lldb_private; @@ -128,22 +130,24 @@ BreakpointSP BreakpointList::FindBreakpointByID(break_id_t break_id) const { return {}; } -bool BreakpointList::FindBreakpointsByName(const char *name, - BreakpointList &matching_bps) { - Status error; +llvm::Expected<std::vector<lldb::BreakpointSP>> +BreakpointList::FindBreakpointsByName(const char *name) { if (!name) - return false; + return llvm::createStringError(llvm::errc::invalid_argument, + "FindBreakpointsByName requires a name"); + Status error; if (!BreakpointID::StringIsBreakpointName(llvm::StringRef(name), error)) - return false; + return error.ToError(); + std::vector<lldb::BreakpointSP> matching_bps; for (BreakpointSP bkpt_sp : Breakpoints()) { if (bkpt_sp->MatchesName(name)) { - matching_bps.Add(bkpt_sp, false); + matching_bps.push_back(bkpt_sp); } } - return true; + return matching_bps; } void BreakpointList::Dump(Stream *s) const { diff --git a/lldb/source/Breakpoint/BreakpointLocation.cpp b/lldb/source/Breakpoint/BreakpointLocation.cpp index 46b8f25c5668..7f08b08c6055 100644 --- a/lldb/source/Breakpoint/BreakpointLocation.cpp +++ b/lldb/source/Breakpoint/BreakpointLocation.cpp @@ -519,13 +519,13 @@ void BreakpointLocation::GetDescription(Stream *s, if (sc.module_sp) { s->EOL(); s->Indent("module = "); - sc.module_sp->GetFileSpec().Dump(s); + sc.module_sp->GetFileSpec().Dump(s->AsRawOstream()); } if (sc.comp_unit != nullptr) { s->EOL(); s->Indent("compile unit = "); - static_cast<FileSpec *>(sc.comp_unit)->GetFilename().Dump(s); + sc.comp_unit->GetPrimaryFile().GetFilename().Dump(s); if (sc.function != nullptr) { s->EOL(); diff --git a/lldb/source/Breakpoint/BreakpointOptions.cpp b/lldb/source/Breakpoint/BreakpointOptions.cpp index 0d4c6173c3c5..8fd16f420c04 100644 --- a/lldb/source/Breakpoint/BreakpointOptions.cpp +++ b/lldb/source/Breakpoint/BreakpointOptions.cpp @@ -566,7 +566,8 @@ void BreakpointOptions::GetDescription(Stream *s, if (m_callback_baton_sp.get()) { if (level != eDescriptionLevelBrief) { s->EOL(); - m_callback_baton_sp->GetDescription(s, level); + m_callback_baton_sp->GetDescription(s->AsRawOstream(), level, + s->GetIndentLevel()); } } if (!m_condition_text.empty()) { @@ -578,35 +579,33 @@ void BreakpointOptions::GetDescription(Stream *s, } void BreakpointOptions::CommandBaton::GetDescription( - Stream *s, lldb::DescriptionLevel level) const { + llvm::raw_ostream &s, lldb::DescriptionLevel level, + unsigned indentation) const { const CommandData *data = getItem(); if (level == eDescriptionLevelBrief) { - s->Printf(", commands = %s", - (data && data->user_source.GetSize() > 0) ? "yes" : "no"); + s << ", commands = " + << ((data && data->user_source.GetSize() > 0) ? "yes" : "no"); return; } - s->IndentMore(); - s->Indent("Breakpoint commands"); + indentation += 2; + s.indent(indentation); + s << "Breakpoint commands"; if (data->interpreter != eScriptLanguageNone) - s->Printf(" (%s):\n", - ScriptInterpreter::LanguageToString(data->interpreter).c_str()); + s << llvm::formatv(" ({0}):\n", + ScriptInterpreter::LanguageToString(data->interpreter)); else - s->PutCString(":\n"); + s << ":\n"; - s->IndentMore(); + indentation += 2; if (data && data->user_source.GetSize() > 0) { - const size_t num_strings = data->user_source.GetSize(); - for (size_t i = 0; i < num_strings; ++i) { - s->Indent(data->user_source.GetStringAtIndex(i)); - s->EOL(); + for (llvm::StringRef str : data->user_source) { + s.indent(indentation); + s << str << "\n"; } - } else { - s->PutCString("No commands.\n"); - } - s->IndentLess(); - s->IndentLess(); + } else + s << "No commands.\n"; } void BreakpointOptions::SetCommandDataCallback( diff --git a/lldb/source/Breakpoint/BreakpointResolverFileRegex.cpp b/lldb/source/Breakpoint/BreakpointResolverFileRegex.cpp index 3cb04263c6dc..6b600a7cf128 100644 --- a/lldb/source/Breakpoint/BreakpointResolverFileRegex.cpp +++ b/lldb/source/Breakpoint/BreakpointResolverFileRegex.cpp @@ -102,7 +102,7 @@ Searcher::CallbackReturn BreakpointResolverFileRegex::SearchCallback( return eCallbackReturnContinue; CompileUnit *cu = context.comp_unit; - FileSpec cu_file_spec = *(static_cast<FileSpec *>(cu)); + FileSpec cu_file_spec = cu->GetPrimaryFile(); std::vector<uint32_t> line_matches; context.target_sp->GetSourceManager().FindLinesMatchingRegex( cu_file_spec, m_regex, 1, UINT32_MAX, line_matches); diff --git a/lldb/source/Breakpoint/WatchpointOptions.cpp b/lldb/source/Breakpoint/WatchpointOptions.cpp index cd5ef930e5dc..026bf2f746ae 100644 --- a/lldb/source/Breakpoint/WatchpointOptions.cpp +++ b/lldb/source/Breakpoint/WatchpointOptions.cpp @@ -121,7 +121,8 @@ void WatchpointOptions::GetCallbackDescription( Stream *s, lldb::DescriptionLevel level) const { if (m_callback_baton_sp.get()) { s->EOL(); - m_callback_baton_sp->GetDescription(s, level); + m_callback_baton_sp->GetDescription(s->AsRawOstream(), level, + s->GetIndentLevel()); } } @@ -156,27 +157,26 @@ void WatchpointOptions::GetDescription(Stream *s, } void WatchpointOptions::CommandBaton::GetDescription( - Stream *s, lldb::DescriptionLevel level) const { + llvm::raw_ostream &s, lldb::DescriptionLevel level, + unsigned indentation) const { const CommandData *data = getItem(); if (level == eDescriptionLevelBrief) { - s->Printf(", commands = %s", - (data && data->user_source.GetSize() > 0) ? "yes" : "no"); + s << ", commands = %s" + << ((data && data->user_source.GetSize() > 0) ? "yes" : "no"); return; } - s->IndentMore(); - s->Indent("watchpoint commands:\n"); + indentation += 2; + s.indent(indentation); + s << "watchpoint commands:\n"; - s->IndentMore(); + indentation += 2; if (data && data->user_source.GetSize() > 0) { for (const std::string &line : data->user_source) { - s->Indent(line); - s->EOL(); + s.indent(indentation); + s << line << "\n"; } - } else { - s->PutCString("No commands.\n"); - } - s->IndentLess(); - s->IndentLess(); + } else + s << "No commands.\n"; } |
