| From 2876d1ff19deea7369f19760e4b90da99e877d53 Mon Sep 17 00:00:00 2001 |
| From: Jon Turney <jon.turney@dronecode.org.uk> |
| Date: Thu, 8 Oct 2015 02:11:41 +0100 |
| Subject: [PATCH 08/29] Fix building client library and upload tools for MinGW |
| |
| This is the rest of https://breakpad.appspot.com/548002/, brought up to date |
| |
| v2: |
| Refine MinGW changes in HTTPUpload::GetFileContents so it closes file after use |
| |
| v3: |
| For consistency, write conditionals in terms of _MSC_VER, not __MINGW32__ |
| |
| v4: |
| Use fd rather than FILE * in HTTPUpload::GetFileContents |
| |
| It appears that constructing a stdio_filebuf from a FILE * does a fflush(0), |
| which has been seen to occasionally fail EBADF (on at least W7 x64). |
| |
| Both of these things seem like they might be bugs |
| |
| Workaround for the moment by constructing stdio_filebuf from a fd instead. |
| |
| v5: |
| Drop HTTPUpload::GetFileContents() changes as upstream now uses WideTOMBCP() |
| Drop changes to avoid stdext::checked_array_iterator, as upstream |
| |
| Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk> |
| --- |
| Makefile.am | 2 -- |
| src/client/windows/crash_generation/client_info.cc | 4 ++++ |
| .../windows/tests/crash_generation_app/crash_generation_app.cc | 6 ++++++ |
| 3 files changed, 10 insertions(+), 2 deletions(-) |
| |
| diff --git a/Makefile.am b/Makefile.am |
| index 61545454..7801d243 100644 |
| --- a/Makefile.am |
| +++ b/Makefile.am |
| @@ -354,13 +354,11 @@ bin_PROGRAMS += \ |
| src/processor/minidump_stackwalk |
| endif !DISABLE_PROCESSOR |
| |
| -if !MINGW_HOST |
| if !DISABLE_TOOLS |
| bin_PROGRAMS += \ |
| src/tools/linux/symupload/minidump_upload \ |
| src/tools/linux/symupload/sym_upload |
| endif |
| -endif |
| |
| if LINUX_HOST |
| EXTRA_PROGRAMS += \ |
| diff --git a/src/client/windows/crash_generation/client_info.cc b/src/client/windows/crash_generation/client_info.cc |
| index ed312638..30a48db0 100644 |
| --- a/src/client/windows/crash_generation/client_info.cc |
| +++ b/src/client/windows/crash_generation/client_info.cc |
| @@ -176,7 +176,11 @@ void ClientInfo::SetProcessUptime() { |
| |
| // Convert it to a string. |
| wchar_t* value = custom_info_entries_.get()[custom_client_info_.count].value; |
| +#ifdef _MSC_VER |
| _i64tow_s(delay, value, CustomInfoEntry::kValueMaxLength, 10); |
| +#else |
| + _i64tow(delay, value, 10); |
| +#endif |
| } |
| |
| bool ClientInfo::PopulateCustomInfo() { |
| diff --git a/src/client/windows/tests/crash_generation_app/crash_generation_app.cc b/src/client/windows/tests/crash_generation_app/crash_generation_app.cc |
| index 0d837e52..52736768 100644 |
| --- a/src/client/windows/tests/crash_generation_app/crash_generation_app.cc |
| +++ b/src/client/windows/tests/crash_generation_app/crash_generation_app.cc |
| @@ -42,6 +42,10 @@ |
| |
| #include "client/windows/tests/crash_generation_app/abstract_class.h" |
| |
| +#ifndef _MSC_VER |
| +#define swprintf_s swprintf |
| +#endif |
| + |
| namespace google_breakpad { |
| |
| const int kMaxLoadString = 100; |
| @@ -480,9 +484,11 @@ int APIENTRY _tWinMain(HINSTANCE instance, |
| CustomClientInfo custom_info = {kCustomInfoEntries, kCustomInfoCount}; |
| |
| CrashServerStart(); |
| +#ifdef _MSC_VER |
| // This is needed for CRT to not show dialog for invalid param |
| // failures and instead let the code handle it. |
| _CrtSetReportMode(_CRT_ASSERT, 0); |
| +#endif |
| handler = new ExceptionHandler(L"C:\\dumps\\", |
| NULL, |
| google_breakpad::ShowDumpResults, |
| -- |
| 2.15.0 |
| |