mirror of
https://github.com/yuzu-emu/breakpad.git
synced 2024-11-27 23:14:24 +01:00
Fix 'debug_file' in PESourceLineWriter.
- Add a #define to testing.gyp to avoid warnings about TR1 deprecation. - PESourceLineWriter now reads debug_file from CodeView record instead of using code_file value. - Updated PE-only MD reading unit test. Change-Id: Ib4e6201df3e3fd651e160f310584b5a67b16c842 Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/1668347 Reviewed-by: Ivan Penkov <ivanpe@chromium.org>
This commit is contained in:
parent
ee65a3c005
commit
c38725b70e
@ -53,9 +53,9 @@
|
||||
# Visual C++ implements variadic templates strangely, and
|
||||
# VC++2012 broke Google Test by lowering this value. See
|
||||
# http://stackoverflow.com/questions/12558327/google-test-in-visual-studio-2012
|
||||
'defines': ['_VARIADIC_MAX=10'],
|
||||
'defines': ['_VARIADIC_MAX=10', '_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING'],
|
||||
},
|
||||
'defines': ['_VARIADIC_MAX=10'],
|
||||
'defines': ['_VARIADIC_MAX=10', '_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING'],
|
||||
},
|
||||
{
|
||||
'target_name': 'gmock',
|
||||
@ -81,9 +81,9 @@
|
||||
'<(DEPTH)/testing/googlemock',
|
||||
'<(DEPTH)/testing',
|
||||
],
|
||||
'defines': ['_VARIADIC_MAX=10'],
|
||||
'defines': ['_VARIADIC_MAX=10', '_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING'],
|
||||
},
|
||||
'defines': ['_VARIADIC_MAX=10'],
|
||||
'defines': ['_VARIADIC_MAX=10', '_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING'],
|
||||
},
|
||||
|
||||
],
|
||||
|
@ -95,7 +95,7 @@ struct CV_INFO_PDB70 {
|
||||
ULONG cv_signature;
|
||||
GUID signature;
|
||||
ULONG age;
|
||||
UCHAR pdb_filename[ANYSIZE_ARRAY];
|
||||
CHAR pdb_filename[ANYSIZE_ARRAY];
|
||||
};
|
||||
|
||||
#define CV_SIGNATURE_RSDS 'SDSR'
|
||||
@ -123,8 +123,6 @@ using std::unique_ptr;
|
||||
using google_breakpad::GUIDString;
|
||||
|
||||
bool ReadModuleInfo(const wstring & pe_file, PDBModuleInfo * info) {
|
||||
info->debug_file = WindowsStringUtils::GetBaseName(pe_file);
|
||||
|
||||
// Convert wchar to native charset because ImageLoad only takes
|
||||
// a PSTR as input.
|
||||
string img_file;
|
||||
@ -179,6 +177,22 @@ bool ReadModuleInfo(const wstring & pe_file, PDBModuleInfo * info) {
|
||||
|
||||
info->debug_identifier = GenerateDebugIdentifier(cv_info->age,
|
||||
cv_info->signature);
|
||||
|
||||
// This code assumes that the pdb_filename is stored as ASCII without
|
||||
// multibyte characters, but it's not clear if that's true.
|
||||
size_t debug_file_length = strnlen_s(cv_info->pdb_filename, MAX_PATH);
|
||||
if (debug_file_length < 0 || debug_file_length >= MAX_PATH) {
|
||||
fprintf(stderr, "PE debug directory is corrupt.\n");
|
||||
return false;
|
||||
}
|
||||
std::string debug_file(cv_info->pdb_filename, debug_file_length);
|
||||
if (!WindowsStringUtils::safe_mbstowcs(debug_file, &info->debug_file)) {
|
||||
fprintf(stderr, "PDB filename '%s' contains unrecognized characters.\n",
|
||||
debug_file.c_str());
|
||||
return false;
|
||||
}
|
||||
info->debug_file = WindowsStringUtils::GetBaseName(info->debug_file);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
MODULE windows x86_64 2A5EAB481FAB4A17A9761CDC14FE531A1 pe_only_symbol_test.dll
|
||||
MODULE windows x86_64 2A5EAB481FAB4A17A9761CDC14FE531A1 pe_only_symbol_test.pdb
|
||||
INFO CODE_ID 5C8AD05F12000 pe_only_symbol_test.dll
|
||||
STACK CFI INIT 1440 39 .cfa: $rsp .ra: .cfa 8 - ^
|
||||
STACK CFI 1440 .cfa: $rsp 32 +
|
||||
|
Loading…
Reference in New Issue
Block a user