This is an archive of the discontinued LLVM Phabricator instance.

[lldb] Support simplified template names when looking up functions
ClosedPublic

Authored by aeubanks on Oct 31 2022, 11:20 AM.

Details

Summary

This makes setting breakpoints work with -gsimple-template-names.

Assume that callers handle false positives. For example, Module::LookupInfo::Prune removes wrong template instantiations when setting a breakpoint.

Diff Detail

Event Timeline

aeubanks created this revision.Oct 31 2022, 11:20 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 31 2022, 11:20 AM
Herald added a subscriber: arphaman. · View Herald Transcript
aeubanks requested review of this revision.Oct 31 2022, 11:20 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 31 2022, 11:20 AM

(I don't understand why this works yet, it should be giving us false positives?)

aeubanks edited the summary of this revision. (Show Details)Oct 31 2022, 12:42 PM
aeubanks added reviewers: dblaikie, Michael137, labath.

updated description with why this doesn't produce false positives with breakpoints

this doesn't support regex function name lookup, not sure if we care enough about the interaction between regexes/function names under simple template names. if we do, we could instead add template parameters to the names we put in the manual index. I did take a quick look at doing that but it'd require more work

updated description with why this doesn't produce false positives with breakpoints

this doesn't support regex function name lookup, not sure if we care enough about the interaction between regexes/function names under simple template names. if we do, we could instead add template parameters to the names we put in the manual index. I did take a quick look at doing that but it'd require more work

Presumably that'd then lead to divergence between manual and automatic index - which would be bad. So if this behavior is the same between automatic and manual index with simplified template names, that's probably good.

labath added a comment.Nov 2 2022, 6:42 AM

Why is it that the other indexes don't need an equivalent fix? Could it be that you just haven't tried those code paths?

If they do need it, then it'd be good if we could make the fix in a single place. Possibly by putting the retry logic at a higher level?

updated description with why this doesn't produce false positives with breakpoints

this doesn't support regex function name lookup, not sure if we care enough about the interaction between regexes/function names under simple template names. if we do, we could instead add template parameters to the names we put in the manual index. I did take a quick look at doing that but it'd require more work

Presumably that'd then lead to divergence between manual and automatic index - which would be bad. So if this behavior is the same between automatic and manual index with simplified template names, that's probably good.

In addition to the divergence, the building the manual index is possibly the most performance-critical part of lldb, so doing all this extra work to reconstruct the templated names is probably a non-starter. If we wanted to support that, then we'd have to come up with a completely different way to achieve implement this functionality.

lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
450 ↗(On Diff #472081)

Are you sure this doesn't need to be repeated for eFunctionNameTypeBase? that's where non-member functions end up...

aeubanks updated this revision to Diff 472770.Nov 2 2022, 2:27 PM

move retry into SymbolFileDWARF
add tests for non-member functions

Why is it that the other indexes don't need an equivalent fix? Could it be that you just haven't tried those code paths?

If they do need it, then it'd be good if we could make the fix in a single place. Possibly by putting the retry logic at a higher level?

Other indexes as in the other manual index indexes? Or as in other higher level indexes?

lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
450 ↗(On Diff #472081)

you're right, but I've moved this up into SymbolFileDWARF

aeubanks retitled this revision from [lldb] Support simplified template names in the manual index to [lldb] Support simplified template names when looking up functions.Nov 2 2022, 2:30 PM
aeubanks edited the summary of this revision. (Show Details)
labath accepted this revision.Nov 3 2022, 7:56 AM

Why is it that the other indexes don't need an equivalent fix? Could it be that you just haven't tried those code paths?

If they do need it, then it'd be good if we could make the fix in a single place. Possibly by putting the retry logic at a higher level?

Other indexes as in the other manual index indexes? Or as in other higher level indexes?

I meant the compiler-generated indexes (implementations in AppleDWARFIndex and DebugNamesDWARFIndex).

This revision is now accepted and ready to land.Nov 3 2022, 7:56 AM
This revision was landed with ongoing or failed builds.Nov 3 2022, 4:19 PM
This revision was automatically updated to reflect the committed changes.