[lldb-dev] Bug with ThreadPlanStepRange::InRange, symbol context and target.source-map setting

Jim Ingham via lldb-dev lldb-dev at lists.llvm.org
Fri May 6 12:40:54 PDT 2016

> On May 6, 2016, at 11:22 AM, Ted Woodward via lldb-dev <lldb-dev at lists.llvm.org> wrote:
> I’m stepping over the first line of a libcxx test (source https://llvm.org/svn/llvm-project/libcxx/trunk/test/std/thread/thread.condition/thread.condition.condvar/wait.pass.cpp ). The first line has an inlined function call. I expect lldb to step over the breakpoint, run to the end of the range that sets up the inlined function call, run through the inlined function call, then run to the end of the line. Instead, it runs to the inlined call, then stops.
> I’m running lldb on Windows, debugging a Hexagon application that was built on Linux. I’m using the target.source-map setting to let me see source.
> The problem is in ThreadPlanStepRange::InRange. It checks to see if we’re still on the same line by comparing the filename in the Stepping Plan’s line entry to the filename in the current frame’s line entry. m_addr_context.line_entry.file has been normalized by the value in target.source-map, but new_context.line_entry.file hasn’t, so they’re not the same, even though they should be.
>         SymbolContext new_context(frame->GetSymbolContext(eSymbolContextEverything));
>         if (m_addr_context.line_entry.IsValid() && new_context.line_entry.IsValid())
>         {
>             if (m_addr_context.line_entry.file == new_context.line_entry.file)
>             {
> Either both should use target.source-map, or neither should.  How do I run new_context.line_entry.file through the target.source-map normalization?

It doesn't seem right to me that when symbols are handed out they have the source map applied to their file spec's.  After all, then you could get into problems like: somebody started a step so we recorded m_addr_context.  Then their step was interrupted (say by hitting a breakpoint) and the user added a source mapping.  Then we stop in a frame from the same module, and now the SymbolContext that the step plan stored (m_addr_context) has a different path than the one in the frame when we get to it.  Checking every time you compared file specs seems very error prone, we shouldn't do it that way.  I guess if the FileSpec == handled this it would be odd but not too bad.  But that seems like it would result in a lot of unnecessary work.  I think it would be better to only do source map path conversion when sources are looked up, and maybe when paths are printed.  For symbols we should stick to what the debug info says.


> Ted
> --
> Qualcomm Innovation Center, Inc.
> The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
> _______________________________________________
> lldb-dev mailing list
> lldb-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev

More information about the lldb-dev mailing list