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 <jperaza@chromium.org>
This commit is contained in:
Zequan Wu 2022-01-05 13:41:21 -08:00 committed by Joshua Peraza
parent 10afee3916
commit bbf740148d
2 changed files with 13 additions and 5 deletions

View file

@ -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

View file

@ -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" <file.exe|file.dll> <symbol upload URL> ^\n"
L" [...<symbol upload URLs>]\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;
}