forked from msys2/MINGW-packages
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
breakpad-svn: Import patches to repo. Fix building last revision.
- Loading branch information
Showing
26 changed files
with
8,418 additions
and
16 deletions.
There are no files selected for viewing
42 changes: 42 additions & 0 deletions
42
mingw-w64-breakpad-svn/0002-Avoid-O_BINARY-redefinition-warning-on-Cygwin.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
From eb32eb8c96d3948823b8467dd1837aa3d3c5ec27 Mon Sep 17 00:00:00 2001 | ||
From: Jon TURNEY <[email protected]> | ||
Date: Sat, 12 Jul 2014 13:33:47 +0100 | ||
Subject: [PATCH 02/24] Avoid O_BINARY redefinition warning on Cygwin | ||
|
||
Avoid O_BINARY redefinition warning compiling processor for Cygwin | ||
|
||
On Cygwin, WIN32 not defined, but O_BINARY is defined by fcntl.h, so avoid a | ||
redefinition warning. | ||
|
||
../src/processor/minidump.cc:55:0: warning: "O_BINARY" redefined [enabled by default] | ||
#define O_BINARY 0 | ||
^ | ||
In file included from /usr/include/sys/fcntl.h:3:0, | ||
from /usr/include/fcntl.h:14, | ||
from ../src/processor/minidump.cc:39: | ||
/usr/include/sys/_default_fcntl.h:52:0: note: this is the location of the previous definition | ||
#define O_BINARY _FBINARY | ||
^ | ||
|
||
Signed-off-by: Jon TURNEY <[email protected]> | ||
--- | ||
src/processor/minidump.cc | 2 ++ | ||
1 file changed, 2 insertions(+) | ||
|
||
diff --git a/src/processor/minidump.cc b/src/processor/minidump.cc | ||
index 8ae260d..a4bf55a 100644 | ||
--- a/src/processor/minidump.cc | ||
+++ b/src/processor/minidump.cc | ||
@@ -49,7 +49,9 @@ | ||
#define snprintf _snprintf | ||
#else // _WIN32 | ||
#include <unistd.h> | ||
+#ifndef O_BINARY | ||
#define O_BINARY 0 | ||
+#endif | ||
#endif // _WIN32 | ||
|
||
#include <fstream> | ||
-- | ||
2.1.1 | ||
|
293 changes: 293 additions & 0 deletions
293
mingw-w64-breakpad-svn/0003-Build-minidump_upload-sym_upload-for-all-targets.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,293 @@ | ||
From 1ffcd61fc7d6ba537faa40641d0422574672b12f Mon Sep 17 00:00:00 2001 | ||
From: Jon TURNEY <[email protected]> | ||
Date: Mon, 3 Feb 2014 23:57:22 +0000 | ||
Subject: [PATCH 03/24] Build minidump_upload, sym_upload for all targets | ||
|
||
Rather than duplicating these tools for any target which has libcurl | ||
- Introduce src/tools/common/ and move minidump_upload, sym_upload there from src/tools/linux/ | ||
- Move linux/http_upload.cc,.h up to src/common/ from src/common/linux/ | ||
|
||
Don't link with -ldl and use dlopen to use libcurl.so, but just link with | ||
libcurl. | ||
|
||
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 not | ||
linking with libcurl are obscure... | ||
|
||
Signed-off-by: Jon TURNEY <[email protected]> | ||
--- | ||
Makefile.am | 30 ++++--- | ||
src/common/{linux => }/http_upload.cc | 94 +++++----------------- | ||
src/common/{linux => }/http_upload.h | 0 | ||
.../{linux => common}/symupload/minidump_upload.cc | 2 +- | ||
.../{linux => common}/symupload/sym_upload.cc | 2 +- | ||
5 files changed, 39 insertions(+), 89 deletions(-) | ||
rename src/common/{linux => }/http_upload.cc (60%) | ||
rename src/common/{linux => }/http_upload.h (100%) | ||
rename src/tools/{linux => common}/symupload/minidump_upload.cc (99%) | ||
rename src/tools/{linux => common}/symupload/sym_upload.cc (99%) | ||
|
||
diff --git a/Makefile.am b/Makefile.am | ||
index 1e3279f..6246c9c 100644 | ||
--- a/Makefile.am | ||
+++ b/Makefile.am | ||
@@ -303,6 +303,12 @@ bin_PROGRAMS += \ | ||
src/processor/minidump_stackwalk | ||
endif !DISABLE_PROCESSOR | ||
|
||
+if !DISABLE_TOOLS | ||
+bin_PROGRAMS += \ | ||
+ src/tools/common/symupload/minidump_upload \ | ||
+ src/tools/common/symupload/sym_upload | ||
+endif | ||
+ | ||
if LINUX_HOST | ||
bin_PROGRAMS += \ | ||
src/client/linux/linux_dumper_unittest_helper | ||
@@ -311,9 +317,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 | ||
endif | ||
endif LINUX_HOST | ||
|
||
@@ -391,6 +395,16 @@ else | ||
LOG_DRIVER = $(top_srcdir)/autotools/test-driver | ||
endif | ||
|
||
+src_tools_common_symupload_minidump_upload_SOURCES = \ | ||
+ src/common/http_upload.cc \ | ||
+ src/tools/common/symupload/minidump_upload.cc | ||
+src_tools_common_symupload_minidump_upload_LDADD = -lcurl | ||
+ | ||
+src_tools_common_symupload_sym_upload_SOURCES = \ | ||
+ src/common/http_upload.cc \ | ||
+ src/tools/common/symupload/sym_upload.cc | ||
+src_tools_common_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 | ||
@@ -526,16 +540,6 @@ src_tools_linux_md2core_minidump_2_core_SOURCES = \ | ||
src/common/linux/memory_mapped_file.cc \ | ||
src/tools/linux/md2core/minidump-2-core.cc | ||
|
||
-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_sym_upload_SOURCES = \ | ||
- src/common/linux/http_upload.cc \ | ||
- src/tools/linux/symupload/sym_upload.cc | ||
-src_tools_linux_symupload_sym_upload_LDADD = -ldl | ||
- | ||
src_common_dumper_unittest_SOURCES = \ | ||
src/common/byte_cursor_unittest.cc \ | ||
src/common/dwarf_cfi_to_module.cc \ | ||
diff --git a/src/common/linux/http_upload.cc b/src/common/http_upload.cc | ||
similarity index 60% | ||
rename from src/common/linux/http_upload.cc | ||
rename to src/common/http_upload.cc | ||
index d49f227..47dcf80 100644 | ||
--- a/src/common/linux/http_upload.cc | ||
+++ b/src/common/http_upload.cc | ||
@@ -27,10 +27,9 @@ | ||
// (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 "common/linux/http_upload.h" | ||
+#include "common/http_upload.h" | ||
|
||
#include <assert.h> | ||
-#include <dlfcn.h> | ||
#include "third_party/curl/curl.h" | ||
|
||
namespace { | ||
@@ -70,50 +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 (!curl_lib || dlsym(curl_lib, "curl_easy_init") == NULL) { | ||
- 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); | ||
// Set proxy information if necessary. | ||
if (!proxy.empty()) | ||
(*curl_easy_setopt)(curl, CURLOPT_PROXY, proxy.c_str()); | ||
@@ -126,73 +88,57 @@ 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 file. | ||
- (*curl_formadd)(&formpost, &lastptr, | ||
+ curl_formadd(&formpost, &lastptr, | ||
CURLFORM_COPYNAME, file_part_name.c_str(), | ||
CURLFORM_FILE, upload_file.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; | ||
} | ||
|
||
diff --git a/src/common/linux/http_upload.h b/src/common/http_upload.h | ||
similarity index 100% | ||
rename from src/common/linux/http_upload.h | ||
rename to src/common/http_upload.h | ||
diff --git a/src/tools/linux/symupload/minidump_upload.cc b/src/tools/common/symupload/minidump_upload.cc | ||
similarity index 99% | ||
rename from src/tools/linux/symupload/minidump_upload.cc | ||
rename to src/tools/common/symupload/minidump_upload.cc | ||
index 94c3492..f1146ac 100644 | ||
--- a/src/tools/linux/symupload/minidump_upload.cc | ||
+++ b/src/tools/common/symupload/minidump_upload.cc | ||
@@ -40,7 +40,7 @@ | ||
|
||
#include <string> | ||
|
||
-#include "common/linux/http_upload.h" | ||
+#include "common/http_upload.h" | ||
#include "common/using_std_string.h" | ||
|
||
using google_breakpad::HTTPUpload; | ||
diff --git a/src/tools/linux/symupload/sym_upload.cc b/src/tools/common/symupload/sym_upload.cc | ||
similarity index 99% | ||
rename from src/tools/linux/symupload/sym_upload.cc | ||
rename to src/tools/common/symupload/sym_upload.cc | ||
index 09e82ca..bc2693e 100644 | ||
--- a/src/tools/linux/symupload/sym_upload.cc | ||
+++ b/src/tools/common/symupload/sym_upload.cc | ||
@@ -49,7 +49,7 @@ | ||
#include <string> | ||
#include <vector> | ||
|
||
-#include "common/linux/http_upload.h" | ||
+#include "common/http_upload.h" | ||
#include "common/using_std_string.h" | ||
|
||
using google_breakpad::HTTPUpload; | ||
-- | ||
2.1.1 | ||
|
Oops, something went wrong.