This is an archive of the discontinued LLVM Phabricator instance.

Keep original source path and mapped path in LineEntry
ClosedPublic

Authored by ted on May 10 2016, 2:20 PM.

Details

Summary

The "file" variable in a LineEntry was mapped using target.source-map, except when stepping through inlined code. This patch adds a new variable to LineEntry, "original_file", that contains the original file from the debug info. "file" will continue to (possibly) be mapped.

Some code has been changed to use "original_file". This is code dealing with symbols. Code dealing with source files will still use "file". Reviewers, please confirm that these particular changes are correct.

Tests run on Ubuntu 12.04 show no regression.

Diff Detail

Event Timeline

ted updated this revision to Diff 56818.May 10 2016, 2:20 PM
ted retitled this revision from to Keep original source path and mapped path in LineEntry.
ted updated this object.
ted added reviewers: jingham, clayborg.
ted added a subscriber: lldb-commits.
jingham requested changes to this revision.May 10 2016, 2:47 PM
jingham edited edge metadata.

This approach seems right to me.

See the inline comment for BreakpointResolver.

In ThreadPlanStepOverRange at line 235 this instance should also be changed to original_file:

if (sc.line_entry.file != m_addr_context.line_entry.file

Also, there are a couple of places where we test equality of the files in line_entries:

the "struct SourceInfo" operators in CommandObjectSource
LineEntry::GetSameLineContiguousAddressRange () const

I am pretty sure both of those should test original_file, so they don't depend on when/if the line_entries tested got re-mapped.

source/Breakpoint/BreakpointResolver.cpp
89–96

In this case, we probably want to try both. This code is where we set file & line breakpoints. If we're showing the re-mapped file in source listings or anything like that, we should allow people to use it to set breakpoints. But I wouldn't want setting breakpoints by the debug info name to fail as well.

This revision now requires changes to proceed.May 10 2016, 2:47 PM
ted updated this revision to Diff 56967.May 11 2016, 2:44 PM
ted edited edge metadata.
ted marked an inline comment as done.

Addressed Jim's comments.

Make BreakpointResolver check both original and mapped files.
Changed ThreadPlanStepOverRange line 235 to use original_file.
Changed "struct SourceInfo" operators in CommandobjectSource to use original file.
Changed LineEntry::GetSameLineContiguousAddressRagne to use original file.

jingham accepted this revision.May 11 2016, 3:05 PM
jingham edited edge metadata.

Looks good to me.

This revision is now accepted and ready to land.May 11 2016, 3:05 PM
ted closed this revision.May 11 2016, 3:52 PM