From 67d5567177301d0c24303f26ad119ab7bd7fab40 Mon Sep 17 00:00:00 2001 From: Ted Mielczarek Date: Mon, 16 May 2016 12:30:59 -0400 Subject: Don't let PDBSourceLineWriter::GetSymbolFunctionName return empty function names It's possible for `IDiaSymbol::get_name` to return S_OK and provide and empty string. I haven't figured out the exact root cause yet (the symbols in question are coming from the Rust standard library), but FUNC lines with missing function names break the processor and so we should never do it. This change makes it output "" which matches the behavior of the DWARF dumping code. R=mark@chromium.org BUG=https://bugzilla.mozilla.org/show_bug.cgi?id=1272278 Review URL: https://codereview.chromium.org/1985643004 . --- src/common/windows/pdb_source_line_writer.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/common/windows') diff --git a/src/common/windows/pdb_source_line_writer.cc b/src/common/windows/pdb_source_line_writer.cc index f0edb721..01f4ce3b 100644 --- a/src/common/windows/pdb_source_line_writer.cc +++ b/src/common/windows/pdb_source_line_writer.cc @@ -975,6 +975,16 @@ bool PDBSourceLineWriter::GetSymbolFunctionName(IDiaSymbol *function, fprintf(stderr, "failed to get function name\n"); return false; } + + // It's possible for get_name to return an empty string, so + // special-case that. + if (wcscmp(*name, L"") == 0) { + SysFreeString(*name); + // dwarf_cu_to_module.cc uses "", so match that. + *name = SysAllocString(L""); + return true; + } + // If a name comes from get_name because no undecorated form existed, // it's already formatted properly to be used as output. Don't do any // additional processing. -- cgit v1.2.1