forked from msys2/MINGW-packages
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path0013-Add-symsrv_convert.patch
More file actions
187 lines (177 loc) · 6.59 KB
/
Copy path0013-Add-symsrv_convert.patch
File metadata and controls
187 lines (177 loc) · 6.59 KB
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
From 13006b6efec2f865f2cef484458b3329158090c7 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 13/29] 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 +++++
.../windows/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 c98333a3..9e542cbe 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 dace8860..a7e4bbd2
--- 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 71b77097..551502b2
--- a/src/tools/windows/converter/ms_symbol_server_converter.cc
+++ b/src/tools/windows/converter/ms_symbol_server_converter.cc
@@ -422,7 +422,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 d601b433..82aaea06
--- a/src/tools/windows/converter/ms_symbol_server_converter.h
+++ b/src/tools/windows/converter/ms_symbol_server_converter.h
@@ -199,8 +199,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.15.0