Index: src/common/windows/pdb_source_line_writer.cc
===================================================================
--- src/common/windows/pdb_source_line_writer.cc (revision 1208)
+++ src/common/windows/pdb_source_line_writer.cc (working copy)
@@ -176,7 +176,8 @@
}
bool PDBSourceLineWriter::PrintFunction(IDiaSymbol *function,
- IDiaSymbol *block) {
+ IDiaSymbol *block,
+ bool is_x86) {
// The function format is:
// FUNC
DWORD rva;
@@ -198,7 +199,7 @@
CComBSTR name;
int stack_param_size;
- if (!GetSymbolFunctionName(function, &name, &stack_param_size)) {
+ if (!GetSymbolFunctionName(function, is_x86, &name, &stack_param_size)) {
return false;
}
@@ -296,6 +297,17 @@
return false;
}
+ CComPtr global;
+ if (FAILED(session_->get_globalScope(&global))) {
+ fprintf(stderr, "get_globalScope failed\n");
+ return false;
+ }
+
+ DWORD machine_type;
+ // get_machineType can return S_FALSE.
+ bool x86 = (global->get_machineType(&machine_type) == S_OK &&
+ machine_type == IMAGE_FILE_MACHINE_I386);
+
ULONG count;
do {
DWORD tag;
@@ -309,7 +321,7 @@
// that PDBSourceLineWriter will output either a FUNC or PUBLIC line,
// but not both.
if (tag == SymTagFunction) {
- if (!PrintFunction(symbol, symbol)) {
+ if (!PrintFunction(symbol, symbol, x86)) {
return false;
}
} else if (tag == SymTagPublicSymbol) {
@@ -327,12 +339,6 @@
// that are children of them. We can then find the lexical parents
// of those blocks and print out an extra FUNC line for blocks
// that are not contained in their parent functions.
- CComPtr global;
- if (FAILED(session_->get_globalScope(&global))) {
- fprintf(stderr, "get_globalScope failed\n");
- return false;
- }
-
CComPtr compilands;
if (FAILED(global->findChildren(SymTagCompiland, NULL,
nsNone, &compilands))) {
@@ -365,7 +371,7 @@
SUCCEEDED(parent->get_relativeVirtualAddress(&func_rva)) &&
SUCCEEDED(parent->get_length(&func_length))) {
if (block_rva < func_rva || block_rva > (func_rva + func_length)) {
- if (!PrintFunction(parent, block)) {
+ if (!PrintFunction(parent, block, x86)) {
return false;
}
}
@@ -550,9 +556,20 @@
return false;
}
+ CComPtr global;
+ if (FAILED(session_->get_globalScope(&global))) {
+ fprintf(stderr, "get_globalScope failed\n");
+ return false;
+ }
+
+ DWORD machine_type;
+ // get_machineType can return S_FALSE.
+ bool is_x86 = (global->get_machineType(&machine_type) == S_OK &&
+ machine_type == IMAGE_FILE_MACHINE_I386);
+
CComBSTR name;
int stack_param_size;
- if (!GetSymbolFunctionName(symbol, &name, &stack_param_size)) {
+ if (!GetSymbolFunctionName(symbol, is_x86, &name, &stack_param_size)) {
return false;
}
@@ -661,6 +678,7 @@
// static
bool PDBSourceLineWriter::GetSymbolFunctionName(IDiaSymbol *function,
+ bool is_x86,
BSTR *name,
int *stack_param_size) {
*stack_param_size = -1;
@@ -706,6 +724,11 @@
}
}
+ if (!is_x86) {
+ // If non-x86 pdb, it is necessary to modify function name symbols.
+ return true;
+ }
+
// Undecorate names used for stdcall and fastcall. These names prefix
// the identifier with '_' (stdcall) or '@' (fastcall) and suffix it
// with '@' followed by the number of bytes of parameters, in decimal.
Index: src/common/windows/pdb_source_line_writer.h
===================================================================
--- src/common/windows/pdb_source_line_writer.h (revision 1208)
+++ src/common/windows/pdb_source_line_writer.h (working copy)
@@ -138,7 +138,7 @@
// to a code block that is lexically part of this function, but
// resides at a separate address.
// Returns true on success.
- bool PrintFunction(IDiaSymbol *function, IDiaSymbol *block);
+ bool PrintFunction(IDiaSymbol *function, IDiaSymbol *block, bool is_x86);
// Outputs all functions as described above. Returns true on success.
bool PrintFunctions();
@@ -205,7 +205,8 @@
// parameters on the stack, this information is returned in stack_param_size.
// Returns true on success. If the symbol doesn't encode parameter size
// information, stack_param_size is set to -1.
- static bool GetSymbolFunctionName(IDiaSymbol *function, BSTR *name,
+ static bool GetSymbolFunctionName(IDiaSymbol *function, bool is_x86,
+ BSTR *name,
int *stack_param_size);
// Returns the number of bytes of stack space used for a function's