zequanwu added a comment.

In D113930#3173181 <https://reviews.llvm.org/D113930#3173181>, @labath wrote:

> While I'm not very familiar with PDBs or the process of clang ast creation, 
> it sounds to me like there is something wrong here, and I want to make sure 
> we're not using the deduplication to cover up some other issue. Were you able 
> to understand (and ideally, explain) why we have the two parsing methods and 
> why they end up trying to add the same method twice?

In `ModuleParseAllDebugSymbols`, these two functions 
(`NativePDB::ParseFunctions` and `NativePDB::ParseTypes`) are called with 
NativePDB plugin. `NativePDB::ParseFunctions` parses pdb debug stream 
<https://llvm.org/docs/PDB/DbiStream.html>, which contains information for 
those methods existing in the binary. Functions defined in the source files but 
removed by optimizations will not show up in it. This is where those methods 
get created at first time. `NativePDB::ParseTypes` parses pdb type stream 
<https://llvm.org/docs/PDB/TpiStream.html>, which contains type information for 
methods even if they are removed by optimizations. All class members are in the 
class's FieldList type record. `ParseTypes` visits all classes' FieldList to 
complete their TagRecord. This is where those methods get created the second 
time. We can refer to a function's type record (from type stream) using its 
symbol record (from debug stream) but not the opposite, since it's common 
multiple functions have the same signature, which will be just one type record 
for them. If we can change the order of function calls so that `ParseFunctions` 
is after `ParseTypes`, we check if a method is already created or not, not sure 
if it's okay.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D113930/new/

https://reviews.llvm.org/D113930

_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to