[Lldb-commits] [lldb] Add 'FindFirstSymbolWithNameAndType()' to ModuleList. (PR #117777)
Greg Clayton via lldb-commits
lldb-commits at lists.llvm.org
Tue Dec 3 18:03:45 PST 2024
https://github.com/clayborg commented:
This would be easy to test if we expose this via the public API in `SBTarget`. We don't expose a FindFirstSymbolWithNameAndType, but we can expose maybe:
```
lldb::SBSymbol SBTarget::FindFirstSymbol(const char *name, lldb::SymbolType type = eSymbolTypeAny);
```
Since the target has a module list internally, this can use this new function and test it.
To test:
- create two binaries each with a code symbol and a data symbol with the same name by compiling with clang.
- Create a SBModule via `SBModule(const SBModuleSpec &module_spec);` for each binary
- create an empty SBTarget and call `bool SBTarget::AddModule(lldb::SBModule &module);` first with binary 1, and then binary 2, and call the API and sure you get the one from the binary 1 by checking the SBSymbol's SBAddress and getting the module and verifying it is the right one.
- do the same thing as above but add binary 2 first and then binary 1. Make sure you get the symbol from binary 2.
https://github.com/llvm/llvm-project/pull/117777
More information about the lldb-commits
mailing list