forked from msys2/MINGW-packages
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path0006-Fix-building-minidump-processor-for-MinGW.patch
246 lines (213 loc) · 7.02 KB
/
0006-Fix-building-minidump-processor-for-MinGW.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
From c36077c1411e0195dc852a8a515768d090495def Mon Sep 17 00:00:00 2001
From: Jon TURNEY <[email protected]>
Date: Fri, 11 Jul 2014 23:37:02 +0100
Subject: [PATCH 06/24] Fix building minidump processor 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
- Link minidump_stackwalk, minidump_dump with PTHREAD_LIBS as pthread_cancel is used
- Link minidump_stackwalk with ws2_32 as ntoh functions are used
- Don't try to build upload tools, dump_syms_dwarf for MinGW
- _s function variants should only be used if _MSC_VER, use _r variants with
MinGW (and define _POSIX to ensure they are prototyped)
- Don't try to include arpa/inet.h on Windows
Signed-off-by: Jon TURNEY <[email protected]>
---
Makefile.am | 17 +++++++++++++++--
configure.ac | 6 ++++++
src/google_breakpad/common/breakpad_types.h | 2 ++
src/processor/basic_source_line_resolver.cc | 2 +-
src/processor/binarystream.cc | 2 ++
src/processor/cfi_frame_info.cc | 2 +-
src/processor/logging.cc | 4 ++--
src/processor/minidump.cc | 2 +-
src/processor/tokenize.cc | 2 +-
9 files changed, 31 insertions(+), 8 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index c802304..4d291e7 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -66,6 +66,11 @@ if WINDOWS_HOST
AM_CPPFLAGS += -DNO_STABS_SUPPORT
endif
+if MINGW_HOST
+SOCKET_LIBS = -lws2_32
+AM_CPPFLAGS += -D_POSIX
+endif
+
# Specify include paths for ac macros
ACLOCAL_AMFLAGS = -I m4
@@ -308,11 +313,13 @@ bin_PROGRAMS += \
src/processor/minidump_stackwalk
endif !DISABLE_PROCESSOR
+if !MINGW_HOST
if !DISABLE_TOOLS
bin_PROGRAMS += \
src/tools/common/symupload/minidump_upload \
src/tools/common/symupload/sym_upload
endif
+endif
if LINUX_HOST
bin_PROGRAMS += \
@@ -327,11 +334,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
@@ -625,6 +634,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 \
@@ -641,6 +651,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 = \
@@ -1130,7 +1141,8 @@ src_processor_minidump_dump_LDADD = \
src/processor/dump_object.o \
src/processor/logging.o \
src/processor/minidump.o \
- src/processor/pathname_stripper.o
+ src/processor/pathname_stripper.o \
+ $(PTHREAD_CFLAGS) $(PTHREAD_LIBS)
src_processor_minidump_stackwalk_SOURCES = \
src/processor/minidump_stackwalk.cc
@@ -1125,7 +1125,8 @@
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
@@ -1166,7 +1178,8 @@ src_processor_minidump_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)
endif !DISABLE_PROCESSOR
diff --git a/configure.ac b/configure.ac
index aeccf19..a2b9287 100644
--- a/configure.ac
+++ b/configure.ac
@@ -83,10 +83,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/google_breakpad/common/breakpad_types.h b/src/google_breakpad/common/breakpad_types.h
index e92436f..c50a3a9 100644
--- a/src/google_breakpad/common/breakpad_types.h
+++ b/src/google_breakpad/common/breakpad_types.h
@@ -61,9 +61,11 @@
#include <wtypes.h>
typedef unsigned __int8 uint8_t;
+typedef __int16 int16_t;
typedef unsigned __int16 uint16_t;
typedef __int32 int32_t;
typedef unsigned __int32 uint32_t;
+typedef __int64 int64_t;
typedef unsigned __int64 uint64_t;
#endif
diff --git a/src/processor/basic_source_line_resolver.cc b/src/processor/basic_source_line_resolver.cc
index 62aa413..1d4d0e9 100644
--- a/src/processor/basic_source_line_resolver.cc
+++ b/src/processor/basic_source_line_resolver.cc
@@ -55,7 +55,7 @@ using std::make_pair;
namespace google_breakpad {
-#ifdef _WIN32
+#ifdef _MSC_VER
#define strtok_r strtok_s
#define strtoull _strtoui64
#endif
diff --git a/src/processor/binarystream.cc b/src/processor/binarystream.cc
index bf92225..96f0693 100644
--- a/src/processor/binarystream.cc
+++ b/src/processor/binarystream.cc
@@ -27,7 +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.
+#ifndef _WIN32
#include <arpa/inet.h>
+#endif
#include <limits.h>
#include <string>
diff --git a/src/processor/cfi_frame_info.cc b/src/processor/cfi_frame_info.cc
index 5106ba0..0c4af7b 100644
--- a/src/processor/cfi_frame_info.cc
+++ b/src/processor/cfi_frame_info.cc
@@ -43,7 +43,7 @@
namespace google_breakpad {
-#ifdef _WIN32
+#ifdef _MSC_VER
#define strtok_r strtok_s
#endif
diff --git a/src/processor/logging.cc b/src/processor/logging.cc
index 8bb95a6..45072bc 100644
--- a/src/processor/logging.cc
+++ b/src/processor/logging.cc
@@ -45,7 +45,7 @@
#include "processor/logging.h"
#include "processor/pathname_stripper.h"
-#ifdef _WIN32
+#ifdef _MSC_VER
#define snprintf _snprintf
#endif
@@ -57,7 +57,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 a4bf55a..1a79676 100644
--- a/src/processor/minidump.cc
+++ b/src/processor/minidump.cc
@@ -372,7 +372,7 @@ static 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);
diff --git a/src/processor/tokenize.cc b/src/processor/tokenize.cc
index f468120..8fce87a 100644
--- a/src/processor/tokenize.cc
+++ b/src/processor/tokenize.cc
@@ -36,7 +36,7 @@
namespace google_breakpad {
-#ifdef _WIN32
+#ifdef _MSC_VER
#define strtok_r strtok_s
#endif
--
2.1.1