[all-commits] [llvm/llvm-project] cb9a7c: [LLDB][PDB] Fix age field in UUID in PDB file.

Zequan Wu via All-commits all-commits at lists.llvm.org
Tue Jun 6 08:25:03 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: cb9a7c22ee6789569e28dde073e6827761b4d003
      https://github.com/llvm/llvm-project/commit/cb9a7c22ee6789569e28dde073e6827761b4d003
  Author: Zequan Wu <zequanwu at google.com>
  Date:   2023-06-06 (Tue, 06 Jun 2023)

  Changed paths:
    M lldb/source/Plugins/ObjectFile/PDB/ObjectFilePDB.cpp
    M lldb/test/Shell/ObjectFile/PDB/object.test

  Log Message:
  -----------
  [LLDB][PDB] Fix age field in UUID in PDB file.

There are two age fields in a PDB file. One from the PDB Stream and another one
from the DBI stream.

According to https://randomascii.wordpress.com/2011/11/11/source-indexing-is-underused-awesomeness/#comment-34328,
The age in DBI stream is used to against the binary's age. `Pdbstr.exe` is used
to only increment the age from PDB stream without changing the DBI age. I
also verified this by manually changing the DBI age of a PDB file and let
`windbg.exe` to load it. It shows the following logs before and after changing:

Before:
```
SYMSRV:  BYINDEX: 0xA
         c:\symbols*https://msdl.microsoft.com/download/symbols
         nlaapi.pdb
         D72AA69CD5ABE5D28C74FADB17DE3F8C1
SYMSRV:  PATH: c:\symbols\nlaapi.pdb\D72AA69CD5ABE5D28C74FADB17DE3F8C1\nlaapi.pdb
SYMSRV:  RESULT: 0x00000000
*** WARNING: Unable to verify checksum for NLAapi.dll
DBGHELP: NLAapi - public symbols
        c:\symbols\nlaapi.pdb\D72AA69CD5ABE5D28C74FADB17DE3F8C1\nlaapi.pdb
...
```

After:
```
SYMSRV:  BYINDEX: 0xA
         c:\symbols*https://msdl.microsoft.com/download/symbols
         nlaapi.pdb
         D72AA69CD5ABE5D28C74FADB17DE3F8C1
SYMSRV:  PATH: c:\symbols\nlaapi.pdb\D72AA69CD5ABE5D28C74FADB17DE3F8C1\nlaapi.pdb
SYMSRV:  RESULT: 0x00000000
DBGHELP: c:\symbols\nlaapi.pdb\D72AA69CD5ABE5D28C74FADB17DE3F8C1\nlaapi.pdb - mismatched pdb
SYMSRV:  BYINDEX: 0xB
         c:\symbols*https://chromium-browser-symsrv.commondatastorage.googleapis.com
         nlaapi.pdb
         D72AA69CD5ABE5D28C74FADB17DE3F8C1
SYMSRV:  PATH: c:\symbols\nlaapi.pdb\D72AA69CD5ABE5D28C74FADB17DE3F8C1\nlaapi.pdb
SYMSRV:  RESULT: 0x00000000
DBGHELP: c:\symbols\nlaapi.pdb\D72AA69CD5ABE5D28C74FADB17DE3F8C1\nlaapi.pdb - mismatched pdb
SYMSRV:  BYINDEX: 0xC
         c:\src\symbols*https://msdl.microsoft.com/download/symbols
         nlaapi.pdb
         D72AA69CD5ABE5D28C74FADB17DE3F8C1
SYMSRV:  PATH: c:\src\symbols\nlaapi.pdb\D72AA69CD5ABE5D28C74FADB17DE3F8C1\nlaapi.pdb
SYMSRV:  RESULT: 0x00000000
*** WARNING: Unable to verify checksum for NLAapi.dll
DBGHELP: NLAapi - public symbols
        c:\src\symbols\nlaapi.pdb\D72AA69CD5ABE5D28C74FADB17DE3F8C1\nlaapi.pdb
```

So, `windbg.exe` uses the DBI age to detect mismatched pdb, but it still loads
the pdb even if the age mismatched. Probably lldb should do the same and give
some warnings.

This fixes a bug that lldb can't load some windows system pdbs due to mismatched
uuid.

Reviewed By: rnk

Differential Revision: https://reviews.llvm.org/D152189




More information about the All-commits mailing list