This is an archive of the discontinued LLVM Phabricator instance.

[lldb] Allow SymbolTable regex search functions to match mangled name
ClosedPublic

Authored by augusto2112 on Jul 29 2022, 3:23 PM.

Details

Summary

It may be useful to search symbol table entries by mangled instead
of demangled names. Add this optional functionality in the SymbolTable
functions.

Diff Detail

Event Timeline

augusto2112 created this revision.Jul 29 2022, 3:23 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 29 2022, 3:23 PM
augusto2112 requested review of this revision.Jul 29 2022, 3:23 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 29 2022, 3:23 PM

It sounds like it should be possible to test this with lldb-test?

@aprantl do you mean dumping this with lldb-test? I'm not seeing a way to do this. If you're thinking about symbols that reads the symbol file not the symbol table.

labath added a comment.Aug 1 2022, 5:32 AM

Who sets this flag? How do you intend to use it?

lldb/include/lldb/Core/Module.h
265

Could this be Mangled::NamePreference instead of bool ?

Who sets this flag? How do you intend to use it?

I need this change downstream to search for certain swift mangled names by querying Module::FindSymbolsMatchingRegExAndType. It seemed general enough that we might want this upstream.

lldb/include/lldb/Core/Module.h
265

Ok! Wasn't aware of that enum. I'll change that.

Added test and updated functions to use Mangled::NamePreference instead of a bool

JDevlieghere added inline comments.Aug 2 2022, 2:50 PM
lldb/test/Shell/Symtab/Inputs/t.yaml
60

You could make this slightly smaller by dropping the content of the __unwind_info and __eh_frame below.

This revision is now accepted and ready to land.Aug 2 2022, 3:16 PM

Removed unwind_info and eh_frame sections from test yaml file.

labath accepted this revision.Aug 3 2022, 3:14 AM

Who sets this flag? How do you intend to use it?

I need this change downstream to search for certain swift mangled names by querying Module::FindSymbolsMatchingRegExAndType. It seemed general enough that we might want this upstream.

That's ok. The reason I was asking was because it affects the ways in which one can test that.

lldb/test/Shell/Symtab/Inputs/t.yaml
2

Use a more descriptive name for the file.

I'd also consider using an elf file for this test, simply because their yaml form is much more concise (and you can strip out pretty much everything except the symtab, and use an unlinked .o file as the template, and still have it work).

Updated test to use elf object file.

This revision was landed with ongoing or failed builds.Aug 3 2022, 10:57 AM
This revision was automatically updated to reflect the committed changes.