initial import
This commit is contained in:
commit
e45dae9d3b
27
recipes/breakpad/all/conandata.yml
Normal file
27
recipes/breakpad/all/conandata.yml
Normal file
@ -0,0 +1,27 @@
|
||||
patches:
|
||||
- "patches/0001-Remove-local-copy-of-curl-headers.patch"
|
||||
- "patches/0002-Link-minidump_upload-and-sym_upload-with-curl.patch"
|
||||
- "patches/0003-Build-minidump_upload-and-sym_upload-for-all-targets.patch"
|
||||
- "patches/0004-Add-support-for-DWARF-in-PECOFF-as-used-by-Cygwin-an.patch"
|
||||
- "patches/0005-Fix-building-minidump-processor-for-MinGW.patch"
|
||||
- "patches/0006-Build-PECOFF-DWARF-dump_syms-for-MinGW.patch"
|
||||
- "patches/0007-Fix-building-client-library-and-upload-tools-for-Min.patch"
|
||||
- "patches/0008-Fix-common.gypi-to-allow-gyp-to-generate-Makefiles-o.patch"
|
||||
- "patches/0009-Teach-gyp-generated-Makefile-to-build-crash_generati.patch"
|
||||
- "patches/0010-Default-debug_file-to-the-code_file-basename.patch"
|
||||
- "patches/0011-Fix-Windows-client-unit-tests-with-gcc.patch"
|
||||
- "patches/0012-Add-symsrv_convert.patch"
|
||||
- "patches/0013-Use-a-default-debug-id-of-all-zeros-when-no-CV-recor.patch"
|
||||
- "patches/0014-Use-__USE_MINGW_ANSI_STDIO-for-MinGW-build.patch"
|
||||
- "patches/0015-Provide-a-working-strtok_r-for-MinGW.patch"
|
||||
- "patches/0016-Fallback-to-synthesizing-a-debug-id-from-version-and.patch"
|
||||
- "patches/0017-Fix-typo-in-the-name-of-the-info-entry-containing-up.patch"
|
||||
- "patches/0018-Fix-a-missing-r-in-crash_generation_app.patch"
|
||||
- "patches/0019-Disable-DwpReader-for-MinGW.patch"
|
||||
- "patches/0020-memory_allocator-Use-allocator_traits-rather-than-al.patch"
|
||||
- "patches/0021-Add-a-null-range-handler-to-DwarfCUToModule-construc.patch"
|
||||
- "patches/0022-Build-a-minimal-breakpad-client-library-if-a-MINGW_H.patch"
|
||||
- "patches/0023-Enable-minimalist-build-signatures.patch"
|
||||
- "patches/0024-Disable-the-pseudo-build-ID-generation-for-PECOFF.patch"
|
||||
- "patches/0025-Ensure-wide-strings-use-the-wide-versions-of-Windows.patch"
|
||||
- "patches/0026-string_conversion-workaround-GCC10-codegen-bug.patch"
|
87
recipes/breakpad/all/conanfile.py
Normal file
87
recipes/breakpad/all/conanfile.py
Normal file
@ -0,0 +1,87 @@
|
||||
from conans import ConanFile, AutoToolsBuildEnvironment, tools
|
||||
from conans.errors import ConanInvalidConfiguration
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
class BreakpadConan(ConanFile):
|
||||
name = "breakpad"
|
||||
version = "64"
|
||||
#license = "<Put the package license here>"
|
||||
author = "Danny Robson danny@nerdcruft.net"
|
||||
#url = "<Package recipe repository url here, for issues about the package>"
|
||||
#description = "<Description of Breakpad here>"
|
||||
#topics = ("<Put some tag here>", "<here>", "<and here>")
|
||||
settings = "os", "compiler", "build_type", "arch"
|
||||
#options = {"shared": [True, False]}
|
||||
#default_options = {"shared": False}
|
||||
requires = 'libcurl/7.71.0'
|
||||
exports_sources = ["patches/*"]
|
||||
build_requires = "autoconf/2.69"
|
||||
|
||||
def source(self):
|
||||
tools.unzip("/home/danny/src/conan/dist/breakpad.tar.xz")
|
||||
|
||||
#self.run("git clone https://chromium.googlesource.com/breakpad/breakpad")
|
||||
#with tools.chdir("breakpad"):
|
||||
# self.run(f"git checkout db1cda26539c711c3da7ed4d410dfe8190e89b8f")
|
||||
# self.run("mkdir src/third_party/ -p")
|
||||
# with tools.chdir("src/third_party/"):
|
||||
# self.run("git clone https://chromium.googlesource.com/linux-syscall-support/ lss")
|
||||
|
||||
|
||||
def _stdlib_args(self):
|
||||
lookup = {
|
||||
'gcc': {
|
||||
'libstdc++': '',
|
||||
'libstdc++11': '',
|
||||
},
|
||||
'clang': {
|
||||
'libstdc++': '-stdlib=libstdc++',
|
||||
'libstdc++11': '-stdlib=libstdc++',
|
||||
'libc++': '-stdlib=libc++',
|
||||
},
|
||||
}
|
||||
|
||||
compiler = lookup.get(self.settings.compiler.value, None)
|
||||
if compiler is None:
|
||||
raise ConanInvalidConfiguration(f"Unhandled compiler: {compiler}")
|
||||
|
||||
arg = compiler.get(self.settings.compiler.libcxx.value, None)
|
||||
if arg is None:
|
||||
raise ConanInvalidConfiguration(f"Unhandled stdlib: {self.settings.compiler.libcxx.value}")
|
||||
|
||||
return arg
|
||||
|
||||
def build(self):
|
||||
for patch in self.conan_data["patches"]:
|
||||
print(f"Patching: {patch}")
|
||||
tools.patch(
|
||||
base_path="breakpad",
|
||||
patch_file=patch,
|
||||
strip=0,
|
||||
fuzz=False
|
||||
)
|
||||
|
||||
with tools.chdir('./breakpad'):
|
||||
self.run("autoreconf -fiv", run_environment=True)
|
||||
|
||||
stdlib = self._stdlib_args()
|
||||
if stdlib is None:
|
||||
raise ConanInvalidConfiguration ("Unable to determine stdlib flags for compiler")
|
||||
|
||||
autotools = AutoToolsBuildEnvironment(self)
|
||||
env_build_vars = autotools.vars
|
||||
env_build_vars['CFLAGS'] = f'-Wno-error {stdlib}'
|
||||
env_build_vars['CXXFLAGS'] = f'-Wno-error {stdlib}'
|
||||
autotools.configure(vars=env_build_vars)
|
||||
autotools.make(vars=env_build_vars)
|
||||
|
||||
def package(self):
|
||||
with tools.chdir('./breakpad'):
|
||||
autotools = AutoToolsBuildEnvironment(self)
|
||||
autotools.install()
|
||||
|
||||
def package_info(self):
|
||||
self.cpp_info.libs = ["breakpad_client"]
|
||||
self.cpp_info.includedirs.append(os.path.join("include", "breakpad"))
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,218 @@
|
||||
From b1d502ae57e6ef3538318e72fc925f28b4e1b48a Mon Sep 17 00:00:00 2001
|
||||
From: Jon Turney <jon.turney@dronecode.org.uk>
|
||||
Date: Sat, 5 Mar 2016 12:48:05 +0000
|
||||
Subject: [PATCH 02/19] Link minidump_upload and sym_upload with curl
|
||||
|
||||
Don't link with -ldl and use dlopen to use libcurl.so, but just link with
|
||||
libcurl
|
||||
|
||||
This has the advantage of not needing to know the precise name of the curl
|
||||
shared object on every platform...
|
||||
|
||||
This effectively reverts commit 68b4798e
|
||||
|
||||
See also https://bugs.chromium.org/p/google-breakpad/issues/detail?id=225
|
||||
|
||||
XXX: Perhaps retaining linking with -dl and just teaching it the name of
|
||||
curl shared object on Cygwin would be more upstreamable, although the
|
||||
reasons for solving the bug above like this are obscure to me ...
|
||||
|
||||
Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
|
||||
---
|
||||
Makefile.am | 4 +-
|
||||
src/common/linux/http_upload.cc | 101 ++++++--------------------------
|
||||
2 files changed, 21 insertions(+), 84 deletions(-)
|
||||
|
||||
diff --git a/Makefile.am b/Makefile.am
|
||||
index dcef735d..904a9a77 100644
|
||||
--- a/Makefile.am
|
||||
+++ b/Makefile.am
|
||||
@@ -610,7 +610,7 @@ src_tools_linux_md2core_minidump_2_core_SOURCES = \
|
||||
src_tools_linux_symupload_minidump_upload_SOURCES = \
|
||||
src/common/linux/http_upload.cc \
|
||||
src/tools/linux/symupload/minidump_upload.cc
|
||||
-src_tools_linux_symupload_minidump_upload_LDADD = -ldl
|
||||
+src_tools_linux_symupload_minidump_upload_LDADD = -lcurl
|
||||
|
||||
src_tools_linux_symupload_sym_upload_SOURCES = \
|
||||
src/common/linux/http_upload.cc \
|
||||
@@ -618,7 +618,7 @@ src_tools_linux_symupload_sym_upload_SOURCES = \
|
||||
src/common/linux/symbol_upload.cc \
|
||||
src/common/linux/symbol_upload.h \
|
||||
src/tools/linux/symupload/sym_upload.cc
|
||||
-src_tools_linux_symupload_sym_upload_LDADD = -ldl
|
||||
+src_tools_linux_symupload_sym_upload_LDADD = -lcurl
|
||||
|
||||
src_tools_mac_dump_syms_dump_syms_mac_SOURCES = \
|
||||
src/common/dwarf_cfi_to_module.cc \
|
||||
diff --git a/src/common/linux/http_upload.cc b/src/common/linux/http_upload.cc
|
||||
index c62b0cf0..3d215810 100644
|
||||
--- a/src/common/linux/http_upload.cc
|
||||
+++ b/src/common/linux/http_upload.cc
|
||||
@@ -30,7 +30,6 @@
|
||||
#include "common/linux/http_upload.h"
|
||||
|
||||
#include <assert.h>
|
||||
-#include <dlfcn.h>
|
||||
#include <curl/curl.h>
|
||||
#include <curl/easy.h>
|
||||
|
||||
@@ -70,52 +69,13 @@ bool HTTPUpload::SendRequest(const string &url,
|
||||
if (!CheckParameters(parameters))
|
||||
return false;
|
||||
|
||||
- // We may have been linked statically; if curl_easy_init is in the
|
||||
- // current binary, no need to search for a dynamic version.
|
||||
- void* curl_lib = dlopen(NULL, RTLD_NOW);
|
||||
- if (!CheckCurlLib(curl_lib)) {
|
||||
- fprintf(stderr,
|
||||
- "Failed to open curl lib from binary, use libcurl.so instead\n");
|
||||
- dlerror(); // Clear dlerror before attempting to open libraries.
|
||||
- dlclose(curl_lib);
|
||||
- curl_lib = NULL;
|
||||
- }
|
||||
- if (!curl_lib) {
|
||||
- curl_lib = dlopen("libcurl.so", RTLD_NOW);
|
||||
- }
|
||||
- if (!curl_lib) {
|
||||
- if (error_description != NULL)
|
||||
- *error_description = dlerror();
|
||||
- curl_lib = dlopen("libcurl.so.4", RTLD_NOW);
|
||||
- }
|
||||
- if (!curl_lib) {
|
||||
- // Debian gives libcurl a different name when it is built against GnuTLS
|
||||
- // instead of OpenSSL.
|
||||
- curl_lib = dlopen("libcurl-gnutls.so.4", RTLD_NOW);
|
||||
- }
|
||||
- if (!curl_lib) {
|
||||
- curl_lib = dlopen("libcurl.so.3", RTLD_NOW);
|
||||
- }
|
||||
- if (!curl_lib) {
|
||||
- return false;
|
||||
- }
|
||||
-
|
||||
- CURL* (*curl_easy_init)(void);
|
||||
- *(void**) (&curl_easy_init) = dlsym(curl_lib, "curl_easy_init");
|
||||
- CURL *curl = (*curl_easy_init)();
|
||||
+ CURL *curl = curl_easy_init();
|
||||
if (error_description != NULL)
|
||||
*error_description = "No Error";
|
||||
|
||||
- if (!curl) {
|
||||
- dlclose(curl_lib);
|
||||
- return false;
|
||||
- }
|
||||
-
|
||||
CURLcode err_code = CURLE_OK;
|
||||
- CURLcode (*curl_easy_setopt)(CURL *, CURLoption, ...);
|
||||
- *(void**) (&curl_easy_setopt) = dlsym(curl_lib, "curl_easy_setopt");
|
||||
- (*curl_easy_setopt)(curl, CURLOPT_URL, url.c_str());
|
||||
- (*curl_easy_setopt)(curl, CURLOPT_USERAGENT, kUserAgent);
|
||||
+ curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
|
||||
+ curl_easy_setopt(curl, CURLOPT_USERAGENT, kUserAgent);
|
||||
// Support multithread by disabling timeout handling, would get SIGSEGV with
|
||||
// Curl_resolv_timeout in stack trace otherwise.
|
||||
// See https://curl.haxx.se/libcurl/c/threadsafe.html
|
||||
@@ -132,83 +92,60 @@ bool HTTPUpload::SendRequest(const string &url,
|
||||
struct curl_httppost *formpost = NULL;
|
||||
struct curl_httppost *lastptr = NULL;
|
||||
// Add form data.
|
||||
- CURLFORMcode (*curl_formadd)(struct curl_httppost **, struct curl_httppost **, ...);
|
||||
- *(void**) (&curl_formadd) = dlsym(curl_lib, "curl_formadd");
|
||||
map<string, string>::const_iterator iter = parameters.begin();
|
||||
for (; iter != parameters.end(); ++iter)
|
||||
- (*curl_formadd)(&formpost, &lastptr,
|
||||
+ curl_formadd(&formpost, &lastptr,
|
||||
CURLFORM_COPYNAME, iter->first.c_str(),
|
||||
CURLFORM_COPYCONTENTS, iter->second.c_str(),
|
||||
CURLFORM_END);
|
||||
|
||||
// Add form files.
|
||||
for (iter = files.begin(); iter != files.end(); ++iter) {
|
||||
- (*curl_formadd)(&formpost, &lastptr,
|
||||
+ curl_formadd(&formpost, &lastptr,
|
||||
CURLFORM_COPYNAME, iter->first.c_str(),
|
||||
CURLFORM_FILE, iter->second.c_str(),
|
||||
CURLFORM_END);
|
||||
}
|
||||
|
||||
- (*curl_easy_setopt)(curl, CURLOPT_HTTPPOST, formpost);
|
||||
+ curl_easy_setopt(curl, CURLOPT_HTTPPOST, formpost);
|
||||
|
||||
// Disable 100-continue header.
|
||||
struct curl_slist *headerlist = NULL;
|
||||
char buf[] = "Expect:";
|
||||
- struct curl_slist* (*curl_slist_append)(struct curl_slist *, const char *);
|
||||
- *(void**) (&curl_slist_append) = dlsym(curl_lib, "curl_slist_append");
|
||||
- headerlist = (*curl_slist_append)(headerlist, buf);
|
||||
- (*curl_easy_setopt)(curl, CURLOPT_HTTPHEADER, headerlist);
|
||||
+ headerlist = curl_slist_append(headerlist, buf);
|
||||
+ curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headerlist);
|
||||
|
||||
if (response_body != NULL) {
|
||||
- (*curl_easy_setopt)(curl, CURLOPT_WRITEFUNCTION, WriteCallback);
|
||||
- (*curl_easy_setopt)(curl, CURLOPT_WRITEDATA,
|
||||
+ curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback);
|
||||
+ curl_easy_setopt(curl, CURLOPT_WRITEDATA,
|
||||
reinterpret_cast<void *>(response_body));
|
||||
}
|
||||
|
||||
// Fail if 400+ is returned from the web server.
|
||||
- (*curl_easy_setopt)(curl, CURLOPT_FAILONERROR, 1);
|
||||
+ curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1);
|
||||
|
||||
- CURLcode (*curl_easy_perform)(CURL *);
|
||||
- *(void**) (&curl_easy_perform) = dlsym(curl_lib, "curl_easy_perform");
|
||||
- err_code = (*curl_easy_perform)(curl);
|
||||
+ err_code = curl_easy_perform(curl);
|
||||
if (response_code != NULL) {
|
||||
- CURLcode (*curl_easy_getinfo)(CURL *, CURLINFO, ...);
|
||||
- *(void**) (&curl_easy_getinfo) = dlsym(curl_lib, "curl_easy_getinfo");
|
||||
- (*curl_easy_getinfo)(curl, CURLINFO_RESPONSE_CODE, response_code);
|
||||
+ curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, response_code);
|
||||
}
|
||||
- const char* (*curl_easy_strerror)(CURLcode);
|
||||
- *(void**) (&curl_easy_strerror) = dlsym(curl_lib, "curl_easy_strerror");
|
||||
#ifndef NDEBUG
|
||||
if (err_code != CURLE_OK)
|
||||
fprintf(stderr, "Failed to send http request to %s, error: %s\n",
|
||||
url.c_str(),
|
||||
- (*curl_easy_strerror)(err_code));
|
||||
+ curl_easy_strerror(err_code));
|
||||
#endif
|
||||
if (error_description != NULL)
|
||||
- *error_description = (*curl_easy_strerror)(err_code);
|
||||
+ *error_description = curl_easy_strerror(err_code);
|
||||
|
||||
- void (*curl_easy_cleanup)(CURL *);
|
||||
- *(void**) (&curl_easy_cleanup) = dlsym(curl_lib, "curl_easy_cleanup");
|
||||
- (*curl_easy_cleanup)(curl);
|
||||
+ curl_easy_cleanup(curl);
|
||||
if (formpost != NULL) {
|
||||
- void (*curl_formfree)(struct curl_httppost *);
|
||||
- *(void**) (&curl_formfree) = dlsym(curl_lib, "curl_formfree");
|
||||
- (*curl_formfree)(formpost);
|
||||
+ curl_formfree(formpost);
|
||||
}
|
||||
if (headerlist != NULL) {
|
||||
- void (*curl_slist_free_all)(struct curl_slist *);
|
||||
- *(void**) (&curl_slist_free_all) = dlsym(curl_lib, "curl_slist_free_all");
|
||||
- (*curl_slist_free_all)(headerlist);
|
||||
+ curl_slist_free_all(headerlist);
|
||||
}
|
||||
- dlclose(curl_lib);
|
||||
- return err_code == CURLE_OK;
|
||||
-}
|
||||
|
||||
-// static
|
||||
-bool HTTPUpload::CheckCurlLib(void* curl_lib) {
|
||||
- return curl_lib &&
|
||||
- dlsym(curl_lib, "curl_easy_init") &&
|
||||
- dlsym(curl_lib, "curl_easy_setopt");
|
||||
+ return err_code == CURLE_OK;
|
||||
}
|
||||
|
||||
// static
|
||||
--
|
||||
2.28.0
|
||||
|
@ -0,0 +1,85 @@
|
||||
From d37f518ac236ce68927177cad84bf153c66ffc3f Mon Sep 17 00:00:00 2001
|
||||
From: Jon Turney <jon.turney@dronecode.org.uk>
|
||||
Date: Sat, 5 Mar 2016 12:56:22 +0000
|
||||
Subject: [PATCH 03/19] Build minidump_upload and sym_upload for all targets
|
||||
|
||||
minidump_upload and sym_upload should probably move from src/tools/linux/ to
|
||||
a new src/tools/common/, and move linux/http_upload.{cc,.h} up to
|
||||
src/common/ from src/common/linux/ ?
|
||||
|
||||
Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
|
||||
---
|
||||
Makefile.am | 36 ++++++++++++++++++++----------------
|
||||
1 file changed, 20 insertions(+), 16 deletions(-)
|
||||
|
||||
diff --git a/Makefile.am b/Makefile.am
|
||||
index 904a9a77..ea82edcd 100644
|
||||
--- a/Makefile.am
|
||||
+++ b/Makefile.am
|
||||
@@ -346,6 +346,12 @@ bin_PROGRAMS += \
|
||||
src/processor/minidump_stackwalk
|
||||
endif !DISABLE_PROCESSOR
|
||||
|
||||
+if !DISABLE_TOOLS
|
||||
+bin_PROGRAMS += \
|
||||
+ src/tools/linux/symupload/minidump_upload \
|
||||
+ src/tools/linux/symupload/sym_upload
|
||||
+endif
|
||||
+
|
||||
if LINUX_HOST
|
||||
EXTRA_PROGRAMS += \
|
||||
src/client/linux/linux_dumper_unittest_helper
|
||||
@@ -356,9 +362,7 @@ if !DISABLE_TOOLS
|
||||
bin_PROGRAMS += \
|
||||
src/tools/linux/core2md/core2md \
|
||||
src/tools/linux/dump_syms/dump_syms \
|
||||
- src/tools/linux/md2core/minidump-2-core \
|
||||
- src/tools/linux/symupload/minidump_upload \
|
||||
- src/tools/linux/symupload/sym_upload
|
||||
+ src/tools/linux/md2core/minidump-2-core
|
||||
if X86_HOST
|
||||
bin_PROGRAMS += \
|
||||
src/tools/mac/dump_syms/dump_syms_mac
|
||||
@@ -456,6 +460,19 @@ LOG_DRIVER = $(top_srcdir)/autotools/test-driver
|
||||
endif !TESTS_AS_ROOT
|
||||
endif !ANDROID_HOST
|
||||
|
||||
+src_tools_linux_symupload_minidump_upload_SOURCES = \
|
||||
+ src/common/linux/http_upload.cc \
|
||||
+ src/tools/linux/symupload/minidump_upload.cc
|
||||
+src_tools_linux_symupload_minidump_upload_LDADD = -lcurl
|
||||
+
|
||||
+src_tools_linux_symupload_sym_upload_SOURCES = \
|
||||
+ src/common/linux/http_upload.cc \
|
||||
+ src/common/linux/http_upload.h \
|
||||
+ src/common/linux/symbol_upload.cc \
|
||||
+ src/common/linux/symbol_upload.h \
|
||||
+ src/tools/linux/symupload/sym_upload.cc
|
||||
+src_tools_linux_symupload_sym_upload_LDADD = -lcurl
|
||||
+
|
||||
if LINUX_HOST
|
||||
src_client_linux_linux_dumper_unittest_helper_SOURCES = \
|
||||
src/client/linux/minidump_writer/linux_dumper_unittest_helper.cc
|
||||
@@ -607,19 +624,6 @@ src_tools_linux_md2core_minidump_2_core_SOURCES = \
|
||||
src/tools/linux/md2core/minidump-2-core.cc \
|
||||
src/tools/linux/md2core/minidump_memory_range.h
|
||||
|
||||
-src_tools_linux_symupload_minidump_upload_SOURCES = \
|
||||
- src/common/linux/http_upload.cc \
|
||||
- src/tools/linux/symupload/minidump_upload.cc
|
||||
-src_tools_linux_symupload_minidump_upload_LDADD = -lcurl
|
||||
-
|
||||
-src_tools_linux_symupload_sym_upload_SOURCES = \
|
||||
- src/common/linux/http_upload.cc \
|
||||
- src/common/linux/http_upload.h \
|
||||
- src/common/linux/symbol_upload.cc \
|
||||
- src/common/linux/symbol_upload.h \
|
||||
- src/tools/linux/symupload/sym_upload.cc
|
||||
-src_tools_linux_symupload_sym_upload_LDADD = -lcurl
|
||||
-
|
||||
src_tools_mac_dump_syms_dump_syms_mac_SOURCES = \
|
||||
src/common/dwarf_cfi_to_module.cc \
|
||||
src/common/dwarf_cu_to_module.cc \
|
||||
--
|
||||
2.28.0
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,183 @@
|
||||
From e3a6eefeef6d7873fee61a37ef38f34caf5c3d1c Mon Sep 17 00:00:00 2001
|
||||
From: Jon Turney <jon.turney@dronecode.org.uk>
|
||||
Date: Fri, 11 Jul 2014 23:37:02 +0100
|
||||
Subject: [PATCH 05/19] Fix building minidump processor for MinGW
|
||||
|
||||
- Link minidump_stackwalk, minidump_dump, microdump_stackwalk with
|
||||
PTHREAD_LIBS as pthread_cancel is used
|
||||
|
||||
- Link minidump_stackwalk, microdump_stackwalk, binarystream_unittest with
|
||||
ws2_32 as ntoh functions are used
|
||||
|
||||
- _s function variants should only be used if _MSC_VER, use _r variants with
|
||||
MinGW (and define _POSIX_C_SOURCE to ensure they are prototyped)
|
||||
|
||||
- Don't try to build upload tools, dump_syms_dwarf for MinGW
|
||||
|
||||
(Part of https://breakpad.appspot.com/548002 was commited as svn r1399 to
|
||||
fix breakpad client compilation for MinGW
|
||||
|
||||
This is mainly the configure.ac and Makefile.am changes left over from
|
||||
https://breakpad.appspot.com/548002/ with a bit of updating, to fix building
|
||||
of the minidump processor library and tools for MinGW)
|
||||
|
||||
v2:
|
||||
Use _POSIX_C_SOURCE not _POSIX to enable *_r() prototypes in headers
|
||||
|
||||
The headers seem to have changed so localtime_r() prototype is now guarded
|
||||
by _POSIX_C_SOURCE
|
||||
|
||||
This seems right anyhow as _POSIX_C_SOURCE is what SUS defines, whereas I
|
||||
think _POSIX is some left-over Interix thing?
|
||||
|
||||
v3:
|
||||
Drop _snprintf fix, now dealt with centrally and correctly since 48673cdb
|
||||
|
||||
Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
|
||||
---
|
||||
Makefile.am | 20 +++++++++++++++++---
|
||||
configure.ac | 6 ++++++
|
||||
src/processor/logging.cc | 2 +-
|
||||
src/processor/minidump.cc | 2 +-
|
||||
4 files changed, 25 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/Makefile.am b/Makefile.am
|
||||
index 0f6388f1..f3b1fc6c 100644
|
||||
--- a/Makefile.am
|
||||
+++ b/Makefile.am
|
||||
@@ -56,6 +56,11 @@ if WINDOWS_HOST
|
||||
AM_CPPFLAGS += -DNO_STABS_SUPPORT
|
||||
endif
|
||||
|
||||
+if MINGW_HOST
|
||||
+SOCKET_LIBS = -lws2_32
|
||||
+AM_CPPFLAGS += -D_POSIX_C_SOURCE
|
||||
+endif
|
||||
+
|
||||
# Specify include paths for ac macros
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
|
||||
@@ -351,11 +356,13 @@ 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 += \
|
||||
@@ -376,11 +383,13 @@ endif
|
||||
endif LINUX_HOST
|
||||
|
||||
if WINDOWS_HOST
|
||||
+if !MINGW_HOST
|
||||
if !DISABLE_TOOLS
|
||||
bin_PROGRAMS += \
|
||||
src/tools/windows/dump_syms_dwarf/dump_syms
|
||||
endif
|
||||
endif
|
||||
+endif
|
||||
|
||||
## Tests
|
||||
if !DISABLE_PROCESSOR
|
||||
@@ -794,6 +803,7 @@ src_tools_linux_md2core_minidump_2_core_unittest_LDADD = \
|
||||
endif LINUX_HOST
|
||||
|
||||
if WINDOWS_HOST
|
||||
+if !MINGW_HOST
|
||||
if !DISABLE_TOOLS
|
||||
src_tools_windows_dump_syms_dwarf_dump_syms_SOURCES = \
|
||||
src/common/dwarf_cfi_to_module.cc \
|
||||
@@ -811,6 +821,7 @@ src_tools_windows_dump_syms_dwarf_dump_syms_SOURCES = \
|
||||
src/tools/windows/dump_syms_dwarf/dump_syms.cc
|
||||
endif
|
||||
endif
|
||||
+endif
|
||||
|
||||
if !DISABLE_PROCESSOR
|
||||
src_processor_address_map_unittest_SOURCES = \
|
||||
@@ -1250,7 +1261,8 @@ src_processor_minidump_dump_LDADD = \
|
||||
src/processor/logging.o \
|
||||
src/processor/minidump.o \
|
||||
src/processor/pathname_stripper.o \
|
||||
- src/processor/proc_maps_linux.o
|
||||
+ src/processor/proc_maps_linux.o \
|
||||
+ $(PTHREAD_CFLAGS) $(PTHREAD_LIBS)
|
||||
|
||||
src_processor_microdump_stackwalk_SOURCES = \
|
||||
src/processor/microdump_stackwalk.cc
|
||||
@@ -1285,7 +1297,8 @@ src_processor_microdump_stackwalk_LDADD = \
|
||||
src/processor/stackwalker_sparc.o \
|
||||
src/processor/stackwalker_x86.o \
|
||||
src/processor/tokenize.o \
|
||||
- src/third_party/libdisasm/libdisasm.a
|
||||
+ src/third_party/libdisasm/libdisasm.a \
|
||||
+ $(PTHREAD_CFLAGS) $(PTHREAD_LIBS) $(SOCKET_LIBS)
|
||||
|
||||
src_processor_minidump_stackwalk_SOURCES = \
|
||||
src/processor/minidump_stackwalk.cc
|
||||
@@ -1325,7 +1338,8 @@ src_processor_minidump_stackwalk_LDADD = \
|
||||
src/processor/stackwalker_x86.o \
|
||||
src/processor/symbolic_constants_win.o \
|
||||
src/processor/tokenize.o \
|
||||
- src/third_party/libdisasm/libdisasm.a
|
||||
+ src/third_party/libdisasm/libdisasm.a \
|
||||
+ $(PTHREAD_CFLAGS) $(PTHREAD_LIBS) $(SOCKET_LIBS)
|
||||
|
||||
endif !DISABLE_PROCESSOR
|
||||
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index 63b32bdd..e50d2c22 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -113,10 +113,16 @@ case $host in
|
||||
*-*-cygwin* )
|
||||
WINDOWS_HOST=true
|
||||
;;
|
||||
+ *-*-mingw* )
|
||||
+ WINDOWS_HOST=true
|
||||
+ MINGW_HOST=true
|
||||
+ ;;
|
||||
esac
|
||||
|
||||
AM_CONDITIONAL(LINUX_HOST, test x$LINUX_HOST = xtrue)
|
||||
+# WINDOWS_HOST means MINGW or CYGWIN
|
||||
AM_CONDITIONAL(WINDOWS_HOST, test x$WINDOWS_HOST = xtrue)
|
||||
+AM_CONDITIONAL(MINGW_HOST, test x$MINGW_HOST = xtrue)
|
||||
|
||||
# Only use Android support headers when compiling for Android
|
||||
case $host in
|
||||
diff --git a/src/processor/logging.cc b/src/processor/logging.cc
|
||||
index d59175a7..96772eb1 100644
|
||||
--- a/src/processor/logging.cc
|
||||
+++ b/src/processor/logging.cc
|
||||
@@ -53,7 +53,7 @@ LogStream::LogStream(std::ostream &stream, Severity severity,
|
||||
time_t clock;
|
||||
time(&clock);
|
||||
struct tm tm_struct;
|
||||
-#ifdef _WIN32
|
||||
+#ifdef _MSC_VER
|
||||
localtime_s(&tm_struct, &clock);
|
||||
#else
|
||||
localtime_r(&clock, &tm_struct);
|
||||
diff --git a/src/processor/minidump.cc b/src/processor/minidump.cc
|
||||
index 78faf77a..f6b31db5 100644
|
||||
--- a/src/processor/minidump.cc
|
||||
+++ b/src/processor/minidump.cc
|
||||
@@ -387,7 +387,7 @@ void PrintValueOrInvalid(bool valid,
|
||||
// Converts a time_t to a string showing the time in UTC.
|
||||
string TimeTToUTCString(time_t tt) {
|
||||
struct tm timestruct;
|
||||
-#ifdef _WIN32
|
||||
+#ifdef _MSC_VER
|
||||
gmtime_s(×truct, &tt);
|
||||
#else
|
||||
gmtime_r(&tt, ×truct);
|
||||
--
|
||||
2.28.0
|
||||
|
@ -0,0 +1,139 @@
|
||||
From 4d138502a2b015a076c77df3d8bfce40bc865e49 Mon Sep 17 00:00:00 2001
|
||||
From: Jon Turney <jon.turney@dronecode.org.uk>
|
||||
Date: Wed, 5 Feb 2014 13:44:01 +0000
|
||||
Subject: [PATCH 06/19] Build PECOFF/DWARF dump_syms for MinGW
|
||||
|
||||
- Substitute MapViewOfFile() for mmap()
|
||||
- Link dump_syms_dwarf with ws2_32 as ntoh functions are used
|
||||
|
||||
v2:
|
||||
Add needed include of windows.h
|
||||
|
||||
Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
|
||||
---
|
||||
Makefile.am | 6 ++---
|
||||
src/common/pecoff/dump_symbols-inl.h | 40 +++++++++++++++++++++++-----
|
||||
2 files changed, 36 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/Makefile.am b/Makefile.am
|
||||
index f3b1fc6c..712a2fd5 100644
|
||||
--- a/Makefile.am
|
||||
+++ b/Makefile.am
|
||||
@@ -383,13 +383,11 @@ endif
|
||||
endif LINUX_HOST
|
||||
|
||||
if WINDOWS_HOST
|
||||
-if !MINGW_HOST
|
||||
if !DISABLE_TOOLS
|
||||
bin_PROGRAMS += \
|
||||
src/tools/windows/dump_syms_dwarf/dump_syms
|
||||
endif
|
||||
endif
|
||||
-endif
|
||||
|
||||
## Tests
|
||||
if !DISABLE_PROCESSOR
|
||||
@@ -803,7 +801,6 @@ src_tools_linux_md2core_minidump_2_core_unittest_LDADD = \
|
||||
endif LINUX_HOST
|
||||
|
||||
if WINDOWS_HOST
|
||||
-if !MINGW_HOST
|
||||
if !DISABLE_TOOLS
|
||||
src_tools_windows_dump_syms_dwarf_dump_syms_SOURCES = \
|
||||
src/common/dwarf_cfi_to_module.cc \
|
||||
@@ -819,7 +816,8 @@ src_tools_windows_dump_syms_dwarf_dump_syms_SOURCES = \
|
||||
src/common/pecoff/pecoffutils.cc \
|
||||
src/common/pecoff/pecoff_file_id.cc \
|
||||
src/tools/windows/dump_syms_dwarf/dump_syms.cc
|
||||
-endif
|
||||
+src_tools_windows_dump_syms_dwarf_dump_syms_LDADD = \
|
||||
+ $(SOCKET_LIBS)
|
||||
endif
|
||||
endif
|
||||
|
||||
diff --git a/src/common/pecoff/dump_symbols-inl.h b/src/common/pecoff/dump_symbols-inl.h
|
||||
index 23955f6a..661097d2 100644
|
||||
--- a/src/common/pecoff/dump_symbols-inl.h
|
||||
+++ b/src/common/pecoff/dump_symbols-inl.h
|
||||
@@ -39,7 +39,11 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
+#ifndef _WIN32
|
||||
#include <sys/mman.h>
|
||||
+#else
|
||||
+#include <windows.h>
|
||||
+#endif
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <libgen.h>
|
||||
@@ -111,13 +115,37 @@ class MmapWrapper {
|
||||
~MmapWrapper() {
|
||||
if (is_set_ && base_ != NULL) {
|
||||
assert(size_ > 0);
|
||||
+#ifndef _WIN32
|
||||
munmap(base_, size_);
|
||||
+#else
|
||||
+ UnmapViewOfFile(base_);
|
||||
+ CloseHandle(hMap_);
|
||||
+#endif
|
||||
}
|
||||
}
|
||||
- void set(void *mapped_address, size_t mapped_size) {
|
||||
+ void *set(int obj_fd, size_t mapped_size) {
|
||||
+#ifndef _WIN32
|
||||
+ void *mapped_address = mmap(NULL, mapped_size,
|
||||
+ PROT_READ | PROT_WRITE, MAP_PRIVATE, obj_fd, 0);
|
||||
+ if (mapped_address == MAP_FAILED)
|
||||
+ return NULL;
|
||||
+#else
|
||||
+ HANDLE h = (HANDLE)_get_osfhandle(obj_fd);
|
||||
+ hMap_ = CreateFileMapping(h, NULL, PAGE_READONLY,0, 0, NULL);
|
||||
+ // XXX: should also use SEC_IMAGE_NO_EXECUTE on Windows 6.2 or later
|
||||
+ if (!hMap_) {
|
||||
+ return NULL;
|
||||
+ }
|
||||
+ void *mapped_address = MapViewOfFile(hMap_, FILE_MAP_READ, 0, 0, 0);
|
||||
+ if (!mapped_address) {
|
||||
+ CloseHandle(hMap_);
|
||||
+ return NULL;
|
||||
+ }
|
||||
+#endif
|
||||
is_set_ = true;
|
||||
base_ = mapped_address;
|
||||
size_ = mapped_size;
|
||||
+ return mapped_address;
|
||||
}
|
||||
void release() {
|
||||
assert(is_set_);
|
||||
@@ -130,6 +158,9 @@ class MmapWrapper {
|
||||
bool is_set_;
|
||||
void *base_;
|
||||
size_t size_;
|
||||
+#ifdef _WIN32
|
||||
+ HANDLE hMap_;
|
||||
+#endif
|
||||
};
|
||||
|
||||
#ifndef NO_STABS_SUPPORT
|
||||
@@ -330,15 +361,12 @@ bool LoadFile(const string& obj_file, MmapWrapper* map_wrapper,
|
||||
obj_file.c_str(), strerror(errno));
|
||||
return false;
|
||||
}
|
||||
- void *obj_base = mmap(NULL, st.st_size,
|
||||
- PROT_READ | PROT_WRITE, MAP_PRIVATE, obj_fd, 0);
|
||||
- if (obj_base == MAP_FAILED) {
|
||||
+ *header = map_wrapper->set(obj_fd, st.st_size);
|
||||
+ if (!(*header)) {
|
||||
fprintf(stderr, "Failed to mmap file '%s': %s\n",
|
||||
obj_file.c_str(), strerror(errno));
|
||||
return false;
|
||||
}
|
||||
- map_wrapper->set(obj_base, st.st_size);
|
||||
- *header = obj_base;
|
||||
return true;
|
||||
}
|
||||
|
||||
--
|
||||
2.28.0
|
||||
|
@ -0,0 +1,98 @@
|
||||
From 31dd92c4c1934894b9aef2c85075c539ad5fc104 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 07/19] 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 ++++
|
||||
.../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 712a2fd5..0eddd5ec 100644
|
||||
--- a/Makefile.am
|
||||
+++ b/Makefile.am
|
||||
@@ -356,13 +356,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.28.0
|
||||
|
@ -0,0 +1,43 @@
|
||||
From 556a68e03ba5995bd6857b49e77d05610cced6f8 Mon Sep 17 00:00:00 2001
|
||||
From: Jon Turney <jon.turney@dronecode.org.uk>
|
||||
Date: Thu, 13 Feb 2014 01:06:51 +0000
|
||||
Subject: [PATCH 08/19] Fix common.gypi to allow gyp to generate Makefiles on
|
||||
Windows
|
||||
|
||||
The MSVS_VERSION variable does not exist unless we are using the MSVS generator
|
||||
|
||||
Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
|
||||
---
|
||||
src/build/common.gypi | 8 ++++++--
|
||||
1 file changed, 6 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/build/common.gypi b/src/build/common.gypi
|
||||
index 29990c65..6af4be67 100644
|
||||
--- a/src/build/common.gypi
|
||||
+++ b/src/build/common.gypi
|
||||
@@ -206,9 +206,9 @@
|
||||
# Whether to use multiple cores to compile with visual studio. This is
|
||||
# optional because it sometimes causes corruption on VS 2005.
|
||||
# It is on by default on VS 2008 and off on VS 2005.
|
||||
- ['OS=="win"', {
|
||||
+ ['"<(GENERATOR)" == "msvs"', {
|
||||
'conditions': [
|
||||
- ['MSVS_VERSION=="2005"', {
|
||||
+ [ 'MSVS_VERSION=="2005"', {
|
||||
'msvs_multi_core_compile%': 0,
|
||||
},{
|
||||
'msvs_multi_core_compile%': 1,
|
||||
@@ -225,6 +225,10 @@
|
||||
# Native Client loader for 64-bit Windows.
|
||||
'NACL_WIN64',
|
||||
],
|
||||
+ },
|
||||
+ {
|
||||
+ # XXX: because value is used below...
|
||||
+ 'msvs_multi_core_compile%': 0,
|
||||
}],
|
||||
],
|
||||
|
||||
--
|
||||
2.28.0
|
||||
|
@ -0,0 +1,165 @@
|
||||
From c2929728b60c9d5051acbce095d44da946cc080f Mon Sep 17 00:00:00 2001
|
||||
From: Jon Turney <jon.turney@dronecode.org.uk>
|
||||
Date: Mon, 10 Feb 2014 18:12:14 +0000
|
||||
Subject: [PATCH 09/19] Teach gyp generated Makefile to build
|
||||
crash_generation_app correctly
|
||||
|
||||
- Use linker flag for Windows subsystem
|
||||
- Use linker flag for unicode
|
||||
- Add rule for compiling windows resources, using $RC to name the resource compiler
|
||||
- Rename crash_generation_app.rc to avoid a clash in corresponding .o names
|
||||
|
||||
Also
|
||||
- Fix linking of unit test when built using gyp generated Makefile by providing
|
||||
needed library
|
||||
|
||||
XXX: We need to arrange for the gyp Makefile generator to set
|
||||
CXXFLAGS="-DUNICODE -D_UNICODE" somewhere when generating for Windows. This is
|
||||
already done in generated MSVS projects.
|
||||
|
||||
Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
|
||||
---
|
||||
.../crash_generation_app.gyp | 29 ++++++++++++++++---
|
||||
.../{crash_generation_app.rc => resource.rc} | 13 ++++-----
|
||||
src/client/windows/unittests/client_tests.gyp | 12 ++++++--
|
||||
3 files changed, 41 insertions(+), 13 deletions(-)
|
||||
rename src/client/windows/tests/crash_generation_app/{crash_generation_app.rc => resource.rc} (96%)
|
||||
|
||||
diff --git a/src/client/windows/tests/crash_generation_app/crash_generation_app.gyp b/src/client/windows/tests/crash_generation_app/crash_generation_app.gyp
|
||||
index 3ce307da..774f6004 100644
|
||||
--- a/src/client/windows/tests/crash_generation_app/crash_generation_app.gyp
|
||||
+++ b/src/client/windows/tests/crash_generation_app/crash_generation_app.gyp
|
||||
@@ -40,19 +40,40 @@
|
||||
'crash_generation_app.cc',
|
||||
'crash_generation_app.h',
|
||||
'crash_generation_app.ico',
|
||||
- 'crash_generation_app.rc',
|
||||
+ 'resource.rc',
|
||||
'resource.h',
|
||||
'small.ico',
|
||||
],
|
||||
- 'libraries': [
|
||||
- 'user32.lib',
|
||||
- ],
|
||||
'dependencies': [
|
||||
'../../breakpad_client.gyp:common',
|
||||
'../../crash_generation/crash_generation.gyp:crash_generation_server',
|
||||
'../../crash_generation/crash_generation.gyp:crash_generation_client',
|
||||
'../../handler/exception_handler.gyp:exception_handler',
|
||||
],
|
||||
+ 'conditions': [
|
||||
+ [ '"<(GENERATOR)" == "make"', {
|
||||
+ 'ldflags': [
|
||||
+ '-Wl,--subsystem=2', '-municode'
|
||||
+ ],
|
||||
+ 'rules': [
|
||||
+ { 'rule_name': 'windres',
|
||||
+ 'extension': 'rc',
|
||||
+ 'inputs' : [ ],
|
||||
+ 'outputs' : [ '$(builddir)/<(RULE_INPUT_ROOT).o' ],
|
||||
+ 'action' : [ '$(RC)', '--input=<(RULE_INPUT_PATH)', '--output=$(builddir)/<(RULE_INPUT_ROOT).o', '--input-format=rc', '--output-format=coff', '-v', '--use-temp-file' ],
|
||||
+ 'message' : 'Compiling Windows resources',
|
||||
+ 'process_outputs_as_sources' : 1,
|
||||
+ },
|
||||
+ ],
|
||||
+ }
|
||||
+ ],
|
||||
+ [ '"<(GENERATOR)" == "msvs"', {
|
||||
+ 'libraries': [
|
||||
+ 'user32.lib',
|
||||
+ ],
|
||||
+ }
|
||||
+ ]
|
||||
+ ],
|
||||
'msvs_settings': {
|
||||
'VCLinkerTool': {
|
||||
'SubSystem': '2', # Windows Subsystem as opposed to a console app
|
||||
diff --git a/src/client/windows/tests/crash_generation_app/crash_generation_app.rc b/src/client/windows/tests/crash_generation_app/resource.rc
|
||||
similarity index 96%
|
||||
rename from src/client/windows/tests/crash_generation_app/crash_generation_app.rc
|
||||
rename to src/client/windows/tests/crash_generation_app/resource.rc
|
||||
index a362562b..6c7e8b63 100644
|
||||
--- a/src/client/windows/tests/crash_generation_app/crash_generation_app.rc
|
||||
+++ b/src/client/windows/tests/crash_generation_app/resource.rc
|
||||
@@ -38,7 +38,7 @@ IDI_SMALL ICON "small.ico"
|
||||
// Menu
|
||||
//
|
||||
|
||||
-IDC_CRASHGENERATIONAPP MENU
|
||||
+IDC_CRASHGENERATIONAPP MENU
|
||||
BEGIN
|
||||
POPUP "&File"
|
||||
BEGIN
|
||||
@@ -64,7 +64,7 @@ END
|
||||
// Accelerator
|
||||
//
|
||||
|
||||
-IDC_CRASHGENERATIONAPP ACCELERATORS
|
||||
+IDC_CRASHGENERATIONAPP ACCELERATORS
|
||||
BEGIN
|
||||
"?", IDM_ABOUT, ASCII, ALT
|
||||
"/", IDM_ABOUT, ASCII, ALT
|
||||
@@ -94,12 +94,12 @@ END
|
||||
// TEXTINCLUDE
|
||||
//
|
||||
|
||||
-1 TEXTINCLUDE
|
||||
+1 TEXTINCLUDE
|
||||
BEGIN
|
||||
"resource.h\0"
|
||||
END
|
||||
|
||||
-2 TEXTINCLUDE
|
||||
+2 TEXTINCLUDE
|
||||
BEGIN
|
||||
"#define APSTUDIO_HIDDEN_SYMBOLS\r\n"
|
||||
"#include ""windows.h""\r\n"
|
||||
@@ -107,7 +107,7 @@ BEGIN
|
||||
"\0"
|
||||
END
|
||||
|
||||
-3 TEXTINCLUDE
|
||||
+3 TEXTINCLUDE
|
||||
BEGIN
|
||||
"\r\n"
|
||||
"\0"
|
||||
@@ -121,7 +121,7 @@ END
|
||||
// String Table
|
||||
//
|
||||
|
||||
-STRINGTABLE
|
||||
+STRINGTABLE
|
||||
BEGIN
|
||||
IDS_APP_TITLE "CrashGenerationApp"
|
||||
IDC_CRASHGENERATIONAPP "CRASHGENERATIONAPP"
|
||||
@@ -141,4 +141,3 @@ END
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif // not APSTUDIO_INVOKED
|
||||
-
|
||||
diff --git a/src/client/windows/unittests/client_tests.gyp b/src/client/windows/unittests/client_tests.gyp
|
||||
index 768f8fd8..87caf8d6 100644
|
||||
--- a/src/client/windows/unittests/client_tests.gyp
|
||||
+++ b/src/client/windows/unittests/client_tests.gyp
|
||||
@@ -51,8 +51,16 @@
|
||||
'../crash_generation/crash_generation.gyp:crash_generation_server',
|
||||
'../crash_generation/crash_generation.gyp:crash_generation_client',
|
||||
'../handler/exception_handler.gyp:exception_handler',
|
||||
- 'processor_bits',
|
||||
- ]
|
||||
+ 'processor_bits',
|
||||
+ ],
|
||||
+ 'conditions': [
|
||||
+ [ '"<(GENERATOR)" == "make"', {
|
||||
+ 'libraries': [
|
||||
+ '-ldbghelp', '-lversion', '-lpthread',
|
||||
+ ],
|
||||
+ },
|
||||
+ ],
|
||||
+ ],
|
||||
},
|
||||
{
|
||||
'target_name': 'processor_bits',
|
||||
--
|
||||
2.28.0
|
||||
|
@ -0,0 +1,94 @@
|
||||
From 21428ac6a1c9c2c0c6d682b2cec8b974864283c0 Mon Sep 17 00:00:00 2001
|
||||
From: Jon Turney <jon.turney@dronecode.org.uk>
|
||||
Date: Fri, 7 Feb 2014 23:03:10 +0000
|
||||
Subject: [PATCH 10/19] Default debug_file to the code_file basename
|
||||
|
||||
Strip any path from code_file, and use that as debug_file if one isn't recorded
|
||||
in the codeview record.
|
||||
|
||||
The current implementation of 'ld --build-id' doesn't write a pdbfilename in the
|
||||
codeview record, not least because we don't have such a thing.
|
||||
|
||||
The minidump processor requires both debug_file and debug_identifier (the
|
||||
build-id) to locate the symbol file.
|
||||
|
||||
v2:
|
||||
Correctly make debug-file a basename when code-file has a windows-style path
|
||||
Fix by Ivan Gubarev
|
||||
|
||||
v3:
|
||||
Fix a test which expects the previous behaviour
|
||||
|
||||
v4:
|
||||
Fix new tests which expect the previous behaviour
|
||||
|
||||
Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
|
||||
---
|
||||
src/processor/minidump.cc | 14 ++++++++++++++
|
||||
src/processor/minidump_unittest.cc | 4 ++--
|
||||
src/processor/testdata/minidump2.dump.out | 2 +-
|
||||
3 files changed, 17 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/processor/minidump.cc b/src/processor/minidump.cc
|
||||
index f6b31db5..f802210e 100644
|
||||
--- a/src/processor/minidump.cc
|
||||
+++ b/src/processor/minidump.cc
|
||||
@@ -2144,6 +2144,20 @@ string MinidumpModule::debug_file() const {
|
||||
}
|
||||
}
|
||||
|
||||
+ // Manufacture debug-file from code-file
|
||||
+ if (file.empty()) {
|
||||
+ file = code_file();
|
||||
+
|
||||
+ BPLOG(INFO) << "Generated debug_file '" << file << "' from code_file '" << *name_ << "'";
|
||||
+ }
|
||||
+
|
||||
+ // This may be a windows-style pathname, so find the basename considering both
|
||||
+ // forward and back-slashes.
|
||||
+ const size_t last_slash_idx = file.find_last_of("\\/");
|
||||
+ if (std::string::npos != last_slash_idx) {
|
||||
+ file.erase(0, last_slash_idx + 1);
|
||||
+ }
|
||||
+
|
||||
// Relatively common case
|
||||
BPLOG_IF(INFO, file.empty()) << "MinidumpModule could not determine "
|
||||
"debug_file for " << *name_;
|
||||
diff --git a/src/processor/minidump_unittest.cc b/src/processor/minidump_unittest.cc
|
||||
index 036d03f1..35091396 100644
|
||||
--- a/src/processor/minidump_unittest.cc
|
||||
+++ b/src/processor/minidump_unittest.cc
|
||||
@@ -100,7 +100,7 @@ TEST_F(MinidumpTest, TestMinidumpFromFile) {
|
||||
const MinidumpModule *md_module = md_module_list->GetModuleAtIndex(0);
|
||||
ASSERT_TRUE(md_module != NULL);
|
||||
ASSERT_EQ("c:\\test_app.exe", md_module->code_file());
|
||||
- ASSERT_EQ("c:\\test_app.pdb", md_module->debug_file());
|
||||
+ ASSERT_EQ("test_app.pdb", md_module->debug_file());
|
||||
ASSERT_EQ("45D35F6C2d000", md_module->code_identifier());
|
||||
ASSERT_EQ("5A9832E5287241C1838ED98914E9B7FF1", md_module->debug_identifier());
|
||||
}
|
||||
@@ -519,7 +519,7 @@ TEST(Dump, OneModule) {
|
||||
ASSERT_EQ(0xa90206ca83eb2852ULL, md_module->base_address());
|
||||
ASSERT_EQ(0xada542bd, md_module->size());
|
||||
ASSERT_EQ("single module", md_module->code_file());
|
||||
- ASSERT_EQ("c:\\foo\\file.pdb", md_module->debug_file());
|
||||
+ ASSERT_EQ("file.pdb", md_module->debug_file());
|
||||
// time_date_stamp and size_of_image concatenated
|
||||
ASSERT_EQ("B1054D2Aada542bd", md_module->code_identifier());
|
||||
ASSERT_EQ("ABCD1234F00DBEEF01020304050607081", md_module->debug_identifier());
|
||||
diff --git a/src/processor/testdata/minidump2.dump.out b/src/processor/testdata/minidump2.dump.out
|
||||
index 8585c89b..e8140fec 100644
|
||||
--- a/src/processor/testdata/minidump2.dump.out
|
||||
+++ b/src/processor/testdata/minidump2.dump.out
|
||||
@@ -207,7 +207,7 @@ MDRawModule
|
||||
(cv_record).age = 1
|
||||
(cv_record).pdb_file_name = "c:\test_app.pdb"
|
||||
(misc_record) = (null)
|
||||
- (debug_file) = "c:\test_app.pdb"
|
||||
+ (debug_file) = "test_app.pdb"
|
||||
(debug_identifier) = "5A9832E5287241C1838ED98914E9B7FF1"
|
||||
(version) = ""
|
||||
|
||||
--
|
||||
2.28.0
|
||||
|
@ -0,0 +1,147 @@
|
||||
From 036f9b82792f073f97d36cac71855a5f8a064f0d Mon Sep 17 00:00:00 2001
|
||||
From: Jon Turney <jon.turney@dronecode.org.uk>
|
||||
Date: Tue, 11 Feb 2014 23:48:28 +0000
|
||||
Subject: [PATCH 11/19] Fix Windows client unit-tests with gcc
|
||||
|
||||
- MinGW doesn't have _CrtSetReportMode
|
||||
|
||||
- Trying to call PureVirtual() on a base class object give a linker error
|
||||
|
||||
Use more elaborate contortions to write a pure virtual call that gcc doesn't
|
||||
spot at compile-time, to provoke a run-time failure (copied from
|
||||
crash_generation_app)
|
||||
|
||||
Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
|
||||
---
|
||||
.../unittests/exception_handler_death_test.cc | 28 +++++++++++++------
|
||||
.../unittests/exception_handler_test.cc | 28 +++++++++++++------
|
||||
2 files changed, 38 insertions(+), 18 deletions(-)
|
||||
|
||||
diff --git a/src/client/windows/unittests/exception_handler_death_test.cc b/src/client/windows/unittests/exception_handler_death_test.cc
|
||||
index 5ef9e64d..530f05d8 100644
|
||||
--- a/src/client/windows/unittests/exception_handler_death_test.cc
|
||||
+++ b/src/client/windows/unittests/exception_handler_death_test.cc
|
||||
@@ -242,29 +242,37 @@ TEST_F(ExceptionHandlerDeathTest, InvalidParameterTest) {
|
||||
ExceptionHandler handler(temp_path_, NULL, NULL, NULL,
|
||||
ExceptionHandler::HANDLER_INVALID_PARAMETER);
|
||||
|
||||
+#ifdef _MSC_VER
|
||||
// Disable the message box for assertions
|
||||
_CrtSetReportMode(_CRT_ASSERT, 0);
|
||||
+#endif
|
||||
|
||||
// Call with a bad argument. The invalid parameter will be swallowed
|
||||
// and a dump will be generated, the process will exit(0).
|
||||
ASSERT_EXIT(printf(NULL), ::testing::ExitedWithCode(0), "");
|
||||
}
|
||||
|
||||
+struct PureVirtualCall;
|
||||
|
||||
struct PureVirtualCallBase {
|
||||
- PureVirtualCallBase() {
|
||||
- // We have to reinterpret so the linker doesn't get confused because the
|
||||
- // method isn't defined.
|
||||
- reinterpret_cast<PureVirtualCallBase*>(this)->PureFunction();
|
||||
- }
|
||||
- virtual ~PureVirtualCallBase() {}
|
||||
- virtual void PureFunction() const = 0;
|
||||
+ PureVirtualCallBase(PureVirtualCall* derived) : derived_(derived) {}
|
||||
+ virtual ~PureVirtualCallBase();
|
||||
+ virtual void DoSomething() = 0;
|
||||
+
|
||||
+ private:
|
||||
+ PureVirtualCall* derived_;
|
||||
};
|
||||
+
|
||||
struct PureVirtualCall : public PureVirtualCallBase {
|
||||
- PureVirtualCall() { PureFunction(); }
|
||||
- virtual void PureFunction() const {}
|
||||
+ PureVirtualCall() : PureVirtualCallBase(this) {}
|
||||
+ virtual void DoSomething() {}
|
||||
};
|
||||
|
||||
+PureVirtualCallBase:: ~PureVirtualCallBase()
|
||||
+{
|
||||
+ derived_->DoSomething();
|
||||
+}
|
||||
+
|
||||
void ExceptionHandlerDeathTest::DoCrashPureVirtualCall() {
|
||||
PureVirtualCall instance;
|
||||
}
|
||||
@@ -276,8 +284,10 @@ TEST_F(ExceptionHandlerDeathTest, PureVirtualCallTest) {
|
||||
ExceptionHandler handler(temp_path_, NULL, NULL, NULL,
|
||||
ExceptionHandler::HANDLER_PURECALL);
|
||||
|
||||
+#ifdef _MSC_VER
|
||||
// Disable the message box for assertions
|
||||
_CrtSetReportMode(_CRT_ASSERT, 0);
|
||||
+#endif
|
||||
|
||||
// Calls a pure virtual function.
|
||||
EXPECT_EXIT(DoCrashPureVirtualCall(), ::testing::ExitedWithCode(0), "");
|
||||
diff --git a/src/client/windows/unittests/exception_handler_test.cc b/src/client/windows/unittests/exception_handler_test.cc
|
||||
index a4ce12a8..0f5801b1 100644
|
||||
--- a/src/client/windows/unittests/exception_handler_test.cc
|
||||
+++ b/src/client/windows/unittests/exception_handler_test.cc
|
||||
@@ -180,8 +180,10 @@ void ExceptionHandlerTest::DoCrashInvalidParameter() {
|
||||
google_breakpad::ExceptionHandler::HANDLER_INVALID_PARAMETER,
|
||||
kFullDumpType, kPipeName, NULL);
|
||||
|
||||
+#ifdef _MSC_VER
|
||||
// Disable the message box for assertions
|
||||
_CrtSetReportMode(_CRT_ASSERT, 0);
|
||||
+#endif
|
||||
|
||||
// Although this is executing in the child process of the death test,
|
||||
// if it's not true we'll still get an error rather than the crash
|
||||
@@ -190,21 +192,27 @@ void ExceptionHandlerTest::DoCrashInvalidParameter() {
|
||||
printf(NULL);
|
||||
}
|
||||
|
||||
+struct PureVirtualCall;
|
||||
|
||||
struct PureVirtualCallBase {
|
||||
- PureVirtualCallBase() {
|
||||
- // We have to reinterpret so the linker doesn't get confused because the
|
||||
- // method isn't defined.
|
||||
- reinterpret_cast<PureVirtualCallBase*>(this)->PureFunction();
|
||||
- }
|
||||
- virtual ~PureVirtualCallBase() {}
|
||||
- virtual void PureFunction() const = 0;
|
||||
+ PureVirtualCallBase(PureVirtualCall* derived) : derived_(derived) {}
|
||||
+ virtual ~PureVirtualCallBase();
|
||||
+ virtual void DoSomething() = 0;
|
||||
+
|
||||
+ private:
|
||||
+ PureVirtualCall* derived_;
|
||||
};
|
||||
+
|
||||
struct PureVirtualCall : public PureVirtualCallBase {
|
||||
- PureVirtualCall() { PureFunction(); }
|
||||
- virtual void PureFunction() const {}
|
||||
+ PureVirtualCall() : PureVirtualCallBase(this) {}
|
||||
+ virtual void DoSomething() {}
|
||||
};
|
||||
|
||||
+PureVirtualCallBase:: ~PureVirtualCallBase()
|
||||
+{
|
||||
+ derived_->DoSomething();
|
||||
+}
|
||||
+
|
||||
void ExceptionHandlerTest::DoCrashPureVirtualCall() {
|
||||
google_breakpad::ExceptionHandler *exc =
|
||||
new google_breakpad::ExceptionHandler(
|
||||
@@ -212,8 +220,10 @@ void ExceptionHandlerTest::DoCrashPureVirtualCall() {
|
||||
google_breakpad::ExceptionHandler::HANDLER_PURECALL,
|
||||
kFullDumpType, kPipeName, NULL);
|
||||
|
||||
+#ifdef _MSC_VER
|
||||
// Disable the message box for assertions
|
||||
_CrtSetReportMode(_CRT_ASSERT, 0);
|
||||
+#endif
|
||||
|
||||
// Although this is executing in the child process of the death test,
|
||||
// if it's not true we'll still get an error rather than the crash
|
||||
--
|
||||
2.28.0
|
||||
|
187
recipes/breakpad/all/patches/0012-Add-symsrv_convert.patch
Normal file
187
recipes/breakpad/all/patches/0012-Add-symsrv_convert.patch
Normal file
@ -0,0 +1,187 @@
|
||||
From 2fb8571457a3e9a8f7c434ba197eb66f2ec959da Mon Sep 17 00:00:00 2001
|
||||
From: Jon Turney <jon.turney@dronecode.org.uk>
|
||||
Date: Sun, 3 Aug 2014 23:44:28 +0100
|
||||
Subject: [PATCH 12/19] Add symsrv_convert
|
||||
|
||||
- Add symsrv_convert from http://hg.mozilla.org/users/tmielczarek_mozilla.com/fetch-win32-symbols/
|
||||
- Add building symsrv_convert to .gyp file
|
||||
- Fix compilation with MSVS 2013
|
||||
- NOMINMAX should not be needed as that comes from target_defaults
|
||||
|
||||
v2:
|
||||
Update symsrv_convert.cc for
|
||||
MSSymbolServerConverter::LocateAndConvertSymbolFile() changes
|
||||
|
||||
This has been needed for a few years...
|
||||
|
||||
Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
|
||||
---
|
||||
src/common/windows/common_windows.gyp | 2 +-
|
||||
src/common/windows/pdb_source_line_writer.cc | 6 ++
|
||||
.../converter/ms_symbol_server_converter.cc | 2 +-
|
||||
.../converter/ms_symbol_server_converter.gyp | 13 ++++
|
||||
.../converter/ms_symbol_server_converter.h | 4 +-
|
||||
src/tools/windows/converter/symsrv_convert.cc | 61 +++++++++++++++++++
|
||||
6 files changed, 84 insertions(+), 4 deletions(-)
|
||||
mode change 100644 => 100755 src/common/windows/pdb_source_line_writer.cc
|
||||
mode change 100644 => 100755 src/tools/windows/converter/ms_symbol_server_converter.cc
|
||||
mode change 100644 => 100755 src/tools/windows/converter/ms_symbol_server_converter.h
|
||||
create mode 100644 src/tools/windows/converter/symsrv_convert.cc
|
||||
|
||||
diff --git a/src/common/windows/common_windows.gyp b/src/common/windows/common_windows.gyp
|
||||
index 5f7594b1..ec42cade 100644
|
||||
--- a/src/common/windows/common_windows.gyp
|
||||
+++ b/src/common/windows/common_windows.gyp
|
||||
@@ -37,7 +37,7 @@
|
||||
'all_dependent_settings': {
|
||||
'include_dirs': [
|
||||
'<(DEPTH)',
|
||||
- '$(VSInstallDir)/DIA SDK/include',
|
||||
+ '"$(VSInstallDir)/DIA SDK/include"',
|
||||
],
|
||||
'msvs_settings': {
|
||||
'VCLinkerTool': {
|
||||
diff --git a/src/common/windows/pdb_source_line_writer.cc b/src/common/windows/pdb_source_line_writer.cc
|
||||
old mode 100644
|
||||
new mode 100755
|
||||
index 4030a2e9..a3622d3d
|
||||
--- a/src/common/windows/pdb_source_line_writer.cc
|
||||
+++ b/src/common/windows/pdb_source_line_writer.cc
|
||||
@@ -27,6 +27,12 @@
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
+// We don't want windows.h to define the macro max() which collides with
|
||||
+// std::numeric_limits::max()
|
||||
+#ifndef NOMINMAX
|
||||
+#define NOMINMAX
|
||||
+#endif
|
||||
+
|
||||
#include "common/windows/pdb_source_line_writer.h"
|
||||
|
||||
#include <windows.h>
|
||||
diff --git a/src/tools/windows/converter/ms_symbol_server_converter.cc b/src/tools/windows/converter/ms_symbol_server_converter.cc
|
||||
old mode 100644
|
||||
new mode 100755
|
||||
index 2b40faee..f1cef404
|
||||
--- a/src/tools/windows/converter/ms_symbol_server_converter.cc
|
||||
+++ b/src/tools/windows/converter/ms_symbol_server_converter.cc
|
||||
@@ -478,7 +478,7 @@ BOOL CALLBACK MSSymbolServerConverter::SymCallback(HANDLE process,
|
||||
|
||||
// static
|
||||
BOOL CALLBACK MSSymbolServerConverter::SymFindFileInPathCallback(
|
||||
- const char *filename, void *context) {
|
||||
+ PCSTR filename, PVOID context) {
|
||||
// FALSE ends the search, indicating that the located symbol file is
|
||||
// satisfactory.
|
||||
return FALSE;
|
||||
diff --git a/src/tools/windows/converter/ms_symbol_server_converter.gyp b/src/tools/windows/converter/ms_symbol_server_converter.gyp
|
||||
index 57ec7906..d84be5c2 100644
|
||||
--- a/src/tools/windows/converter/ms_symbol_server_converter.gyp
|
||||
+++ b/src/tools/windows/converter/ms_symbol_server_converter.gyp
|
||||
@@ -42,5 +42,18 @@
|
||||
'../../../common/windows/common_windows.gyp:common_windows_lib',
|
||||
],
|
||||
},
|
||||
+ {
|
||||
+ 'target_name': 'symsrv_convert',
|
||||
+ 'type': 'executable',
|
||||
+ 'dependencies': [
|
||||
+ 'ms_symbol_server_converter'
|
||||
+ ],
|
||||
+ 'sources' : [
|
||||
+ 'symsrv_convert.cc',
|
||||
+ ],
|
||||
+ 'include_dirs': [
|
||||
+ '<(DEPTH)',
|
||||
+ ],
|
||||
+ }
|
||||
],
|
||||
}
|
||||
diff --git a/src/tools/windows/converter/ms_symbol_server_converter.h b/src/tools/windows/converter/ms_symbol_server_converter.h
|
||||
old mode 100644
|
||||
new mode 100755
|
||||
index 401f7c34..6d06cc7e
|
||||
--- a/src/tools/windows/converter/ms_symbol_server_converter.h
|
||||
+++ b/src/tools/windows/converter/ms_symbol_server_converter.h
|
||||
@@ -215,8 +215,8 @@ class MSSymbolServerConverter {
|
||||
// SymFindFileInPath actually seems to accept NULL for a callback function
|
||||
// and behave properly for our needs in that case, but the documentation
|
||||
// doesn't mention it, so this little callback is provided.
|
||||
- static BOOL CALLBACK SymFindFileInPathCallback(const char *filename,
|
||||
- void *context);
|
||||
+ static BOOL CALLBACK SymFindFileInPathCallback(PCSTR filename,
|
||||
+ PVOID context);
|
||||
|
||||
// The search path used by SymSrv, built based on the arguments to the
|
||||
// constructor.
|
||||
diff --git a/src/tools/windows/converter/symsrv_convert.cc b/src/tools/windows/converter/symsrv_convert.cc
|
||||
new file mode 100644
|
||||
index 00000000..4c2a21df
|
||||
--- /dev/null
|
||||
+++ b/src/tools/windows/converter/symsrv_convert.cc
|
||||
@@ -0,0 +1,61 @@
|
||||
+#include <cstdio>
|
||||
+#include <string>
|
||||
+#include <vector>
|
||||
+
|
||||
+#include "tools/windows/converter/ms_symbol_server_converter.h"
|
||||
+
|
||||
+using std::string;
|
||||
+using std::vector;
|
||||
+using google_breakpad::MissingSymbolInfo;
|
||||
+using google_breakpad::MSSymbolServerConverter;
|
||||
+
|
||||
+int main(int argc, char *argv[])
|
||||
+{
|
||||
+ if (argc < 5) {
|
||||
+ fprintf(stderr, "Usage: %s <symbol server> <symbol path> <debug file> <debug identifier>\n ", argv[0]);
|
||||
+ return 1;
|
||||
+ }
|
||||
+
|
||||
+ MissingSymbolInfo missing_info;
|
||||
+ missing_info.debug_file = argv[3];
|
||||
+ missing_info.debug_identifier = argv[4];
|
||||
+
|
||||
+ MSSymbolServerConverter converter(argv[2], vector<string>(1, argv[1]));
|
||||
+ string converted_file;
|
||||
+
|
||||
+ MSSymbolServerConverter::LocateResult result =
|
||||
+ converter.LocateAndConvertSymbolFile(missing_info,
|
||||
+ false,
|
||||
+ false,
|
||||
+ &converted_file,
|
||||
+ NULL,
|
||||
+ NULL);
|
||||
+ printf("%s: ", argv[3]);
|
||||
+ int return_code;
|
||||
+ switch(result) {
|
||||
+ case MSSymbolServerConverter::LOCATE_SUCCESS:
|
||||
+ printf("converted: %s\n", converted_file.c_str());
|
||||
+ return_code = 0;
|
||||
+ break;
|
||||
+
|
||||
+ case MSSymbolServerConverter::LOCATE_RETRY:
|
||||
+ printf("try again later\n");
|
||||
+ return_code = 1;
|
||||
+ break;
|
||||
+
|
||||
+ case MSSymbolServerConverter::LOCATE_FAILURE:
|
||||
+ case MSSymbolServerConverter::LOCATE_NOT_FOUND:
|
||||
+ printf("failed to locate symbols\n");
|
||||
+ return_code = 2;
|
||||
+ break;
|
||||
+
|
||||
+ default:
|
||||
+ // ???
|
||||
+ return_code = 3;
|
||||
+ break;
|
||||
+ }
|
||||
+ fflush(stdout);
|
||||
+ fflush(stderr);
|
||||
+
|
||||
+ return return_code;
|
||||
+}
|
||||
--
|
||||
2.28.0
|
||||
|
@ -0,0 +1,69 @@
|
||||
From 8beaee224cf0c2379d3f684123533b6e01006bbb Mon Sep 17 00:00:00 2001
|
||||
From: Jon Turney <jon.turney@dronecode.org.uk>
|
||||
Date: Sat, 22 Feb 2014 15:59:22 +0000
|
||||
Subject: [PATCH 13/19] Use a default debug-id of all zeros when no CV record
|
||||
is present
|
||||
|
||||
This lets us do something slightly useful with current binaries
|
||||
which are produced without a CV record, but there is no guarantee
|
||||
that the actually match.
|
||||
|
||||
Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
|
||||
---
|
||||
src/common/pecoff/pecoff_file_id.cc | 8 ++++++++
|
||||
src/processor/minidump.cc | 8 ++++++++
|
||||
2 files changed, 16 insertions(+)
|
||||
|
||||
diff --git a/src/common/pecoff/pecoff_file_id.cc b/src/common/pecoff/pecoff_file_id.cc
|
||||
index 47c2763f..04563c86 100644
|
||||
--- a/src/common/pecoff/pecoff_file_id.cc
|
||||
+++ b/src/common/pecoff/pecoff_file_id.cc
|
||||
@@ -32,6 +32,7 @@
|
||||
|
||||
#include "common/pecoff/pecoff_file_id.h"
|
||||
|
||||
+#include <string.h>
|
||||
#include "common/pecoff/pecoffutils.h"
|
||||
|
||||
namespace google_breakpad {
|
||||
@@ -73,11 +74,18 @@ bool PeCoffFileID::PeCoffFileIdentifierFromMappedFile(const void* base,
|
||||
age))
|
||||
return true;
|
||||
|
||||
+#if 1
|
||||
+ // XXX: Fallback to a default debug_identifier.
|
||||
+ memset(identifier, 0, kMDGUIDSize);
|
||||
+ *age = 0;
|
||||
+ return true;
|
||||
+#else
|
||||
// Fall back on hashing the first page of the text section.
|
||||
// (This is of questionable value as the Windows Minidump writer doesn't have
|
||||
// this feature)
|
||||
return HashPeCoffTextSection(reinterpret_cast<const uint8_t *>(base),
|
||||
identifier);
|
||||
+#endif
|
||||
}
|
||||
|
||||
} // namespace google_breakpad
|
||||
diff --git a/src/processor/minidump.cc b/src/processor/minidump.cc
|
||||
index f802210e..1b08ba3f 100644
|
||||
--- a/src/processor/minidump.cc
|
||||
+++ b/src/processor/minidump.cc
|
||||
@@ -2248,6 +2248,14 @@ string MinidumpModule::debug_identifier() const {
|
||||
|
||||
// TODO(mmentovai): on the Mac, provide fallbacks as in code_identifier().
|
||||
|
||||
+ // XXX: PE generated with gcc don't currently have CV records, so the Windows
|
||||
+ // minidumper can't record any identifier information, so there's no useful
|
||||
+ // identifier for us to match with. Fallback to a default debug_identifier.
|
||||
+ if (identifier.empty())
|
||||
+ {
|
||||
+ identifier = "000000000000000000000000000000000";
|
||||
+ }
|
||||
+
|
||||
// Relatively common case
|
||||
BPLOG_IF(INFO, identifier.empty()) << "MinidumpModule could not determine "
|
||||
"debug_identifier for " << *name_;
|
||||
--
|
||||
2.28.0
|
||||
|
@ -0,0 +1,32 @@
|
||||
From 0a7193eae04791c157328b7cdf0214d707ef3c1d Mon Sep 17 00:00:00 2001
|
||||
From: Jon Turney <jon.turney@dronecode.org.uk>
|
||||
Date: Wed, 9 Apr 2014 21:14:07 +0100
|
||||
Subject: [PATCH 14/19] Use __USE_MINGW_ANSI_STDIO for MinGW build
|
||||
|
||||
Use __USE_MINGW_ANSI_STDIO for ANSI C99 compatible implementation of printf()
|
||||
and friends on MinGW
|
||||
|
||||
Perhaps we don't need this, if all the printf formats used are in the subset
|
||||
supported by MSVCRT, but it's easier to turn this on than audit every
|
||||
single format string...
|
||||
|
||||
Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
|
||||
---
|
||||
Makefile.am | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/Makefile.am b/Makefile.am
|
||||
index 0eddd5ec..7f81a982 100644
|
||||
--- a/Makefile.am
|
||||
+++ b/Makefile.am
|
||||
@@ -59,6 +59,7 @@ endif
|
||||
if MINGW_HOST
|
||||
SOCKET_LIBS = -lws2_32
|
||||
AM_CPPFLAGS += -D_POSIX_C_SOURCE
|
||||
+AM_CPPFLAGS += -D__USE_MINGW_ANSI_STDIO
|
||||
endif
|
||||
|
||||
# Specify include paths for ac macros
|
||||
--
|
||||
2.28.0
|
||||
|
@ -0,0 +1,319 @@
|
||||
From affeb8008a27b55a5b096cc77a6431baf7e51ecf Mon Sep 17 00:00:00 2001
|
||||
From: Jon Turney <jon.turney@dronecode.org.uk>
|
||||
Date: Wed, 9 Apr 2014 23:49:03 +0100
|
||||
Subject: [PATCH 15/19] Provide a working strtok_r for MinGW
|
||||
|
||||
Prior to mingW-w64 3.3.0, strtok_r was a macro using strtok, which causes the
|
||||
processor to not work, as re-entrancy is required
|
||||
|
||||
v2:
|
||||
Link various unit tests with @LIBOBJS@ for strtok_r
|
||||
|
||||
Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
|
||||
---
|
||||
Makefile.am | 28 +++----
|
||||
compat/strtok_r.c | 85 +++++++++++++++++++++
|
||||
configure.ac | 3 +
|
||||
src/processor/basic_source_line_resolver.cc | 4 +
|
||||
src/processor/cfi_frame_info.cc | 6 +-
|
||||
src/processor/tokenize.cc | 6 +-
|
||||
6 files changed, 116 insertions(+), 16 deletions(-)
|
||||
create mode 100644 compat/strtok_r.c
|
||||
|
||||
diff --git a/Makefile.am b/Makefile.am
|
||||
index 7f81a982..b6fd0682 100644
|
||||
--- a/Makefile.am
|
||||
+++ b/Makefile.am
|
||||
@@ -839,7 +839,7 @@ src_processor_basic_source_line_resolver_unittest_LDADD = \
|
||||
src/processor/source_line_resolver_base.o \
|
||||
src/processor/tokenize.o \
|
||||
$(TEST_LIBS) \
|
||||
- $(PTHREAD_CFLAGS) $(PTHREAD_LIBS)
|
||||
+ $(PTHREAD_CFLAGS) $(PTHREAD_LIBS) @LIBOBJS@
|
||||
|
||||
src_processor_cfi_frame_info_unittest_SOURCES = \
|
||||
src/processor/cfi_frame_info_unittest.cc
|
||||
@@ -848,7 +848,7 @@ src_processor_cfi_frame_info_unittest_LDADD = \
|
||||
src/processor/logging.o \
|
||||
src/processor/pathname_stripper.o \
|
||||
$(TEST_LIBS) \
|
||||
- $(PTHREAD_CFLAGS) $(PTHREAD_LIBS)
|
||||
+ $(PTHREAD_CFLAGS) $(PTHREAD_LIBS) @LIBOBJS@
|
||||
src_processor_cfi_frame_info_unittest_CPPFLAGS = \
|
||||
$(AM_CPPFLAGS) $(TEST_CFLAGS)
|
||||
|
||||
@@ -898,7 +898,7 @@ src_processor_exploitability_unittest_LDADD = \
|
||||
src/processor/tokenize.o \
|
||||
src/third_party/libdisasm/libdisasm.a \
|
||||
$(TEST_LIBS) \
|
||||
- $(PTHREAD_CFLAGS) $(PTHREAD_LIBS)
|
||||
+ $(PTHREAD_CFLAGS) $(PTHREAD_LIBS) @LIBOBJS@
|
||||
|
||||
src_processor_disassembler_x86_unittest_SOURCES = \
|
||||
src/processor/disassembler_x86_unittest.cc
|
||||
@@ -925,7 +925,7 @@ src_processor_fast_source_line_resolver_unittest_LDADD = \
|
||||
src/processor/source_line_resolver_base.o \
|
||||
src/processor/tokenize.o \
|
||||
$(TEST_LIBS) \
|
||||
- $(PTHREAD_CFLAGS) $(PTHREAD_LIBS)
|
||||
+ $(PTHREAD_CFLAGS) $(PTHREAD_LIBS) @LIBOBJS@
|
||||
|
||||
src_processor_map_serializers_unittest_SOURCES = \
|
||||
src/processor/map_serializers_unittest.cc
|
||||
@@ -969,7 +969,7 @@ src_processor_microdump_processor_unittest_LDADD = \
|
||||
src/processor/stackwalker_x86.o \
|
||||
src/processor/tokenize.o \
|
||||
$(TEST_LIBS) \
|
||||
- $(PTHREAD_CFLAGS) $(PTHREAD_LIBS)
|
||||
+ $(PTHREAD_CFLAGS) $(PTHREAD_LIBS) @LIBOBJS@
|
||||
|
||||
src_processor_minidump_processor_unittest_SOURCES = \
|
||||
src/processor/minidump_processor_unittest.cc
|
||||
@@ -1010,7 +1010,7 @@ src_processor_minidump_processor_unittest_LDADD = \
|
||||
src/processor/tokenize.o \
|
||||
src/third_party/libdisasm/libdisasm.a \
|
||||
$(TEST_LIBS) \
|
||||
- $(PTHREAD_CFLAGS) $(PTHREAD_LIBS)
|
||||
+ $(PTHREAD_CFLAGS) $(PTHREAD_LIBS) @LIBOBJS@
|
||||
|
||||
src_processor_minidump_unittest_SOURCES = \
|
||||
src/common/test_assembler.cc \
|
||||
@@ -1158,7 +1158,7 @@ src_processor_stackwalker_amd64_unittest_SOURCES = \
|
||||
src_processor_stackwalker_amd64_unittest_LDADD = \
|
||||
src/libbreakpad.a \
|
||||
$(TEST_LIBS) \
|
||||
- $(PTHREAD_CFLAGS) $(PTHREAD_LIBS)
|
||||
+ $(PTHREAD_CFLAGS) $(PTHREAD_LIBS) @LIBOBJS@
|
||||
src_processor_stackwalker_amd64_unittest_CPPFLAGS = \
|
||||
$(AM_CPPFLAGS) $(TEST_CFLAGS)
|
||||
|
||||
@@ -1168,7 +1168,7 @@ src_processor_stackwalker_arm_unittest_SOURCES = \
|
||||
src_processor_stackwalker_arm_unittest_LDADD = \
|
||||
src/libbreakpad.a \
|
||||
$(TEST_LIBS) \
|
||||
- $(PTHREAD_CFLAGS) $(PTHREAD_LIBS)
|
||||
+ $(PTHREAD_CFLAGS) $(PTHREAD_LIBS) @LIBOBJS@
|
||||
src_processor_stackwalker_arm_unittest_CPPFLAGS = \
|
||||
$(AM_CPPFLAGS) $(TEST_CFLAGS)
|
||||
|
||||
@@ -1178,7 +1178,7 @@ src_processor_stackwalker_arm64_unittest_SOURCES = \
|
||||
src_processor_stackwalker_arm64_unittest_LDADD = \
|
||||
src/libbreakpad.a \
|
||||
$(TEST_LIBS) \
|
||||
- $(PTHREAD_CFLAGS) $(PTHREAD_LIBS)
|
||||
+ $(PTHREAD_CFLAGS) $(PTHREAD_LIBS) @LIBOBJS@
|
||||
src_processor_stackwalker_arm64_unittest_CPPFLAGS = \
|
||||
$(AM_CPPFLAGS) $(TEST_CFLAGS)
|
||||
|
||||
@@ -1188,7 +1188,7 @@ src_processor_stackwalker_address_list_unittest_SOURCES = \
|
||||
src_processor_stackwalker_address_list_unittest_LDADD = \
|
||||
src/libbreakpad.a \
|
||||
$(TEST_LIBS) \
|
||||
- $(PTHREAD_CFLAGS) $(PTHREAD_LIBS)
|
||||
+ $(PTHREAD_CFLAGS) $(PTHREAD_LIBS) @LIBOBJS@
|
||||
src_processor_stackwalker_address_list_unittest_CPPFLAGS = \
|
||||
$(AM_CPPFLAGS) $(TEST_CFLAGS)
|
||||
|
||||
@@ -1198,7 +1198,7 @@ src_processor_stackwalker_mips_unittest_SOURCES = \
|
||||
src_processor_stackwalker_mips_unittest_LDADD = \
|
||||
src/libbreakpad.a \
|
||||
$(TEST_LIBS) \
|
||||
- $(PTHREAD_CFLAGS) $(PTHREAD_LIBS)
|
||||
+ $(PTHREAD_CFLAGS) $(PTHREAD_LIBS) @LIBOBJS@
|
||||
src_processor_stackwalker_mips_unittest_CPPFLAGS = \
|
||||
$(AM_CPPFLAGS) $(TEST_CFLAGS)
|
||||
|
||||
@@ -1218,7 +1218,7 @@ src_processor_stackwalker_x86_unittest_SOURCES = \
|
||||
src_processor_stackwalker_x86_unittest_LDADD = \
|
||||
src/libbreakpad.a \
|
||||
$(TEST_LIBS) \
|
||||
- $(PTHREAD_CFLAGS) $(PTHREAD_LIBS)
|
||||
+ $(PTHREAD_CFLAGS) $(PTHREAD_LIBS) @LIBOBJS@
|
||||
src_processor_stackwalker_x86_unittest_CPPFLAGS = \
|
||||
$(AM_CPPFLAGS) $(TEST_CFLAGS)
|
||||
|
||||
@@ -1295,7 +1295,7 @@ src_processor_microdump_stackwalk_LDADD = \
|
||||
src/processor/stackwalker_x86.o \
|
||||
src/processor/tokenize.o \
|
||||
src/third_party/libdisasm/libdisasm.a \
|
||||
- $(PTHREAD_CFLAGS) $(PTHREAD_LIBS) $(SOCKET_LIBS)
|
||||
+ $(PTHREAD_CFLAGS) $(PTHREAD_LIBS) $(SOCKET_LIBS) @LIBOBJS@
|
||||
|
||||
src_processor_minidump_stackwalk_SOURCES = \
|
||||
src/processor/minidump_stackwalk.cc
|
||||
@@ -1336,7 +1336,7 @@ src_processor_minidump_stackwalk_LDADD = \
|
||||
src/processor/symbolic_constants_win.o \
|
||||
src/processor/tokenize.o \
|
||||
src/third_party/libdisasm/libdisasm.a \
|
||||
- $(PTHREAD_CFLAGS) $(PTHREAD_LIBS) $(SOCKET_LIBS)
|
||||
+ $(PTHREAD_CFLAGS) $(PTHREAD_LIBS) $(SOCKET_LIBS) @LIBOBJS@
|
||||
|
||||
endif !DISABLE_PROCESSOR
|
||||
|
||||
diff --git a/compat/strtok_r.c b/compat/strtok_r.c
|
||||
new file mode 100644
|
||||
index 00000000..ec7b6379
|
||||
--- /dev/null
|
||||
+++ b/compat/strtok_r.c
|
||||
@@ -0,0 +1,85 @@
|
||||
+/*-
|
||||
+ * Copyright (c) 1998 Softweyr LLC. All rights reserved.
|
||||
+ *
|
||||
+ * strtok_r, from Berkeley strtok
|
||||
+ * Oct 13, 1998 by Wes Peters <wes@softweyr.com>
|
||||
+ *
|
||||
+ * Copyright (c) 1988, 1993
|
||||
+ * The Regents of the University of California. All rights reserved.
|
||||
+ *
|
||||
+ * Redistribution and use in source and binary forms, with or without
|
||||
+ * modification, are permitted provided that the following conditions
|
||||
+ * are met:
|
||||
+ * 1. Redistributions of source code must retain the above copyright
|
||||
+ * notices, this list of conditions and the following disclaimer.
|
||||
+ * 2. Redistributions in binary form must reproduce the above copyright
|
||||
+ * notices, this list of conditions and the following disclaimer in the
|
||||
+ * documentation and/or other materials provided with the distribution.
|
||||
+ * 3. All advertising materials mentioning features or use of this software
|
||||
+ * must display the following acknowledgement:
|
||||
+ * This product includes software developed by Softweyr LLC, the
|
||||
+ * University of California, Berkeley, and its contributors.
|
||||
+ * 4. Neither the name of the University nor the names of its contributors
|
||||
+ * may be used to endorse or promote products derived from this software
|
||||
+ * without specific prior written permission.
|
||||
+ *
|
||||
+ * THIS SOFTWARE IS PROVIDED BY SOFTWEYR LLC, THE REGENTS AND CONTRIBUTORS
|
||||
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SOFTWEYR LLC, THE
|
||||
+ * REGENTS, OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
|
||||
+ * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
+ */
|
||||
+
|
||||
+#include <string.h>
|
||||
+
|
||||
+char *
|
||||
+strtok_r(char *s, const char *delim, char **last)
|
||||
+{
|
||||
+ char *spanp, *tok;
|
||||
+ int c, sc;
|
||||
+
|
||||
+ if (s == NULL && (s = *last) == NULL)
|
||||
+ return (NULL);
|
||||
+
|
||||
+ /*
|
||||
+ * Skip (span) leading delimiters (s += strspn(s, delim), sort of).
|
||||
+ */
|
||||
+cont:
|
||||
+ c = *s++;
|
||||
+ for (spanp = (char *)delim; (sc = *spanp++) != 0;) {
|
||||
+ if (c == sc)
|
||||
+ goto cont;
|
||||
+ }
|
||||
+
|
||||
+ if (c == 0) { /* no non-delimiter characters */
|
||||
+ *last = NULL;
|
||||
+ return (NULL);
|
||||
+ }
|
||||
+ tok = s - 1;
|
||||
+
|
||||
+ /*
|
||||
+ * Scan token (scan for delimiters: s += strcspn(s, delim), sort of).
|
||||
+ * Note that delim must have one NUL; we stop if we see that, too.
|
||||
+ */
|
||||
+ for (;;) {
|
||||
+ c = *s++;
|
||||
+ spanp = (char *)delim;
|
||||
+ do {
|
||||
+ if ((sc = *spanp++) == c) {
|
||||
+ if (c == 0)
|
||||
+ s = NULL;
|
||||
+ else
|
||||
+ s[-1] = '\0';
|
||||
+ *last = s;
|
||||
+ return (tok);
|
||||
+ }
|
||||
+ } while (sc != 0);
|
||||
+ }
|
||||
+ /* NOTREACHED */
|
||||
+}
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index e50d2c22..10028aaa 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -77,6 +77,9 @@ AC_CHECK_FUNCS([arc4random getrandom])
|
||||
|
||||
AX_CXX_COMPILE_STDCXX(11, noext, mandatory)
|
||||
|
||||
+AC_CONFIG_LIBOBJ_DIR([compat])
|
||||
+AC_REPLACE_FUNCS([strtok_r])
|
||||
+
|
||||
dnl Test supported warning flags.
|
||||
WARN_CXXFLAGS=
|
||||
dnl This warning flag is used by clang. Its default behavior is to warn when
|
||||
diff --git a/src/processor/basic_source_line_resolver.cc b/src/processor/basic_source_line_resolver.cc
|
||||
index c4aa949c..c4fcbffa 100644
|
||||
--- a/src/processor/basic_source_line_resolver.cc
|
||||
+++ b/src/processor/basic_source_line_resolver.cc
|
||||
@@ -49,6 +49,10 @@
|
||||
|
||||
#include "processor/tokenize.h"
|
||||
|
||||
+#ifndef HAVE_STRTOK_R
|
||||
+extern "C" char *strtok_r(char *, const char *, char **);
|
||||
+#endif
|
||||
+
|
||||
using std::map;
|
||||
using std::vector;
|
||||
using std::make_pair;
|
||||
diff --git a/src/processor/cfi_frame_info.cc b/src/processor/cfi_frame_info.cc
|
||||
index 0c4af7ba..dd2b438b 100644
|
||||
--- a/src/processor/cfi_frame_info.cc
|
||||
+++ b/src/processor/cfi_frame_info.cc
|
||||
@@ -41,12 +41,16 @@
|
||||
#include "common/scoped_ptr.h"
|
||||
#include "processor/postfix_evaluator-inl.h"
|
||||
|
||||
-namespace google_breakpad {
|
||||
+#ifndef HAVE_STRTOK_R
|
||||
+extern "C" char *strtok_r(char *, const char *, char **);
|
||||
+#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define strtok_r strtok_s
|
||||
#endif
|
||||
|
||||
+namespace google_breakpad {
|
||||
+
|
||||
template<typename V>
|
||||
bool CFIFrameInfo::FindCallerRegs(const RegisterValueMap<V> ®isters,
|
||||
const MemoryRegion &memory,
|
||||
diff --git a/src/processor/tokenize.cc b/src/processor/tokenize.cc
|
||||
index 8fce87a2..e6213ac3 100644
|
||||
--- a/src/processor/tokenize.cc
|
||||
+++ b/src/processor/tokenize.cc
|
||||
@@ -34,12 +34,16 @@
|
||||
|
||||
#include "common/using_std_string.h"
|
||||
|
||||
-namespace google_breakpad {
|
||||
+#ifndef HAVE_STRTOK_R
|
||||
+extern "C" char *strtok_r(char *, const char *, char **);
|
||||
+#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define strtok_r strtok_s
|
||||
#endif
|
||||
|
||||
+namespace google_breakpad {
|
||||
+
|
||||
using std::vector;
|
||||
|
||||
bool Tokenize(char *line,
|
||||
--
|
||||
2.28.0
|
||||
|
@ -0,0 +1,62 @@
|
||||
From a1af0549d928135538c0577c991d1ab675ea8533 Mon Sep 17 00:00:00 2001
|
||||
From: Jon Turney <jon.turney@dronecode.org.uk>
|
||||
Date: Thu, 16 Oct 2014 00:53:55 +0100
|
||||
Subject: [PATCH 16/19] Fallback to synthesizing a debug-id from version and
|
||||
architecture, if possible
|
||||
|
||||
Based on an idea by Ivan Gubarev
|
||||
|
||||
Ideally there would be a similar change in PeCoffFileIdentifierFromMappedFile(),
|
||||
but that is not written yet...
|
||||
|
||||
Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
|
||||
---
|
||||
src/processor/minidump.cc | 32 +++++++++++++++++++++++++++++---
|
||||
1 file changed, 29 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/processor/minidump.cc b/src/processor/minidump.cc
|
||||
index 1b08ba3f..7d1c5327 100644
|
||||
--- a/src/processor/minidump.cc
|
||||
+++ b/src/processor/minidump.cc
|
||||
@@ -2248,9 +2248,35 @@ string MinidumpModule::debug_identifier() const {
|
||||
|
||||
// TODO(mmentovai): on the Mac, provide fallbacks as in code_identifier().
|
||||
|
||||
- // XXX: PE generated with gcc don't currently have CV records, so the Windows
|
||||
- // minidumper can't record any identifier information, so there's no useful
|
||||
- // identifier for us to match with. Fallback to a default debug_identifier.
|
||||
+ // If possible, synthesize a debug_identifier from the version and
|
||||
+ // architecture.
|
||||
+ if (identifier.empty()) {
|
||||
+ std::string ver = version();
|
||||
+ if (ver.compare("") != 0) {
|
||||
+ identifier = "";
|
||||
+ for (std::string::const_iterator i = ver.begin(); i != ver.end(); i++) {
|
||||
+ if (isxdigit(*i)) {
|
||||
+ identifier += *i;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ MinidumpSystemInfo *minidump_system_info = minidump_->GetSystemInfo();
|
||||
+ if (minidump_system_info) {
|
||||
+ std::string cpu = minidump_system_info->GetCPU();
|
||||
+ for (std::string::const_iterator i = cpu.begin(); i != cpu.end(); i++) {
|
||||
+ char ashex[4];
|
||||
+ snprintf(ashex, sizeof(ashex), "%02x", *i);
|
||||
+ identifier += ashex;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ while (identifier.size() < 33) {
|
||||
+ identifier += "0";
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ // Fallback to a default debug_identifier
|
||||
if (identifier.empty())
|
||||
{
|
||||
identifier = "000000000000000000000000000000000";
|
||||
--
|
||||
2.28.0
|
||||
|
@ -0,0 +1,29 @@
|
||||
From 6e326b03f319739b630dcf6d897ed4563086b808 Mon Sep 17 00:00:00 2001
|
||||
From: Jon Turney <jon.turney@dronecode.org.uk>
|
||||
Date: Wed, 19 Nov 2014 11:22:53 +0000
|
||||
Subject: [PATCH 17/19] Fix typo in the name of the info entry containing
|
||||
uptime
|
||||
|
||||
I'm assuming this is a typo, although it's been this way since it was added in r280
|
||||
|
||||
Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
|
||||
---
|
||||
src/client/windows/crash_generation/client_info.cc | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/client/windows/crash_generation/client_info.cc b/src/client/windows/crash_generation/client_info.cc
|
||||
index 30a48db0..fb293628 100644
|
||||
--- a/src/client/windows/crash_generation/client_info.cc
|
||||
+++ b/src/client/windows/crash_generation/client_info.cc
|
||||
@@ -30,7 +30,7 @@
|
||||
#include "client/windows/crash_generation/client_info.h"
|
||||
#include "client/windows/common/ipc_protocol.h"
|
||||
|
||||
-static const wchar_t kCustomInfoProcessUptimeName[] = L"ptime";
|
||||
+static const wchar_t kCustomInfoProcessUptimeName[] = L"uptime";
|
||||
static const size_t kMaxCustomInfoEntries = 4096;
|
||||
|
||||
namespace google_breakpad {
|
||||
--
|
||||
2.28.0
|
||||
|
@ -0,0 +1,30 @@
|
||||
From 7b5f274d2029ae6bb63789ab026ac2e2eb3cdf77 Mon Sep 17 00:00:00 2001
|
||||
From: Jon Turney <jon.turney@dronecode.org.uk>
|
||||
Date: Wed, 19 Nov 2014 11:29:44 +0000
|
||||
Subject: [PATCH 18/19] Fix a missing \r in crash_generation_app
|
||||
|
||||
Fix a missing \r in crash_generation_app
|
||||
|
||||
I thought this made a difference, but it doesn't seem to...
|
||||
|
||||
Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
|
||||
---
|
||||
.../windows/tests/crash_generation_app/crash_generation_app.cc | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
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 52736768..93457277 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
|
||||
@@ -254,7 +254,7 @@ static void ShowClientCrashed(void* context,
|
||||
line[0] = _T('\0');
|
||||
result = swprintf_s(line,
|
||||
kMaximumLineLength,
|
||||
- L"%s\n",
|
||||
+ L"%s\r\n",
|
||||
str_line.c_str());
|
||||
if (result == -1) {
|
||||
delete[] line;
|
||||
--
|
||||
2.28.0
|
||||
|
@ -0,0 +1,106 @@
|
||||
From 7559a2927de29db9765d3ab744490b1cf4500d1f Mon Sep 17 00:00:00 2001
|
||||
From: Jon Turney <jon.turney@dronecode.org.uk>
|
||||
Date: Fri, 17 Nov 2017 17:14:32 +0000
|
||||
Subject: [PATCH 19/19] Disable DwpReader for MinGW
|
||||
|
||||
elf_reader.cc uses mmap(), which isn't available
|
||||
|
||||
Perhaps we could change to using MmapWrapper(), which I've already fixed for
|
||||
Windows, but this code isn't doing anything for us anyhow
|
||||
|
||||
Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
|
||||
---
|
||||
Makefile.am | 1 -
|
||||
src/common/dwarf/dwarf2reader.cc | 12 +++++++++++-
|
||||
src/common/dwarf/dwarf2reader.h | 2 ++
|
||||
3 files changed, 13 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/Makefile.am b/Makefile.am
|
||||
index b6fd0682..703cba7a 100644
|
||||
--- a/Makefile.am
|
||||
+++ b/Makefile.am
|
||||
@@ -810,7 +810,6 @@ src_tools_windows_dump_syms_dwarf_dump_syms_SOURCES = \
|
||||
src/common/dwarf/bytereader.cc \
|
||||
src/common/dwarf/dwarf2diehandler.cc \
|
||||
src/common/dwarf/dwarf2reader.cc \
|
||||
- src/common/dwarf/elf_reader.cc \
|
||||
src/common/pecoff/dump_symbols.cc \
|
||||
src/common/pecoff/pecoffutils.cc \
|
||||
src/common/pecoff/pecoff_file_id.cc \
|
||||
diff --git a/src/common/dwarf/dwarf2reader.cc b/src/common/dwarf/dwarf2reader.cc
|
||||
index 27f3a83e..a6914a64 100644
|
||||
--- a/src/common/dwarf/dwarf2reader.cc
|
||||
+++ b/src/common/dwarf/dwarf2reader.cc
|
||||
@@ -64,7 +64,11 @@ CompilationUnit::CompilationUnit(const string& path,
|
||||
is_split_dwarf_(false), dwo_id_(0), dwo_name_(),
|
||||
skeleton_dwo_id_(0), ranges_base_(0), addr_base_(0),
|
||||
have_checked_for_dwp_(false), dwp_path_(),
|
||||
- dwp_byte_reader_(), dwp_reader_() {}
|
||||
+ dwp_byte_reader_()
|
||||
+#ifdef DWPREADER_WANTED
|
||||
+ , dwp_reader_()
|
||||
+#endif
|
||||
+{}
|
||||
|
||||
// Initialize a compilation unit from a .dwo or .dwp file.
|
||||
// In this case, we need the .debug_addr section from the
|
||||
@@ -346,6 +350,7 @@ uint64 CompilationUnit::Start() {
|
||||
// Now that we have our abbreviations, start processing DIE's.
|
||||
ProcessDIEs();
|
||||
|
||||
+#ifdef DWPREADER_WANTED
|
||||
// If this is a skeleton compilation unit generated with split DWARF,
|
||||
// and the client needs the full debug info, we need to find the full
|
||||
// compilation unit in a .dwo or .dwp file.
|
||||
@@ -353,6 +358,7 @@ uint64 CompilationUnit::Start() {
|
||||
&& dwo_name_ != NULL
|
||||
&& handler_->NeedSplitDebugInfo())
|
||||
ProcessSplitDwarf();
|
||||
+#endif
|
||||
|
||||
return ourlength;
|
||||
}
|
||||
@@ -610,6 +616,7 @@ inline int GetElfWidth(const ElfReader& elf) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
+#ifdef DWPREADER_WANTED
|
||||
void CompilationUnit::ProcessSplitDwarf() {
|
||||
struct stat statbuf;
|
||||
if (!have_checked_for_dwp_) {
|
||||
@@ -694,7 +701,9 @@ void CompilationUnit::ReadDebugSectionsFromDwo(ElfReader* elf_reader,
|
||||
section_size)));
|
||||
}
|
||||
}
|
||||
+#endif
|
||||
|
||||
+#ifdef DWPREADER_WANTED
|
||||
DwpReader::DwpReader(const ByteReader& byte_reader, ElfReader* elf_reader)
|
||||
: elf_reader_(elf_reader), byte_reader_(byte_reader),
|
||||
cu_index_(NULL), cu_index_size_(0), string_buffer_(NULL),
|
||||
@@ -900,6 +909,7 @@ uint32 DwpReader::LookupCUv2(uint64 dwo_id) {
|
||||
}
|
||||
return index;
|
||||
}
|
||||
+#endif
|
||||
|
||||
LineInfo::LineInfo(const uint8_t *buffer, uint64 buffer_length,
|
||||
ByteReader* reader, LineInfoHandler* handler):
|
||||
diff --git a/src/common/dwarf/dwarf2reader.h b/src/common/dwarf/dwarf2reader.h
|
||||
index cf3ba3cd..e77c2258 100644
|
||||
--- a/src/common/dwarf/dwarf2reader.h
|
||||
+++ b/src/common/dwarf/dwarf2reader.h
|
||||
@@ -586,8 +586,10 @@ class CompilationUnit {
|
||||
// ByteReader for the DWP file.
|
||||
std::unique_ptr<ByteReader> dwp_byte_reader_;
|
||||
|
||||
+#ifdef DWPREADER_WANTED
|
||||
// DWP reader.
|
||||
std::unique_ptr<DwpReader> dwp_reader_;
|
||||
+#endif
|
||||
};
|
||||
|
||||
// A Reader for a .dwp file. Supports the fetching of DWARF debug
|
||||
--
|
||||
2.28.0
|
||||
|
@ -0,0 +1,30 @@
|
||||
From 835ce1297e3825484729fa4a065c7854ac5758a4 Mon Sep 17 00:00:00 2001
|
||||
From: Danny Robson <danny@nerdcruft.net>
|
||||
Date: Mon, 17 Feb 2020 14:35:30 +1100
|
||||
Subject: [PATCH 5/6] memory_allocator: Use allocator_traits rather than
|
||||
allocator
|
||||
|
||||
allocator::pointer has been removed in C++20. The appropriate mechanism
|
||||
is now allocator_traits<Alloc>::pointer.
|
||||
---
|
||||
src/common/memory_allocator.h | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/common/memory_allocator.h b/src/common/memory_allocator.h
|
||||
index a3159ea4..b1d4d7be 100644
|
||||
--- a/src/common/memory_allocator.h
|
||||
+++ b/src/common/memory_allocator.h
|
||||
@@ -161,8 +161,8 @@ class PageAllocator {
|
||||
// Wrapper to use with STL containers
|
||||
template <typename T>
|
||||
struct PageStdAllocator : public std::allocator<T> {
|
||||
- typedef typename std::allocator<T>::pointer pointer;
|
||||
- typedef typename std::allocator<T>::size_type size_type;
|
||||
+ typedef typename std::allocator_traits<std::allocator<T>>::pointer pointer;
|
||||
+ typedef typename std::allocator_traits<std::allocator<T>>::size_type size_type;
|
||||
|
||||
explicit PageStdAllocator(PageAllocator& allocator) : allocator_(allocator),
|
||||
stackdata_(NULL),
|
||||
--
|
||||
2.28.0
|
||||
|
@ -0,0 +1,25 @@
|
||||
From 31cbc302a737e5cb8459d9b1fb67342a83bbd6b4 Mon Sep 17 00:00:00 2001
|
||||
From: Danny Robson <danny@nerdcruft.net>
|
||||
Date: Wed, 30 Oct 2019 10:09:48 +1100
|
||||
Subject: [PATCH 1/7] Add a null range-handler to DwarfCUToModule constructor
|
||||
|
||||
---
|
||||
src/common/pecoff/dump_symbols-inl.h | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/common/pecoff/dump_symbols-inl.h b/src/common/pecoff/dump_symbols-inl.h
|
||||
index 661097d2..ef4136b7 100644
|
||||
--- a/src/common/pecoff/dump_symbols-inl.h
|
||||
+++ b/src/common/pecoff/dump_symbols-inl.h
|
||||
@@ -257,7 +257,7 @@ bool LoadDwarf(const string& dwarf_filename,
|
||||
// Make a handler for the root DIE that populates MODULE with the
|
||||
// data that was found.
|
||||
DwarfCUToModule::WarningReporter reporter(dwarf_filename, offset);
|
||||
- DwarfCUToModule root_handler(&file_context, &line_to_module, &reporter);
|
||||
+ DwarfCUToModule root_handler(&file_context, &line_to_module, nullptr, &reporter);
|
||||
// Make a Dwarf2Handler that drives the DIEHandler.
|
||||
dwarf2reader::DIEDispatcher die_dispatcher(&root_handler);
|
||||
// Make a DWARF parser for the compilation unit at OFFSET.
|
||||
--
|
||||
2.28.0
|
||||
|
@ -0,0 +1,69 @@
|
||||
From 5fa811d42c78154290f17e261ce9e8be16911c93 Mon Sep 17 00:00:00 2001
|
||||
From: Danny Robson <danny@nerdcruft.net>
|
||||
Date: Thu, 31 Oct 2019 10:44:50 +1100
|
||||
Subject: [PATCH 3/7] Build a minimal breakpad-client library if a MINGW_HOST
|
||||
is detected.
|
||||
|
||||
---
|
||||
Makefile.am | 38 ++++++++++++++++++++++++++++++++++++++
|
||||
1 file changed, 38 insertions(+)
|
||||
|
||||
diff --git a/Makefile.am b/Makefile.am
|
||||
index 83fb5173..e9eecad5 100644
|
||||
--- a/Makefile.am
|
||||
+++ b/Makefile.am
|
||||
@@ -100,6 +100,21 @@ includecldir = $(includedir)/$(PACKAGE)/common/linux
|
||||
includecl_HEADERS = $(top_srcdir)/src/common/linux/*.h
|
||||
endif
|
||||
|
||||
+if MINGW_HOST
|
||||
+includeclhdir = $(includedir)/$(PACKAGE)/client/windows/handler
|
||||
+includeclh_HEADERS = $(top_srcdir)/src/client/windows/handler/*.h
|
||||
+
|
||||
+includeclcdir = $(includedir)/$(PACKAGE)/client/windows/crash_generation
|
||||
+includeclc_HEADERS = $(top_srcdir)/src/client/windows/crash_generation/*.h
|
||||
+
|
||||
+includeclccdir = $(includedir)/$(PACKAGE)/client/windows/common
|
||||
+includeclcc_HEADERS = $(top_srcdir)/src/client/windows/common/*.h
|
||||
+
|
||||
+includecldir = $(includedir)/$(PACKAGE)/common/windows
|
||||
+includecl_HEADERS = $(top_srcdir)/src/common/windows/*.h
|
||||
+
|
||||
+endif
|
||||
+
|
||||
includegbcdir = $(includedir)/$(PACKAGE)/google_breakpad/common
|
||||
includegbc_HEADERS = $(top_srcdir)/src/google_breakpad/common/*.h
|
||||
|
||||
@@ -203,6 +218,29 @@ src_client_linux_libbreakpad_client_a_SOURCES += \
|
||||
endif
|
||||
endif LINUX_HOST
|
||||
|
||||
+if MINGW_HOST
|
||||
+lib_LIBRARIES += src/client/windows/libbreakpad_client.a
|
||||
+pkgconfig_DATA += breakpad-client.pc
|
||||
+
|
||||
+src_client_windows_libbreakpad_client_a_SOURCES = \
|
||||
+ src/common/windows/guid_string.cc \
|
||||
+ src/common/windows/guid_string.h \
|
||||
+ src/client/windows/common/auto_critical_section.h \
|
||||
+ src/client/windows/common/ipc_protocol.h \
|
||||
+ src/client/windows/crash_generation/client_info.cc \
|
||||
+ src/client/windows/crash_generation/client_info.h \
|
||||
+ src/client/windows/crash_generation/crash_generation_client.cc \
|
||||
+ src/client/windows/crash_generation/crash_generation_client.h \
|
||||
+ src/client/windows/crash_generation/crash_generation_server.cc \
|
||||
+ src/client/windows/crash_generation/crash_generation_server.h \
|
||||
+ src/client/windows/crash_generation/minidump_generator.cc \
|
||||
+ src/client/windows/crash_generation/minidump_generator.h \
|
||||
+ src/client/windows/handler/exception_handler.cc \
|
||||
+ src/client/windows/handler/exception_handler.h \
|
||||
+ src/client/windows/sender/crash_report_sender.cc \
|
||||
+ src/client/windows/sender/crash_report_sender.h
|
||||
+endif
|
||||
+
|
||||
if !DISABLE_PROCESSOR
|
||||
src_libbreakpad_a_SOURCES = \
|
||||
src/google_breakpad/common/breakpad_types.h \
|
||||
--
|
||||
2.28.0
|
||||
|
@ -0,0 +1,28 @@
|
||||
From d717a0f9175d15c26e9d4e7cd1f6b77fd114a1f1 Mon Sep 17 00:00:00 2001
|
||||
From: Danny Robson <danny@nerdcruft.net>
|
||||
Date: Thu, 31 Oct 2019 10:45:14 +1100
|
||||
Subject: [PATCH 4/7] Enable minimalist build signatures
|
||||
|
||||
Any minimisation of signature collisions makes managing collections of
|
||||
symbol files substantially easier. The default of '0' is unworkable when
|
||||
actually deployed.
|
||||
---
|
||||
src/common/pecoff/pecoff_file_id.cc | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/common/pecoff/pecoff_file_id.cc b/src/common/pecoff/pecoff_file_id.cc
|
||||
index 04563c86..a8a9c2f5 100644
|
||||
--- a/src/common/pecoff/pecoff_file_id.cc
|
||||
+++ b/src/common/pecoff/pecoff_file_id.cc
|
||||
@@ -74,7 +74,7 @@ bool PeCoffFileID::PeCoffFileIdentifierFromMappedFile(const void* base,
|
||||
age))
|
||||
return true;
|
||||
|
||||
-#if 1
|
||||
+#if 0
|
||||
// XXX: Fallback to a default debug_identifier.
|
||||
memset(identifier, 0, kMDGUIDSize);
|
||||
*age = 0;
|
||||
--
|
||||
2.28.0
|
||||
|
@ -0,0 +1,27 @@
|
||||
From 66de6a75c0ee8f8df2840879522d0aee6d34e2b1 Mon Sep 17 00:00:00 2001
|
||||
From: Danny Robson <danny@nerdcruft.net>
|
||||
Date: Fri, 1 Nov 2019 11:11:37 +1100
|
||||
Subject: [PATCH 5/7] Disable the pseudo-build ID generation for PECOFF
|
||||
|
||||
It should be clearer when the build-id isn't picked up. Using zeros is
|
||||
far easier to detect than failing down to a faked ID.
|
||||
---
|
||||
src/common/pecoff/pecoff_file_id.cc | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/common/pecoff/pecoff_file_id.cc b/src/common/pecoff/pecoff_file_id.cc
|
||||
index a8a9c2f5..04563c86 100644
|
||||
--- a/src/common/pecoff/pecoff_file_id.cc
|
||||
+++ b/src/common/pecoff/pecoff_file_id.cc
|
||||
@@ -74,7 +74,7 @@ bool PeCoffFileID::PeCoffFileIdentifierFromMappedFile(const void* base,
|
||||
age))
|
||||
return true;
|
||||
|
||||
-#if 0
|
||||
+#if 1
|
||||
// XXX: Fallback to a default debug_identifier.
|
||||
memset(identifier, 0, kMDGUIDSize);
|
||||
*age = 0;
|
||||
--
|
||||
2.28.0
|
||||
|
@ -0,0 +1,208 @@
|
||||
From dee30faf8a5386b18b6c4368f83cddb3e82b8246 Mon Sep 17 00:00:00 2001
|
||||
From: Danny Robson <danny@nerdcruft.net>
|
||||
Date: Thu, 31 Oct 2019 10:41:51 +1100
|
||||
Subject: [PATCH 2/7] Ensure wide strings use the wide versions of Windows
|
||||
syscalls
|
||||
|
||||
This aids cross compilation under MinGW. Otherwise we encounter wide
|
||||
type conversion errors when it defaults to the ANSI variants of each
|
||||
syscall.
|
||||
|
||||
There is probably a build flag that dynamically switches these calls,
|
||||
but usage of wide strings is hard coded in a few places already so
|
||||
these fixes are necessary regardless.
|
||||
---
|
||||
.../crash_generation_client.cc | 24 ++++++-------
|
||||
.../crash_generation_server.cc | 16 ++++-----
|
||||
.../crash_generation/minidump_generator.cc | 34 +++++++++----------
|
||||
.../windows/handler/exception_handler.cc | 18 +++++-----
|
||||
4 files changed, 46 insertions(+), 46 deletions(-)
|
||||
|
||||
diff --git a/src/client/windows/crash_generation/crash_generation_client.cc b/src/client/windows/crash_generation/crash_generation_client.cc
|
||||
index 3ba5d4e4..b33ecb24 100644
|
||||
--- a/src/client/windows/crash_generation/crash_generation_client.cc
|
||||
+++ b/src/client/windows/crash_generation/crash_generation_client.cc
|
||||
@@ -280,13 +280,13 @@ HANDLE CrashGenerationClient::ConnectToPipe(const wchar_t* pipe_name,
|
||||
}
|
||||
|
||||
for (int i = 0; i < kPipeConnectMaxAttempts; ++i) {
|
||||
- HANDLE pipe = CreateFile(pipe_name,
|
||||
- pipe_access,
|
||||
- 0,
|
||||
- NULL,
|
||||
- OPEN_EXISTING,
|
||||
- flags_attrs,
|
||||
- NULL);
|
||||
+ HANDLE pipe = CreateFileW(pipe_name,
|
||||
+ pipe_access,
|
||||
+ 0,
|
||||
+ NULL,
|
||||
+ OPEN_EXISTING,
|
||||
+ flags_attrs,
|
||||
+ NULL);
|
||||
if (pipe != INVALID_HANDLE_VALUE) {
|
||||
return pipe;
|
||||
}
|
||||
@@ -298,7 +298,7 @@ HANDLE CrashGenerationClient::ConnectToPipe(const wchar_t* pipe_name,
|
||||
}
|
||||
|
||||
// Cannot continue retrying if wait on pipe fails.
|
||||
- if (!WaitNamedPipe(pipe_name, kPipeBusyWaitTimeoutMs)) {
|
||||
+ if (!WaitNamedPipeW(pipe_name, kPipeBusyWaitTimeoutMs)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -376,9 +376,9 @@ bool CrashGenerationClient::SignalCrashEventAndWait() {
|
||||
HANDLE CrashGenerationClient::DuplicatePipeToClientProcess(const wchar_t* pipe_name,
|
||||
HANDLE hProcess) {
|
||||
for (int i = 0; i < kPipeConnectMaxAttempts; ++i) {
|
||||
- HANDLE local_pipe = CreateFile(pipe_name, kPipeDesiredAccess,
|
||||
- 0, NULL, OPEN_EXISTING,
|
||||
- kPipeFlagsAndAttributes, NULL);
|
||||
+ HANDLE local_pipe = CreateFileW(pipe_name, kPipeDesiredAccess,
|
||||
+ 0, NULL, OPEN_EXISTING,
|
||||
+ kPipeFlagsAndAttributes, NULL);
|
||||
if (local_pipe != INVALID_HANDLE_VALUE) {
|
||||
HANDLE remotePipe = INVALID_HANDLE_VALUE;
|
||||
if (DuplicateHandle(GetCurrentProcess(), local_pipe,
|
||||
@@ -395,7 +395,7 @@ HANDLE CrashGenerationClient::DuplicatePipeToClientProcess(const wchar_t* pipe_n
|
||||
return INVALID_HANDLE_VALUE;
|
||||
}
|
||||
|
||||
- if (!WaitNamedPipe(pipe_name, kPipeBusyWaitTimeoutMs)) {
|
||||
+ if (!WaitNamedPipeW(pipe_name, kPipeBusyWaitTimeoutMs)) {
|
||||
return INVALID_HANDLE_VALUE;
|
||||
}
|
||||
}
|
||||
diff --git a/src/client/windows/crash_generation/crash_generation_server.cc b/src/client/windows/crash_generation/crash_generation_server.cc
|
||||
index 0af213ba..619ced43 100644
|
||||
--- a/src/client/windows/crash_generation/crash_generation_server.cc
|
||||
+++ b/src/client/windows/crash_generation/crash_generation_server.cc
|
||||
@@ -239,14 +239,14 @@ bool CrashGenerationServer::Start() {
|
||||
return false;
|
||||
}
|
||||
|
||||
- pipe_ = CreateNamedPipe(pipe_name_.c_str(),
|
||||
- kPipeAttr,
|
||||
- kPipeMode,
|
||||
- 1,
|
||||
- kOutBufferSize,
|
||||
- kInBufferSize,
|
||||
- 0,
|
||||
- pipe_sec_attrs_);
|
||||
+ pipe_ = CreateNamedPipeW(pipe_name_.c_str(),
|
||||
+ kPipeAttr,
|
||||
+ kPipeMode,
|
||||
+ 1,
|
||||
+ kOutBufferSize,
|
||||
+ kInBufferSize,
|
||||
+ 0,
|
||||
+ pipe_sec_attrs_);
|
||||
if (pipe_ == INVALID_HANDLE_VALUE) {
|
||||
return false;
|
||||
}
|
||||
diff --git a/src/client/windows/crash_generation/minidump_generator.cc b/src/client/windows/crash_generation/minidump_generator.cc
|
||||
index 573c2786..f274e502 100644
|
||||
--- a/src/client/windows/crash_generation/minidump_generator.cc
|
||||
+++ b/src/client/windows/crash_generation/minidump_generator.cc
|
||||
@@ -468,13 +468,13 @@ bool MinidumpGenerator::GenerateDumpFile(wstring* dump_path) {
|
||||
return false;
|
||||
}
|
||||
|
||||
- dump_file_ = CreateFile(dump_file_path.c_str(),
|
||||
- GENERIC_WRITE,
|
||||
- 0,
|
||||
- NULL,
|
||||
- CREATE_NEW,
|
||||
- FILE_ATTRIBUTE_NORMAL,
|
||||
- NULL);
|
||||
+ dump_file_ = CreateFileW(dump_file_path.c_str(),
|
||||
+ GENERIC_WRITE,
|
||||
+ 0,
|
||||
+ NULL,
|
||||
+ CREATE_NEW,
|
||||
+ FILE_ATTRIBUTE_NORMAL,
|
||||
+ NULL);
|
||||
if (dump_file_ == INVALID_HANDLE_VALUE) {
|
||||
return false;
|
||||
}
|
||||
@@ -501,15 +501,15 @@ bool MinidumpGenerator::GenerateFullDumpFile(wstring* full_dump_path) {
|
||||
return false;
|
||||
}
|
||||
full_dump_file_path.resize(full_dump_file_path.size() - 4); // strip .dmp
|
||||
- full_dump_file_path.append(TEXT("-full.dmp"));
|
||||
-
|
||||
- full_dump_file_ = CreateFile(full_dump_file_path.c_str(),
|
||||
- GENERIC_WRITE,
|
||||
- 0,
|
||||
- NULL,
|
||||
- CREATE_NEW,
|
||||
- FILE_ATTRIBUTE_NORMAL,
|
||||
- NULL);
|
||||
+ full_dump_file_path.append(TEXT(L"-full.dmp"));
|
||||
+
|
||||
+ full_dump_file_ = CreateFileW(full_dump_file_path.c_str(),
|
||||
+ GENERIC_WRITE,
|
||||
+ 0,
|
||||
+ NULL,
|
||||
+ CREATE_NEW,
|
||||
+ FILE_ATTRIBUTE_NORMAL,
|
||||
+ NULL);
|
||||
if (full_dump_file_ == INVALID_HANDLE_VALUE) {
|
||||
return false;
|
||||
}
|
||||
@@ -576,7 +576,7 @@ bool MinidumpGenerator::GenerateDumpFilePath(wstring* file_path) {
|
||||
|
||||
wstring id_str = GUIDString::GUIDToWString(&uuid_);
|
||||
|
||||
- *file_path = dump_path_ + TEXT("\\") + id_str + TEXT(".dmp");
|
||||
+ *file_path = dump_path_ + TEXT(L"\\") + id_str + TEXT(L".dmp");
|
||||
return true;
|
||||
}
|
||||
|
||||
diff --git a/src/client/windows/handler/exception_handler.cc b/src/client/windows/handler/exception_handler.cc
|
||||
index ad45b200..99783ad0 100644
|
||||
--- a/src/client/windows/handler/exception_handler.cc
|
||||
+++ b/src/client/windows/handler/exception_handler.cc
|
||||
@@ -226,7 +226,7 @@ void ExceptionHandler::Initialize(
|
||||
assert(handler_thread_ != NULL);
|
||||
}
|
||||
|
||||
- dbghelp_module_ = LoadLibrary(L"dbghelp.dll");
|
||||
+ dbghelp_module_ = LoadLibraryW(L"dbghelp.dll");
|
||||
if (dbghelp_module_) {
|
||||
minidump_write_dump_ = reinterpret_cast<MiniDumpWriteDump_type>(
|
||||
GetProcAddress(dbghelp_module_, "MiniDumpWriteDump"));
|
||||
@@ -235,7 +235,7 @@ void ExceptionHandler::Initialize(
|
||||
// Load this library dynamically to not affect existing projects. Most
|
||||
// projects don't link against this directly, it's usually dynamically
|
||||
// loaded by dependent code.
|
||||
- rpcrt4_module_ = LoadLibrary(L"rpcrt4.dll");
|
||||
+ rpcrt4_module_ = LoadLibraryW(L"rpcrt4.dll");
|
||||
if (rpcrt4_module_) {
|
||||
uuid_create_ = reinterpret_cast<UuidCreate_type>(
|
||||
GetProcAddress(rpcrt4_module_, "UuidCreate"));
|
||||
@@ -917,13 +917,13 @@ bool ExceptionHandler::WriteMinidumpWithExceptionForProcess(
|
||||
bool write_requester_stream) {
|
||||
bool success = false;
|
||||
if (minidump_write_dump_) {
|
||||
- HANDLE dump_file = CreateFile(next_minidump_path_c_,
|
||||
- GENERIC_WRITE,
|
||||
- 0, // no sharing
|
||||
- NULL,
|
||||
- CREATE_NEW, // fail if exists
|
||||
- FILE_ATTRIBUTE_NORMAL,
|
||||
- NULL);
|
||||
+ HANDLE dump_file = CreateFileW(next_minidump_path_c_,
|
||||
+ GENERIC_WRITE,
|
||||
+ 0, // no sharing
|
||||
+ NULL,
|
||||
+ CREATE_NEW, // fail if exists
|
||||
+ FILE_ATTRIBUTE_NORMAL,
|
||||
+ NULL);
|
||||
if (dump_file != INVALID_HANDLE_VALUE) {
|
||||
MINIDUMP_EXCEPTION_INFORMATION except_info;
|
||||
except_info.ThreadId = requesting_thread_id;
|
||||
--
|
||||
2.28.0
|
||||
|
@ -0,0 +1,27 @@
|
||||
From 61f9afe7d83da074a72f563e419bffa9d3948154 Mon Sep 17 00:00:00 2001
|
||||
From: Danny Robson <danny@nerdcruft.net>
|
||||
Date: Mon, 17 Feb 2020 14:38:43 +1100
|
||||
Subject: [PATCH 7/7] string_conversion: workaround GCC10 codegen bug
|
||||
|
||||
---
|
||||
src/common/string_conversion.cc | 4 +++-
|
||||
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/common/string_conversion.cc b/src/common/string_conversion.cc
|
||||
index 11d60a36..bcc54576 100644
|
||||
--- a/src/common/string_conversion.cc
|
||||
+++ b/src/common/string_conversion.cc
|
||||
@@ -115,7 +115,9 @@ void UTF32ToUTF16Char(wchar_t in, uint16_t out[2]) {
|
||||
}
|
||||
|
||||
static inline uint16_t Swap(uint16_t value) {
|
||||
- return (value >> 8) | static_cast<uint16_t>(value << 8);
|
||||
+ // HACK: Use addition rather than bitwise-or to workaround an internal
|
||||
+ // compiler bug in AST generator for left-rotate under GCC-10_pre.
|
||||
+ return (value >> 8u) + static_cast<uint16_t>(value << 8u);
|
||||
}
|
||||
|
||||
string UTF16ToUTF8(const vector<uint16_t> &in, bool swap) {
|
||||
--
|
||||
2.28.0
|
||||
|
38
recipes/libcurl/all/conandata.yml
Normal file
38
recipes/libcurl/all/conandata.yml
Normal file
@ -0,0 +1,38 @@
|
||||
sources:
|
||||
"7.72.0":
|
||||
sha256: d4d5899a3868fbb6ae1856c3e55a32ce35913de3956d1973caccd37bd0174fa2
|
||||
url: https://curl.haxx.se/download/curl-7.72.0.tar.gz
|
||||
"7.71.1":
|
||||
sha256: 59ef1f73070de67b87032c72ee6037cedae71dcb1d7ef2d7f59487704aec069d
|
||||
url: https://curl.haxx.se/download/curl-7.71.1.tar.gz
|
||||
"7.71.0":
|
||||
sha256: 62b2b1acee40c4de5a4913e27a4b4194813cf2b7815b73febec7ae53054646ca
|
||||
url: https://curl.haxx.se/download/curl-7.71.0.tar.gz
|
||||
"7.70.0":
|
||||
sha256: ca2feeb8ef13368ce5d5e5849a5fd5e2dd4755fecf7d8f0cc94000a4206fb8e7
|
||||
url: https://curl.haxx.se/download/curl-7.70.0.tar.gz
|
||||
"7.69.1":
|
||||
sha256: 01ae0c123dee45b01bbaef94c0bc00ed2aec89cb2ee0fd598e0d302a6b5e0a98
|
||||
url: https://curl.haxx.se/download/curl-7.69.1.tar.gz
|
||||
"7.68.0":
|
||||
sha256: 1dd7604e418b0b9a9077f62f763f6684c1b092a7bc17e3f354b8ad5c964d7358
|
||||
url: https://curl.haxx.se/download/curl-7.68.0.tar.gz
|
||||
"7.67.0":
|
||||
sha256: 52af3361cf806330b88b4fe6f483b6844209d47ae196ac46da4de59bb361ab02
|
||||
url: https://curl.haxx.se/download/curl-7.67.0.tar.gz
|
||||
"7.66.0":
|
||||
sha256: d0393da38ac74ffac67313072d7fe75b1fa1010eb5987f63f349b024a36b7ffb
|
||||
url: https://curl.haxx.se/download/curl-7.66.0.tar.gz
|
||||
"7.64.1":
|
||||
sha256: 432d3f466644b9416bc5b649d344116a753aeaa520c8beaf024a90cba9d3d35d
|
||||
url: https://curl.haxx.se/download/curl-7.64.1.tar.gz
|
||||
patches:
|
||||
"7.67.0":
|
||||
- patch_file: "patches/001-Update-FindLibSSH2.cmake-add-libssh2-as-possible-nam.patch"
|
||||
base_path: "source_subfolder"
|
||||
"7.66.0":
|
||||
- patch_file: "patches/001-Update-FindLibSSH2.cmake-add-libssh2-as-possible-nam.patch"
|
||||
base_path: "source_subfolder"
|
||||
"7.64.1":
|
||||
- patch_file: "patches/001-Update-FindLibSSH2.cmake-add-libssh2-as-possible-nam.patch"
|
||||
base_path: "source_subfolder"
|
564
recipes/libcurl/all/conanfile.py
Normal file
564
recipes/libcurl/all/conanfile.py
Normal file
@ -0,0 +1,564 @@
|
||||
import glob
|
||||
import os
|
||||
import re
|
||||
from conans import ConanFile, AutoToolsBuildEnvironment, RunEnvironment, CMake, tools
|
||||
from conans.errors import ConanInvalidConfiguration
|
||||
|
||||
|
||||
class LibcurlConan(ConanFile):
|
||||
name = "libcurl"
|
||||
|
||||
description = "command line tool and library for transferring data with URLs"
|
||||
topics = ("conan", "curl", "libcurl", "data-transfer")
|
||||
url = "https://github.com/conan-io/conan-center-index"
|
||||
homepage = "https://curl.haxx.se"
|
||||
license = "MIT"
|
||||
exports_sources = ["lib_Makefile_add.am", "CMakeLists.txt", "patches/*"]
|
||||
generators = "cmake", "cmake_find_package_multi", "pkg_config"
|
||||
|
||||
settings = "os", "arch", "compiler", "build_type"
|
||||
options = {"shared": [True, False],
|
||||
"fPIC": [True, False],
|
||||
"with_ssl": [False, "openssl", "wolfssl", "schannel", "darwinssl"],
|
||||
"with_openssl": [True, False],
|
||||
"with_wolfssl": [True, False],
|
||||
"with_winssl": [True, False],
|
||||
"darwin_ssl": [True, False],
|
||||
"with_ldap": [True, False],
|
||||
"with_libssh2": [True, False],
|
||||
"with_libidn": [True, False],
|
||||
"with_librtmp": [True, False],
|
||||
"with_libmetalink": [True, False],
|
||||
"with_libpsl": [True, False],
|
||||
"with_largemaxwritesize": [True, False],
|
||||
"with_nghttp2": [True, False],
|
||||
"with_zlib": [True, False],
|
||||
"with_brotli": [True, False]
|
||||
}
|
||||
default_options = {"shared": False,
|
||||
"fPIC": True,
|
||||
"with_ssl": "openssl",
|
||||
"with_openssl": True, # deprecated
|
||||
"with_wolfssl": False, # deprecated
|
||||
"with_winssl": False, # deprecated
|
||||
"darwin_ssl": True, # deprecated
|
||||
"with_ldap": False,
|
||||
"with_libssh2": False,
|
||||
"with_libidn": False,
|
||||
"with_librtmp": False,
|
||||
"with_libmetalink": False,
|
||||
"with_libpsl": False,
|
||||
"with_largemaxwritesize": False,
|
||||
"with_nghttp2": False,
|
||||
"with_zlib": True,
|
||||
"with_brotli": False
|
||||
}
|
||||
|
||||
_autotools = None
|
||||
_autotools_vars = None
|
||||
_cmake = None
|
||||
|
||||
@property
|
||||
def _source_subfolder(self):
|
||||
return "source_subfolder"
|
||||
|
||||
@property
|
||||
def _build_subfolder(self):
|
||||
return "build_subfolder"
|
||||
|
||||
@property
|
||||
def _is_mingw(self):
|
||||
return self.settings.os == "Windows" and self.settings.compiler != "Visual Studio"
|
||||
|
||||
@property
|
||||
def _is_win_x_android(self):
|
||||
return self.settings.os == "Android" and tools.os_info.is_windows
|
||||
|
||||
@property
|
||||
def _is_using_cmake_build(self):
|
||||
return self.settings.compiler == "Visual Studio" or self._is_win_x_android
|
||||
|
||||
def config_options(self):
|
||||
if self.settings.os == "Windows":
|
||||
del self.options.fPIC
|
||||
# Default options
|
||||
if tools.is_apple_os(self.settings.os):
|
||||
self.options.with_ssl = "darwinssl"
|
||||
self.options.with_openssl = False
|
||||
self.options.with_wolfssl = False
|
||||
self.options.with_winssl = False
|
||||
self.options.darwin_ssl = True
|
||||
else:
|
||||
self.options.with_ssl = "openssl"
|
||||
self.options.with_openssl = True
|
||||
self.options.with_wolfssl = False
|
||||
self.options.with_winssl = False
|
||||
self.options.darwin_ssl = False
|
||||
|
||||
def configure(self):
|
||||
if self.options.shared:
|
||||
del self.options.fPIC
|
||||
del self.settings.compiler.libcxx
|
||||
del self.settings.compiler.cppstd
|
||||
|
||||
# Deprecated options
|
||||
# ===============================
|
||||
self.output.warn("with_openssl, with_winssl, darwin_ssl and with_wolfssl options are deprecated. Use with_ssl option instead.")
|
||||
if tools.is_apple_os(self.settings.os) and self.options.with_ssl == "darwinssl":
|
||||
if self.options.darwin_ssl:
|
||||
self.options.with_ssl = "darwinssl"
|
||||
elif self.options.with_openssl:
|
||||
self.options.with_ssl = "openssl"
|
||||
elif self.options.with_wolfssl:
|
||||
self.options.with_ssl = "wolfssl"
|
||||
else:
|
||||
self.options.with_ssl = False
|
||||
if not tools.is_apple_os(self.settings.os) and self.options.with_ssl == "openssl":
|
||||
if self.settings.os == "Windows" and self.options.with_winssl:
|
||||
self.options.with_ssl = "schannel"
|
||||
elif self.options.with_openssl:
|
||||
self.options.with_ssl = "openssl"
|
||||
elif self.options.with_wolfssl:
|
||||
self.options.with_ssl = "wolfssl"
|
||||
else:
|
||||
self.options.with_ssl = False
|
||||
del self.options.with_openssl
|
||||
del self.options.with_winssl
|
||||
del self.options.darwin_ssl
|
||||
del self.options.with_wolfssl
|
||||
# ===============================
|
||||
|
||||
if self.options.with_ssl == "schannel" and self.settings.os != "Windows":
|
||||
raise ConanInvalidConfiguration("schannel only suppported on Windows.")
|
||||
if self.options.with_ssl == "darwinssl" and not tools.is_apple_os(self.settings.os):
|
||||
raise ConanInvalidConfiguration("darwinssl only suppported on Apple like OS (Macos, iOS, watchOS or tvOS).")
|
||||
if self.options.with_ssl == "wolfssl" and self._is_using_cmake_build and tools.Version(self.version) < "7.70.0":
|
||||
raise ConanInvalidConfiguration("Before 7.70.0, libcurl has no wolfssl support for Visual Studio or \"Windows to Android cross compilation\"")
|
||||
|
||||
# These options are not used in CMake build yet
|
||||
if self._is_using_cmake_build:
|
||||
del self.options.with_libidn
|
||||
del self.options.with_librtmp
|
||||
del self.options.with_libmetalink
|
||||
del self.options.with_libpsl
|
||||
|
||||
def requirements(self):
|
||||
if self.options.with_ssl == "openssl":
|
||||
self.requires("openssl/1.1.1g")
|
||||
elif self.options.with_ssl == "wolfssl":
|
||||
self.requires("wolfssl/4.4.0")
|
||||
if self.options.with_nghttp2:
|
||||
self.requires("libnghttp2/1.40.0")
|
||||
if self.options.with_libssh2:
|
||||
self.requires("libssh2/1.9.0")
|
||||
if self.options.with_zlib:
|
||||
self.requires("zlib/1.2.11")
|
||||
if self.options.with_brotli:
|
||||
self.requires("brotli/1.0.7")
|
||||
|
||||
def build_requirements(self):
|
||||
if self._is_mingw and tools.os_info.is_windows and not tools.get_env("CONAN_BASH_PATH") and \
|
||||
tools.os_info.detect_windows_subsystem() != "msys2":
|
||||
self.build_requires("msys2/20200517")
|
||||
elif self._is_win_x_android:
|
||||
self.build_requires("ninja/1.10.0")
|
||||
elif not tools.os_info.is_windows:
|
||||
self.build_requires("libtool/2.4.6")
|
||||
|
||||
def source(self):
|
||||
tools.get(**self.conan_data["sources"][self.version])
|
||||
os.rename("curl-%s" % self.version, self._source_subfolder)
|
||||
tools.download("https://curl.haxx.se/ca/cacert.pem", "cacert.pem", verify=True)
|
||||
|
||||
def imports(self):
|
||||
# Copy shared libraries for dependencies to fix DYLD_LIBRARY_PATH problems
|
||||
#
|
||||
# Configure script creates conftest that cannot execute without shared openssl binaries.
|
||||
# Ways to solve the problem:
|
||||
# 1. set *LD_LIBRARY_PATH (works with Linux with RunEnvironment
|
||||
# but does not work on OS X 10.11 with SIP)
|
||||
# 2. copying dylib's to the build directory (fortunately works on OS X)
|
||||
if self.settings.os == "Macos":
|
||||
self.copy("*.dylib*", dst=self._source_subfolder, keep_path=False)
|
||||
|
||||
def build(self):
|
||||
self._patch_sources()
|
||||
self._patch_misc_files()
|
||||
if self._is_using_cmake_build:
|
||||
self._build_with_cmake()
|
||||
else:
|
||||
self._build_with_autotools()
|
||||
|
||||
def _patch_sources(self):
|
||||
for patch in self.conan_data.get("patches", {}).get(self.version, []):
|
||||
tools.patch(**patch)
|
||||
|
||||
def _patch_misc_files(self):
|
||||
if self.options.with_largemaxwritesize:
|
||||
tools.replace_in_file(os.path.join(self._source_subfolder, "include", "curl", "curl.h"),
|
||||
"define CURL_MAX_WRITE_SIZE 16384",
|
||||
"define CURL_MAX_WRITE_SIZE 10485760")
|
||||
|
||||
# https://github.com/curl/curl/issues/2835
|
||||
# for additional info, see this comment https://github.com/conan-io/conan-center-index/pull/1008#discussion_r386122685
|
||||
if self.settings.compiler == "apple-clang" and self.settings.compiler.version == "9.1":
|
||||
if self.options.with_ssl == "darwinssl":
|
||||
tools.replace_in_file(os.path.join(self._source_subfolder, "lib", "vtls", "sectransp.c"),
|
||||
"#define CURL_BUILD_MAC_10_13 MAC_OS_X_VERSION_MAX_ALLOWED >= 101300",
|
||||
"#define CURL_BUILD_MAC_10_13 0")
|
||||
|
||||
def _get_configure_command_args(self):
|
||||
params = []
|
||||
params.append("--without-libidn2" if not self.options.with_libidn else "--with-libidn2")
|
||||
params.append("--without-librtmp" if not self.options.with_librtmp else "--with-librtmp")
|
||||
params.append("--without-libmetalink" if not self.options.with_libmetalink else "--with-libmetalink")
|
||||
params.append("--without-libpsl" if not self.options.with_libpsl else "--with-libpsl")
|
||||
|
||||
if self.options.with_ssl == "openssl":
|
||||
params.append("--with-ssl={}".format(tools.unix_path(self.deps_cpp_info["openssl"].rootpath)))
|
||||
elif self.options.with_ssl == "wolfssl":
|
||||
params.append("--with-wolfssl={}".format(tools.unix_path(self.deps_cpp_info["wolfssl"].rootpath)))
|
||||
params.append("--without-ssl")
|
||||
elif self.options.with_ssl == "schannel":
|
||||
params.append("--with-schannel")
|
||||
params.append("--without-ssl")
|
||||
elif self.options.with_ssl == "darwinssl":
|
||||
params.append("--with-darwinssl")
|
||||
params.append("--without-ssl")
|
||||
else:
|
||||
params.append("--without-ssl")
|
||||
|
||||
if self.options.with_libssh2:
|
||||
params.append("--with-libssh2={}".format(tools.unix_path(self.deps_cpp_info["libssh2"].lib_paths[0])))
|
||||
else:
|
||||
params.append("--without-libssh2")
|
||||
|
||||
if self.options.with_nghttp2:
|
||||
params.append("--with-nghttp2={}".format(tools.unix_path(self.deps_cpp_info["libnghttp2"].rootpath)))
|
||||
else:
|
||||
params.append("--without-nghttp2")
|
||||
|
||||
if self.options.with_zlib:
|
||||
params.append("--with-zlib={}".format(tools.unix_path(self.deps_cpp_info["zlib"].lib_paths[0])))
|
||||
else:
|
||||
params.append("--without-zlib")
|
||||
|
||||
params.append("--with-brotli" if self.options.with_brotli else "--without-brotli")
|
||||
|
||||
if not self.options.shared:
|
||||
params.append("--disable-shared")
|
||||
params.append("--enable-static")
|
||||
else:
|
||||
params.append("--enable-shared")
|
||||
params.append("--disable-static")
|
||||
|
||||
if not self.options.with_ldap:
|
||||
params.append("--disable-ldap")
|
||||
|
||||
if self.settings.build_type == "Debug":
|
||||
params.append("--enable-debug")
|
||||
|
||||
# Cross building flags
|
||||
if tools.cross_building(self.settings):
|
||||
if self.settings.os == "Linux" and "arm" in self.settings.arch:
|
||||
params.append("--host=%s" % self._get_linux_arm_host())
|
||||
elif self.settings.os == "iOS":
|
||||
params.append("--enable-threaded-resolver")
|
||||
params.append("--disable-verbose")
|
||||
elif self.settings.os == "Android":
|
||||
pass # this just works, conan is great!
|
||||
|
||||
return params
|
||||
|
||||
def _get_linux_arm_host(self):
|
||||
arch = None
|
||||
if self.settings.os == "Linux":
|
||||
arch = "arm-linux-gnu"
|
||||
# aarch64 could be added by user
|
||||
if "aarch64" in self.settings.arch:
|
||||
arch = "aarch64-linux-gnu"
|
||||
elif "arm" in self.settings.arch and "hf" in self.settings.arch:
|
||||
arch = "arm-linux-gnueabihf"
|
||||
elif "arm" in self.settings.arch and self._arm_version(str(self.settings.arch)) > 4:
|
||||
arch = "arm-linux-gnueabi"
|
||||
return arch
|
||||
|
||||
# TODO, this should be a inner fuction of _get_linux_arm_host since it is only used from there
|
||||
# it should not polute the class namespace, since there are iOS and Android arm aritectures also
|
||||
def _arm_version(self, arch):
|
||||
version = None
|
||||
match = re.match(r"arm\w*(\d)", arch)
|
||||
if match:
|
||||
version = int(match.group(1))
|
||||
return version
|
||||
|
||||
def _patch_mingw_files(self):
|
||||
if not self._is_mingw:
|
||||
return
|
||||
# patch autotools files
|
||||
# for mingw builds - do not compile curl tool, just library
|
||||
# linking errors are much harder to fix than to exclude curl tool
|
||||
tools.replace_in_file("Makefile.am",
|
||||
"SUBDIRS = lib src",
|
||||
"SUBDIRS = lib")
|
||||
|
||||
tools.replace_in_file("Makefile.am",
|
||||
"include src/Makefile.inc",
|
||||
"")
|
||||
|
||||
# patch for zlib naming in mingw
|
||||
# when cross-building, the name is correct
|
||||
if not tools.cross_building(self.settings):
|
||||
tools.replace_in_file("configure.ac",
|
||||
"-lz ",
|
||||
"-lzlib ")
|
||||
|
||||
# patch for openssl extras in mingw
|
||||
if self.options.with_ssl == "openssl":
|
||||
tools.replace_in_file("configure",
|
||||
"-lcrypto ",
|
||||
"-lcrypto -lcrypt32 ")
|
||||
|
||||
if self.options.shared:
|
||||
# patch for shared mingw build
|
||||
tools.replace_in_file(os.path.join("lib", "Makefile.am"),
|
||||
"noinst_LTLIBRARIES = libcurlu.la",
|
||||
"")
|
||||
tools.replace_in_file(os.path.join("lib", "Makefile.am"),
|
||||
"noinst_LTLIBRARIES =",
|
||||
"")
|
||||
tools.replace_in_file(os.path.join("lib", "Makefile.am"),
|
||||
"lib_LTLIBRARIES = libcurl.la",
|
||||
"noinst_LTLIBRARIES = libcurl.la")
|
||||
# add directives to build dll
|
||||
# used only for native mingw-make
|
||||
if not tools.cross_building(self.settings):
|
||||
added_content = tools.load(os.path.join(self.source_folder, "lib_Makefile_add.am"))
|
||||
tools.save(os.path.join("lib", "Makefile.am"), added_content, append=True)
|
||||
|
||||
def _build_with_autotools(self):
|
||||
with tools.chdir(self._source_subfolder):
|
||||
# autoreconf
|
||||
self.run("./buildconf", win_bash=tools.os_info.is_windows, run_environment=True)
|
||||
|
||||
# fix generated autotools files on alle to have relocateable binaries
|
||||
if tools.is_apple_os(self.settings.os):
|
||||
tools.replace_in_file("configure", "-install_name \\$rpath/", "-install_name ")
|
||||
|
||||
self.run("chmod +x configure")
|
||||
|
||||
env_run = RunEnvironment(self)
|
||||
# run configure with *LD_LIBRARY_PATH env vars it allows to pick up shared openssl
|
||||
self.output.info("Run vars: " + repr(env_run.vars))
|
||||
with tools.environment_append(env_run.vars):
|
||||
autotools, autotools_vars = self._configure_autotools()
|
||||
autotools.make(vars=autotools_vars)
|
||||
|
||||
def _configure_autotools_vars(self):
|
||||
autotools_vars = self._autotools.vars
|
||||
# tweaks for mingw
|
||||
if self._is_mingw:
|
||||
autotools_vars["RCFLAGS"] = "-O COFF"
|
||||
if self.settings.arch == "x86":
|
||||
autotools_vars["RCFLAGS"] += " --target=pe-i386"
|
||||
else:
|
||||
autotools_vars["RCFLAGS"] += " --target=pe-x86-64"
|
||||
|
||||
del autotools_vars["LIBS"]
|
||||
self.output.info("Autotools env vars: " + repr(autotools_vars))
|
||||
|
||||
if tools.cross_building(self.settings):
|
||||
if self.settings.os == "iOS":
|
||||
iphoneos = tools.apple_sdk_name(self.settings)
|
||||
ios_dev_target = str(self.settings.os.version).split(".")[0]
|
||||
|
||||
env_cppflags = tools.get_env("CPPFLAGS", "")
|
||||
socket_flags = " -DHAVE_SOCKET -DHAVE_FCNTL_O_NONBLOCK"
|
||||
if self.settings.arch in ["x86", "x86_64"]:
|
||||
autotools_vars["CPPFLAGS"] = "-D__IPHONE_OS_VERSION_MIN_REQUIRED={}0000 {} {}".format(
|
||||
ios_dev_target, socket_flags , env_cppflags)
|
||||
elif self.settings.arch in ["armv7", "armv7s", "armv8"]:
|
||||
autotools_vars["CPPFLAGS"] = "{} {}".format(socket_flags, env_cppflags)
|
||||
else:
|
||||
raise ConanInvalidConfiguration("Unsuported iOS arch {}".format(self.settings.arch))
|
||||
|
||||
cc = tools.XCRun(self.settings, iphoneos).cc
|
||||
sysroot = "-isysroot {}".format(tools.XCRun(self.settings, iphoneos).sdk_path)
|
||||
|
||||
if self.settings.arch == "armv8":
|
||||
configure_arch = "arm64"
|
||||
configure_host = "arm" #unused, autodetected
|
||||
else:
|
||||
configure_arch = self.settings.arch
|
||||
configure_host = self.settings.arch #unused, autodetected
|
||||
|
||||
|
||||
arch_flag = "-arch {}".format(configure_arch)
|
||||
ios_min_version = tools.apple_deployment_target_flag(self.settings.os, self.settings.os.version)
|
||||
extra_flag = "-Werror=partial-availability"
|
||||
|
||||
# if we debug, maybe add a -gdwarf-2 , but why would we want that?
|
||||
|
||||
autotools_vars["CC"] = cc
|
||||
autotools_vars["IPHONEOS_DEPLOYMENT_TARGET"] = ios_dev_target
|
||||
env_cflags = tools.get_env("CFLAGS", "")
|
||||
autotools_vars["CFLAGS"] = "{} {} {} {}".format(
|
||||
sysroot, arch_flag, ios_min_version, env_cflags
|
||||
)
|
||||
|
||||
if self.options.with_ssl == "openssl":
|
||||
openssl_path = self.deps_cpp_info["openssl"].rootpath
|
||||
openssl_libdir = self.deps_cpp_info["openssl"].libdirs[0]
|
||||
autotools_vars["LDFLAGS"] = "{} {} -L{}/{}".format(arch_flag, sysroot, openssl_path, openssl_libdir)
|
||||
elif self.options.with_ssl == "wolfssl":
|
||||
wolfssl_path = self.deps_cpp_info["wolfssl"].rootpath
|
||||
wolfssl_libdir = self.deps_cpp_info["wolfssl"].libdirs[0]
|
||||
autotools_vars["LDFLAGS"] = "{} {} -L{}/{}".format(arch_flag, sysroot, wolfssl_path, wolfssl_libdir)
|
||||
else:
|
||||
autotools_vars["LDFLAGS"] = "{} {}".format(arch_flag, sysroot)
|
||||
|
||||
elif self.settings.os == "Android":
|
||||
# nothing do to at the moment, this seems to just work
|
||||
pass
|
||||
|
||||
return autotools_vars
|
||||
|
||||
def _configure_autotools(self):
|
||||
if self._autotools and self._autotools_vars:
|
||||
return self._autotools, self._autotools_vars
|
||||
|
||||
self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows)
|
||||
|
||||
if self.settings.os != "Windows":
|
||||
self._autotools.fpic = self.options.get_safe("fPIC", True)
|
||||
|
||||
self._autotools_vars = self._configure_autotools_vars()
|
||||
|
||||
# tweaks for mingw
|
||||
if self._is_mingw:
|
||||
# patch autotools files
|
||||
self._patch_mingw_files()
|
||||
|
||||
self._autotools.defines.append("_AMD64_")
|
||||
|
||||
configure_args = self._get_configure_command_args()
|
||||
|
||||
if self.settings.os == "iOS" and self.settings.arch == "x86_64":
|
||||
# please do not autodetect --build for the iOS simulator, thanks!
|
||||
self._autotools.configure(vars=self._autotools_vars, args=configure_args, build=False)
|
||||
else:
|
||||
self._autotools.configure(vars=self._autotools_vars, args=configure_args)
|
||||
|
||||
return self._autotools, self._autotools_vars
|
||||
|
||||
def _configure_cmake(self):
|
||||
if self._cmake:
|
||||
return self._cmake
|
||||
if self._is_win_x_android:
|
||||
self._cmake = CMake(self, generator="Ninja")
|
||||
else:
|
||||
self._cmake = CMake(self)
|
||||
self._cmake.definitions["BUILD_TESTING"] = False
|
||||
self._cmake.definitions["BUILD_CURL_EXE"] = False
|
||||
self._cmake.definitions["CURL_DISABLE_LDAP"] = not self.options.with_ldap
|
||||
self._cmake.definitions["BUILD_SHARED_LIBS"] = self.options.shared
|
||||
self._cmake.definitions["CURL_STATICLIB"] = not self.options.shared
|
||||
self._cmake.definitions["CMAKE_DEBUG_POSTFIX"] = ""
|
||||
self._cmake.definitions["CMAKE_USE_SCHANNEL"] = self.options.with_ssl == "schannel"
|
||||
self._cmake.definitions["CMAKE_USE_OPENSSL"] = self.options.with_ssl == "openssl"
|
||||
if tools.Version(self.version) >= "7.70.0":
|
||||
self._cmake.definitions["CMAKE_USE_WOLFSSL"] = self.options.with_ssl == "wolfssl"
|
||||
self._cmake.definitions["USE_NGHTTP2"] = self.options.with_nghttp2
|
||||
self._cmake.definitions["CURL_ZLIB"] = self.options.with_zlib
|
||||
self._cmake.definitions["CURL_BROTLI"] = self.options.with_brotli
|
||||
self._cmake.definitions["CMAKE_USE_LIBSSH2"] = self.options.with_libssh2
|
||||
self._cmake.configure(build_folder=self._build_subfolder)
|
||||
return self._cmake
|
||||
|
||||
def _build_with_cmake(self):
|
||||
# patch cmake files
|
||||
with tools.chdir(self._source_subfolder):
|
||||
tools.replace_in_file("CMakeLists.txt",
|
||||
"include(CurlSymbolHiding)",
|
||||
"")
|
||||
|
||||
cmake = self._configure_cmake()
|
||||
cmake.build()
|
||||
|
||||
def package(self):
|
||||
self.copy("COPYING", dst="licenses", src=self._source_subfolder)
|
||||
self.copy("cacert.pem", dst="res")
|
||||
if self._is_using_cmake_build:
|
||||
cmake = self._configure_cmake()
|
||||
cmake.install()
|
||||
tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
|
||||
else:
|
||||
env_run = RunEnvironment(self)
|
||||
with tools.environment_append(env_run.vars):
|
||||
with tools.chdir(self._source_subfolder):
|
||||
autotools, autotools_vars = self._configure_autotools()
|
||||
autotools.install(vars=autotools_vars)
|
||||
tools.rmdir(os.path.join(self.package_folder, "share"))
|
||||
for la_file in glob.glob(os.path.join(self.package_folder, "lib", "*.la")):
|
||||
os.remove(la_file)
|
||||
if self._is_mingw and self.options.shared:
|
||||
# Handle only mingw libs
|
||||
self.copy(pattern="*.dll", dst="bin", keep_path=False)
|
||||
self.copy(pattern="*.dll.a", dst="lib", keep_path=False)
|
||||
self.copy(pattern="*.lib", dst="lib", keep_path=False)
|
||||
tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig"))
|
||||
|
||||
def package_info(self):
|
||||
self.cpp_info.names["cmake_find_package"] = "CURL"
|
||||
self.cpp_info.names["cmake_find_package_multi"] = "CURL"
|
||||
self.cpp_info.names["pkg_config"] = "libcurl"
|
||||
self.cpp_info.components["curl"].names["cmake_find_package"] = "libcurl"
|
||||
self.cpp_info.components["curl"].names["cmake_find_package_multi"] = "libcurl"
|
||||
self.cpp_info.components["curl"].names["pkg_config"] = "libcurl"
|
||||
|
||||
if self.settings.compiler == "Visual Studio":
|
||||
self.cpp_info.components["curl"].libs = ["libcurl_imp"] if self.options.shared else ["libcurl"]
|
||||
else:
|
||||
self.cpp_info.components["curl"].libs = ["curl"]
|
||||
if self.settings.os == "Linux":
|
||||
if self.options.with_libidn:
|
||||
self.cpp_info.components["curl"].libs.append("idn")
|
||||
if self.options.with_librtmp:
|
||||
self.cpp_info.components["curl"].libs.append("rtmp")
|
||||
|
||||
if self.settings.os == "Linux":
|
||||
self.cpp_info.components["curl"].system_libs = ["rt", "pthread"]
|
||||
elif self.settings.os == "Windows":
|
||||
# used on Windows for VS build, native and cross mingw build
|
||||
self.cpp_info.components["curl"].system_libs = ["ws2_32"]
|
||||
if self.options.with_ldap:
|
||||
self.cpp_info.components["curl"].system_libs.append("wldap32")
|
||||
if self.options.with_ssl == "schannel":
|
||||
self.cpp_info.components["curl"].system_libs.append("Crypt32")
|
||||
elif self.settings.os == "Macos":
|
||||
if self.options.with_ldap:
|
||||
self.cpp_info.components["curl"].system_libs.append("ldap")
|
||||
if self.options.with_ssl == "darwinssl":
|
||||
self.cpp_info.components["curl"].frameworks.extend(["Cocoa", "Security"])
|
||||
|
||||
if self._is_mingw:
|
||||
# provide pthread for dependent packages
|
||||
self.cpp_info.components["curl"].cflags.append("-pthread")
|
||||
self.cpp_info.components["curl"].exelinkflags.append("-pthread")
|
||||
self.cpp_info.components["curl"].sharedlinkflags.append("-pthread")
|
||||
|
||||
if not self.options.shared:
|
||||
self.cpp_info.components["curl"].defines.append("CURL_STATICLIB=1")
|
||||
|
||||
if self.options.with_ssl == "openssl":
|
||||
self.cpp_info.components["curl"].requires.append("openssl::openssl")
|
||||
if self.options.with_ssl == "wolfssl":
|
||||
self.cpp_info.components["curl"].requires.append("wolfssl::wolfssl")
|
||||
if self.options.with_nghttp2:
|
||||
self.cpp_info.components["curl"].requires.append("libnghttp2::libnghttp2")
|
||||
if self.options.with_libssh2:
|
||||
self.cpp_info.components["curl"].requires.append("libssh2::libssh2")
|
||||
if self.options.with_zlib:
|
||||
self.cpp_info.components["curl"].requires.append("zlib::zlib")
|
||||
if self.options.with_brotli:
|
||||
self.cpp_info.components["curl"].requires.append("brotli::brotli")
|
@ -0,0 +1,16 @@
|
||||
diff --git a/CMake/FindLibSSH2.cmake b/CMake/FindLibSSH2.cmake
|
||||
index 84822dba7..0d6219425 100644
|
||||
--- a/CMake/FindLibSSH2.cmake
|
||||
+++ b/CMake/FindLibSSH2.cmake
|
||||
@@ -12,7 +12,7 @@ endif()
|
||||
find_path(LIBSSH2_INCLUDE_DIR libssh2.h
|
||||
)
|
||||
|
||||
-find_library(LIBSSH2_LIBRARY NAMES ssh2
|
||||
+find_library(LIBSSH2_LIBRARY NAMES ssh2 libssh2
|
||||
)
|
||||
|
||||
if(LIBSSH2_INCLUDE_DIR)
|
||||
--
|
||||
2.24.0.windows.2
|
||||
|
19
recipes/libcurl/config.yml
Normal file
19
recipes/libcurl/config.yml
Normal file
@ -0,0 +1,19 @@
|
||||
versions:
|
||||
"7.72.0":
|
||||
folder: all
|
||||
"7.71.1":
|
||||
folder: all
|
||||
"7.71.0":
|
||||
folder: all
|
||||
"7.70.0":
|
||||
folder: all
|
||||
"7.69.1":
|
||||
folder: all
|
||||
"7.68.0":
|
||||
folder: all
|
||||
"7.67.0":
|
||||
folder: all
|
||||
"7.66.0":
|
||||
folder: all
|
||||
"7.64.1":
|
||||
folder: all
|
1
requirements.txt
Normal file
1
requirements.txt
Normal file
@ -0,0 +1 @@
|
||||
conan
|
Loading…
Reference in New Issue
Block a user