[llvm] r336024 - [CodeView] Correctly compute the name of S_PROCREF symbols.

Zachary Turner via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 29 15:19:03 PDT 2018


Author: zturner
Date: Fri Jun 29 15:19:02 2018
New Revision: 336024

URL: http://llvm.org/viewvc/llvm-project?rev=336024&view=rev
Log:
[CodeView] Correctly compute the name of S_PROCREF symbols.

We have a function which switches on the type of a symbol record
to return a hardcoded offset into the record that contains the
symbol name.  Not all symbols have names to begin with, and for
those records we return -1 for the offset.

Names are used for various things.  Importantly for this particular
bug, a hash of the record name is used as a key for certain hash
tables which are serialied into the PDB file.  One of these hash
tables is for the global symbol stream, which is basically a
collection of S_PROCREF symbols which contain the name of the
symbol, a module, and an address offset.

However, for S_PROCREF symbols, the function to return the offset
of the name was returning -1: basically it wasn't implemented.
As a result of this, all global symbols were hashing to the same
value, essentially it was as if every single global symbol's name
was the empty string.

This manifests in the VS debugger when you try to call a function
(global or member, doesn't matter) through the immediate window
and the debugger simply reports an error because it can't find the
function.  This makes perfect sense, because it is hashing the name
for real, looking in the global symbol hash table, and there is only
1 entry there which corresponds to a symbol whose name is the empty
string.

Fixing this fixes the MSVC debugger in this case.

Modified:
    llvm/trunk/lib/DebugInfo/CodeView/RecordName.cpp

Modified: llvm/trunk/lib/DebugInfo/CodeView/RecordName.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/CodeView/RecordName.cpp?rev=336024&r1=336023&r2=336024&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/CodeView/RecordName.cpp (original)
+++ llvm/trunk/lib/DebugInfo/CodeView/RecordName.cpp Fri Jun 29 15:19:02 2018
@@ -286,6 +286,8 @@ static int getSymbolNameOffset(CVSymbol
   case SymbolKind::S_GMANDATA:
   case SymbolKind::S_LTHREAD32:
   case SymbolKind::S_GTHREAD32:
+  case SymbolKind::S_PROCREF:
+  case SymbolKind::S_LPROCREF:
     return 10;
   // See RegisterSym and LocalSym
   case SymbolKind::S_REGISTER:




More information about the llvm-commits mailing list