From bbf740148d4fbd77b6ac103c22d83703f9488da0 Mon Sep 17 00:00:00 2001 From: Zequan Wu Date: Wed, 5 Jan 2022 13:41:21 -0800 Subject: [PATCH] Fix symupload build failure on Windows. - Make handle_inline default to false in PDBSourceLineWriter constructor. - Add --i flag for symupload to generate inline information. Change-Id: I3149173ee635a503b9508a12ef572f8b6e5c5dfe Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3364804 Reviewed-by: Joshua Peraza --- src/common/windows/pdb_source_line_writer.h | 2 +- src/tools/windows/symupload/symupload.cc | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/common/windows/pdb_source_line_writer.h b/src/common/windows/pdb_source_line_writer.h index b1aa85e1..091700a7 100644 --- a/src/common/windows/pdb_source_line_writer.h +++ b/src/common/windows/pdb_source_line_writer.h @@ -62,7 +62,7 @@ class PDBSourceLineWriter { ANY_FILE // try PDB_FILE and then EXE_FILE }; - explicit PDBSourceLineWriter(bool handle_inline); + explicit PDBSourceLineWriter(bool handle_inline = false); ~PDBSourceLineWriter(); // Opens the given file. For executable files, the corresponding pdb diff --git a/src/tools/windows/symupload/symupload.cc b/src/tools/windows/symupload/symupload.cc index e6fa126f..c774b0e7 100644 --- a/src/tools/windows/symupload/symupload.cc +++ b/src/tools/windows/symupload/symupload.cc @@ -116,8 +116,9 @@ static bool GetFileVersionString(const wchar_t* filename, wstring* version) { // and information about the pdb in pdb_info. static bool DumpSymbolsToTempFile(const wchar_t* file, wstring* temp_file_path, - PDBModuleInfo* pdb_info) { - google_breakpad::PDBSourceLineWriter writer; + PDBModuleInfo* pdb_info, + bool handle_inline) { + google_breakpad::PDBSourceLineWriter writer(handle_inline); // Use EXE_FILE to get information out of the exe/dll in addition to the // pdb. The name and version number of the exe/dll are of value, and // there's no way to locate an exe/dll given a pdb. @@ -247,9 +248,10 @@ static bool DoSymUploadV2( __declspec(noreturn) void printUsageAndExit() { wprintf(L"Usage:\n\n" - L" symupload [--timeout NN] [--product product_name] ^\n" + L" symupload [--i] [--timeout NN] [--product product_name] ^\n" L" ^\n" L" [...]\n\n"); + wprintf(L" - i: Extract inline information from pdb.\n"); wprintf(L" - Timeout is in milliseconds, or can be 0 to be unlimited.\n"); wprintf(L" - product_name is an HTTP-friendly product name. It must only\n" L" contain an ascii subset: alphanumeric and punctuation.\n" @@ -273,6 +275,7 @@ __declspec(noreturn) void printUsageAndExit() { int wmain(int argc, wchar_t* argv[]) { const wchar_t* module; const wchar_t* product = nullptr; + bool handle_inline = false; int timeout = -1; int currentarg = 1; bool use_sym_upload_v2 = false; @@ -280,6 +283,11 @@ int wmain(int argc, wchar_t* argv[]) { const wchar_t* api_url = nullptr; const wchar_t* api_key = nullptr; while (argc > currentarg + 1) { + if (!wcscmp(L"--i", argv[currentarg])) { + handle_inline = true; + ++currentarg; + continue; + } if (!wcscmp(L"--timeout", argv[currentarg])) { timeout = _wtoi(argv[currentarg + 1]); currentarg += 2; @@ -310,7 +318,7 @@ int wmain(int argc, wchar_t* argv[]) { wstring symbol_file; PDBModuleInfo pdb_info; - if (!DumpSymbolsToTempFile(module, &symbol_file, &pdb_info)) { + if (!DumpSymbolsToTempFile(module, &symbol_file, &pdb_info, handle_inline)) { fwprintf(stderr, L"Could not get symbol data from %s\n", module); return 1; }