[Lldb-commits] [PATCH] D17363: Add SymbolFilePDB with basic support for line tables.
Zachary Turner via lldb-commits
lldb-commits at lists.llvm.org
Wed Mar 2 10:44:46 PST 2016
zturner added inline comments.
Comment at: source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp:291-292
@@ +290,4 @@
+ // <vector>, either directly or indirectly.
+ auto compilands =
+ m_session_up->findCompilandsForSourceFile(file_spec.GetPath(), llvm::PDB_NameSearchFlags::NS_CaseInsensitive);
> So if file_spec is "vector", this function will return all compile units that have line table entries that match "vector"? It doesn't seem like this is correct. If "check_inlines" is true, I would expect that you need to traverse all compilands?
I was under the impression that this is exactly what it *should* do. If someone says they want to set a breakpoint in line 100 of `<vector>`, then this would need to find all compilands that have line contributions from `<vector>`, and put a breakpoint anywhere that line 100 of `<vector>` contributes to the source.
So basically if `file_spec` is `<vector>` here, then this would return an iterator for all source files that have `#include <vector>`. If you had this code:
// empty file
So in the above example, that line would return an iterator with 2 compilands, one for `foo.cpp` and one for `bar.cpp`. Because `<vector>` contributes to both of those source files.
If `check_inlines` is false, we then skip the file unless it is actually `<vector>` itself (which of course it never would be, because you would never "compile" `<vector>`). And if it's true, we create a `SymbolContext` for it.
So in short, we don't need to traverse *all* compilands, only those that have line contributions from `<vector>`.
My guess is that DWARF doesn't make this easy to figure out, so you have to traverse all the lines and figure this out manually. But in PDB it's easy to get, we just say "give me all compilands that have some lines from `<vector>`, and it magically narrows down the resulting compilands to the exact right set.
More information about the lldb-commits