diff options
Diffstat (limited to 'source/Breakpoint/BreakpointResolverFileLine.cpp')
| -rw-r--r-- | source/Breakpoint/BreakpointResolverFileLine.cpp | 51 |
1 files changed, 33 insertions, 18 deletions
diff --git a/source/Breakpoint/BreakpointResolverFileLine.cpp b/source/Breakpoint/BreakpointResolverFileLine.cpp index ecef88eb9989..438f430bd2a5 100644 --- a/source/Breakpoint/BreakpointResolverFileLine.cpp +++ b/source/Breakpoint/BreakpointResolverFileLine.cpp @@ -9,10 +9,6 @@ #include "lldb/Breakpoint/BreakpointResolverFileLine.h" -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes #include "lldb/Breakpoint/BreakpointLocation.h" #include "lldb/Core/Module.h" #include "lldb/Symbol/CompileUnit.h" @@ -28,11 +24,12 @@ using namespace lldb_private; //---------------------------------------------------------------------- BreakpointResolverFileLine::BreakpointResolverFileLine( Breakpoint *bkpt, const FileSpec &file_spec, uint32_t line_no, - lldb::addr_t offset, bool check_inlines, bool skip_prologue, - bool exact_match) + uint32_t column, lldb::addr_t offset, bool check_inlines, + bool skip_prologue, bool exact_match) : BreakpointResolver(bkpt, BreakpointResolver::FileLineResolver, offset), - m_file_spec(file_spec), m_line_number(line_no), m_inlines(check_inlines), - m_skip_prologue(skip_prologue), m_exact_match(exact_match) {} + m_file_spec(file_spec), m_line_number(line_no), m_column(column), + m_inlines(check_inlines), m_skip_prologue(skip_prologue), + m_exact_match(exact_match) {} BreakpointResolverFileLine::~BreakpointResolverFileLine() {} @@ -41,6 +38,7 @@ BreakpointResolver *BreakpointResolverFileLine::CreateFromStructuredData( Status &error) { llvm::StringRef filename; uint32_t line_no; + uint32_t column; bool check_inlines; bool skip_prologue; bool exact_match; @@ -62,6 +60,13 @@ BreakpointResolver *BreakpointResolverFileLine::CreateFromStructuredData( return nullptr; } + success = + options_dict.GetValueForKeyAsInteger(GetKey(OptionNames::Column), column); + if (!success) { + // Backwards compatibility. + column = 0; + } + success = options_dict.GetValueForKeyAsBoolean(GetKey(OptionNames::Inlines), check_inlines); if (!success) { @@ -83,10 +88,10 @@ BreakpointResolver *BreakpointResolverFileLine::CreateFromStructuredData( return nullptr; } - FileSpec file_spec(filename, false); + FileSpec file_spec(filename); - return new BreakpointResolverFileLine(bkpt, file_spec, line_no, offset, - check_inlines, skip_prologue, + return new BreakpointResolverFileLine(bkpt, file_spec, line_no, column, + offset, check_inlines, skip_prologue, exact_match); } @@ -99,6 +104,8 @@ BreakpointResolverFileLine::SerializeToStructuredData() { m_file_spec.GetPath()); options_dict_sp->AddIntegerItem(GetKey(OptionNames::LineNumber), m_line_number); + options_dict_sp->AddIntegerItem(GetKey(OptionNames::Column), + m_column); options_dict_sp->AddBooleanItem(GetKey(OptionNames::Inlines), m_inlines); options_dict_sp->AddBooleanItem(GetKey(OptionNames::SkipPrologue), m_skip_prologue); @@ -181,8 +188,12 @@ void BreakpointResolverFileLine::FilterContexts(SymbolContextList &sc_list, // inline int foo2() { ... } // // but that's the best we can do for now. + // One complication, if the line number returned from GetStartLineSourceInfo + // is 0, then we can't do this calculation. That can happen if + // GetStartLineSourceInfo gets an error, or if the first line number in + // the function really is 0 - which happens for some languages. const int decl_line_is_too_late_fudge = 1; - if (m_line_number < line - decl_line_is_too_late_fudge) { + if (line && m_line_number < line - decl_line_is_too_late_fudge) { LLDB_LOG(log, "removing symbol context at {0}:{1}", file, line); sc_list.RemoveContextAtIndex(i); --i; @@ -236,18 +247,22 @@ BreakpointResolverFileLine::SearchCallback(SearchFilter &filter, s.Printf("for %s:%d ", m_file_spec.GetFilename().AsCString("<Unknown>"), m_line_number); - SetSCMatchesByLine(filter, sc_list, m_skip_prologue, s.GetString()); + SetSCMatchesByLine(filter, sc_list, m_skip_prologue, s.GetString(), + m_line_number, m_column); return Searcher::eCallbackReturnContinue; } -Searcher::Depth BreakpointResolverFileLine::GetDepth() { - return Searcher::eDepthModule; +lldb::SearchDepth BreakpointResolverFileLine::GetDepth() { + return lldb::eSearchDepthModule; } void BreakpointResolverFileLine::GetDescription(Stream *s) { - s->Printf("file = '%s', line = %u, exact_match = %d", - m_file_spec.GetPath().c_str(), m_line_number, m_exact_match); + s->Printf("file = '%s', line = %u, ", m_file_spec.GetPath().c_str(), + m_line_number); + if (m_column) + s->Printf("column = %u, ", m_column); + s->Printf("exact_match = %d", m_exact_match); } void BreakpointResolverFileLine::Dump(Stream *s) const {} @@ -255,7 +270,7 @@ void BreakpointResolverFileLine::Dump(Stream *s) const {} lldb::BreakpointResolverSP BreakpointResolverFileLine::CopyForBreakpoint(Breakpoint &breakpoint) { lldb::BreakpointResolverSP ret_sp(new BreakpointResolverFileLine( - &breakpoint, m_file_spec, m_line_number, m_offset, m_inlines, + &breakpoint, m_file_spec, m_line_number, m_column, m_offset, m_inlines, m_skip_prologue, m_exact_match)); return ret_sp; |
