]>
Commit | Line | Data |
---|---|---|
9a6604f5 JR |
1 | --- fpcbuild-2.6.4/fpcsrc/packages/gdbint/src/gdbint.pp.orig 2013-08-07 20:58:05.756050489 +0200 |
2 | +++ fpcbuild-2.6.4/fpcsrc/packages/gdbint/src/gdbint.pp 2013-08-07 21:09:31.746021701 +0200 | |
3c782031 JB |
3 | @@ -14,6 +14,7 @@ |
4 | unit GdbInt; | |
5 | ||
6 | {$mode objfpc} | |
7 | +{$smartlink off} | |
8 | ||
9 | {$define NotImplemented} | |
10 | ||
9a6604f5 | 11 | @@ -39,83 +40,94 @@ |
3c782031 JB |
12 | |
13 | interface | |
14 | ||
15 | -{$smartlink off} | |
16 | ||
04dae7e9 | 17 | |
3c782031 JB |
18 | { Is create_breakpoint_hook deprecated? } |
19 | { Seem not so for 6.1 } | |
20 | {$define GDB_HAS_DEPRECATED_CBPH} | |
21 | ||
22 | -{ 6.1.x } | |
23 | -{$ifdef GDB_V601} | |
24 | - {$info using gdb 6.1.x} | |
25 | - {$define GDB_V6} | |
26 | - {$undef GDB_HAS_DEPRECATED_CBPH} | |
27 | -{$endif def GDB_V601} | |
9a6604f5 | 28 | |
3c782031 JB |
29 | -{ 6.2.x } |
30 | -{$ifdef GDB_V602} | |
31 | - {$info using gdb 6.2.x} | |
32 | - {$define GDB_V6} | |
33 | -{$endif def GDB_V602} | |
9a6604f5 JR |
34 | +{ |
35 | + Excatly one | |
36 | + GDB_VXYZ macro | |
37 | + where XYZ are three numbers | |
38 | + needs to defined | |
39 | + either inside gdblib.inc or gdbver.inc | |
40 | + This corresponds to version | |
41 | + X.YZ.patch_level | |
42 | +} | |
43 | ||
3c782031 JB |
44 | -{ 6.3.x } |
45 | -{$ifdef GDB_V603} | |
46 | - {$info using gdb 6.3.x} | |
47 | - {$define GDB_V6} | |
48 | -{$endif def GDB_V603} | |
9a6604f5 | 49 | +{$undef GDB_VERSION_RECOGNIZED} |
3c782031 JB |
50 | |
51 | -{ 6.4.x } | |
52 | -{$ifdef GDB_V604} | |
53 | - {$info using gdb 6.4.x} | |
54 | - {$define GDB_V6} | |
55 | - {$define GDB_NEEDS_NO_ERROR_INIT} | |
56 | -{$endif def GDB_V604} | |
9a6604f5 JR |
57 | +{ 7.9.x } |
58 | +{$ifdef GDB_V709} | |
59 | + {$info using gdb 7.9.x} | |
60 | + {$define GDB_VERSION_RECOGNIZED} | |
61 | + {$define GDB_VER_GE_709} | |
62 | +{$endif} | |
3c782031 JB |
63 | |
64 | -{ 6.5.x } | |
65 | -{$ifdef GDB_V605} | |
66 | - {$info using gdb 6.5.x} | |
67 | - {$define GDB_V6} | |
68 | - {$define GDB_NEEDS_NO_ERROR_INIT} | |
69 | -{$endif def GDB_V605} | |
9a6604f5 JR |
70 | +{$ifdef GDB_VER_GE_709} |
71 | + {$define GDB_VER_GE_708} | |
72 | +{$endif} | |
3c782031 JB |
73 | |
74 | -{ 6.6.x } | |
75 | -{$ifdef GDB_V606} | |
76 | - {$info using gdb 6.6.x} | |
77 | - {$define GDB_V6} | |
78 | - {$define GDB_USES_BP_LOCATION} | |
79 | - {$define GDB_NEEDS_NO_ERROR_INIT} | |
80 | - {$define GDB_USES_EXPAT_LIB} | |
81 | - {$define GDB_HAS_DEBUG_FILE_DIRECTORY} | |
82 | -{$endif def GDB_V606} | |
9a6604f5 JR |
83 | +{ 7.8.x } |
84 | +{$ifdef GDB_V708} | |
85 | + {$info using gdb 7.8.x} | |
3c782031 | 86 | + {$define GDB_VERSION_RECOGNIZED} |
9a6604f5 | 87 | + {$define GDB_VER_GE_708} |
3c782031 JB |
88 | +{$endif} |
89 | ||
90 | -{ 6.7.x } | |
91 | -{$ifdef GDB_V607} | |
92 | - {$info using gdb 6.7.x} | |
93 | - {$define GDB_V6} | |
94 | - {$define GDB_USES_BP_LOCATION} | |
95 | - {$define GDB_NEEDS_NO_ERROR_INIT} | |
96 | - {$define GDB_USES_EXPAT_LIB} | |
97 | - {$define GDB_HAS_DEBUG_FILE_DIRECTORY} | |
98 | -{$endif def GDB_V607} | |
9a6604f5 JR |
99 | +{$ifdef GDB_VER_GE_708} |
100 | + {$define USE_CATCH_EXCEPTIONS} | |
101 | + {$define USE_LOCAL_SET_GDB_DATA_DIRECTORY} | |
102 | + {$define GDB_VER_GE_707} | |
3c782031 JB |
103 | +{$endif} |
104 | ||
105 | -{ 6.8.x } | |
106 | -{$ifdef GDB_V608} | |
107 | - {$info using gdb 6.8.x} | |
108 | - {$define GDB_V6} | |
109 | - {$define GDB_USES_BP_LOCATION} | |
110 | - {$define GDB_BP_LOCATION_HAS_GLOBAL_NEXT} | |
111 | - {$define GDB_NEEDS_NO_ERROR_INIT} | |
112 | - {$define GDB_USES_EXPAT_LIB} | |
113 | - {$define GDB_HAS_DEBUG_FILE_DIRECTORY} | |
114 | - {$define GDB_USES_LIBDECNUMBER} | |
115 | - // {$define GDB_HAS_OBSERVER_NOTIFY_BREAKPOINT_CREATED} | |
116 | - {$define GDB_HAS_BP_NONE} | |
117 | -{$endif def GDB_V608} | |
9a6604f5 JR |
118 | +{ 7.7.x } |
119 | +{$ifdef GDB_V707} | |
120 | + {$info using gdb 7.7.x} | |
121 | + {$define GDB_VERSION_RECOGNIZED} | |
122 | + {$define GDB_VER_GE_707} | |
123 | +{$endif} | |
124 | + | |
125 | +{$ifdef GDB_VER_GE_707} | |
126 | + {$define GDB_VER_GE_706} | |
127 | +{$endif} | |
128 | + | |
129 | +{ 7.6.x } | |
130 | +{$ifdef GDB_V706} | |
131 | + {$info using gdb 7.6.x} | |
132 | + {$define GDB_VERSION_RECOGNIZED} | |
133 | + {$define GDB_VER_GE_706} | |
134 | +{$endif} | |
135 | + | |
136 | +{$ifdef GDB_VER_GE_706} | |
137 | + {$define GDB_UI_FILE_HAS_FSEEK} | |
138 | + {$define GDB_VER_GE_705} | |
139 | +{$endif} | |
140 | + | |
141 | +{ 7.5.x } | |
142 | +{$ifdef GDB_V705} | |
143 | + {$info using gdb 7.5.x} | |
144 | + {$define GDB_VERSION_RECOGNIZED} | |
145 | + {$define GDB_VER_GE_705} | |
146 | +{$endif} | |
147 | + | |
3c782031 JB |
148 | +{$ifdef GDB_VER_GE_705} |
149 | + {$define GDB_VER_GE_704} | |
150 | + {$define GDB_BP_LOCATION_HAS_COND_BYTECODE} | |
151 | + {$define GDB_BP_LOCATION_HAS_RELATED_ADDRESS} | |
9a6604f5 | 152 | + {$define GDB_BP_HAS_ENABLE_COUNT} |
3c782031 JB |
153 | +{$endif} |
154 | ||
9e9ea3c1 KK |
155 | { 7.4.x } |
156 | {$ifdef GDB_V704} | |
157 | {$info using gdb 7.4.x} | |
3c782031 JB |
158 | + {$define GDB_VERSION_RECOGNIZED} |
159 | + {$define GDB_VER_GE_704} | |
160 | +{$endif} | |
161 | + | |
162 | +{$ifdef GDB_VER_GE_704} | |
163 | {$define GDB_V7} | |
164 | {$define GDB_BP_LOCATION_HAS_GDBARCH} | |
165 | {$define GDB_HAS_PROGRAM_SPACE} | |
9a6604f5 | 166 | @@ -131,11 +143,12 @@ |
3c782031 JB |
167 | {$ifdef win32} |
168 | {$define GDB_USES_LIBADVAPI32} | |
169 | {$endif win32} | |
170 | -{$endif def GDB_V704} | |
171 | +{$endif def GDB_VER_GE_704} | |
172 | ||
173 | { 7.3.x } | |
174 | {$ifdef GDB_V703} | |
175 | {$info using gdb 7.3.x} | |
176 | + {$define GDB_VERSION_RECOGNIZED} | |
177 | {$define GDB_V7} | |
178 | {$define GDB_BP_LOCATION_HAS_GDBARCH} | |
179 | {$define GDB_HAS_PROGRAM_SPACE} | |
9a6604f5 | 180 | @@ -150,11 +163,13 @@ |
3c782031 JB |
181 | {$define GDB_BP_LOCATION_HAS_OPS} |
182 | {$define GDB_UI_FILE_HAS_WRITE_ASYNC} | |
183 | {$endif GDB_CVS} | |
184 | + {$define GDB_VERSION_RECOGNIZED} | |
185 | {$endif def GDB_V703} | |
186 | ||
187 | { 7.2.x } | |
188 | {$ifdef GDB_V702} | |
189 | {$info using gdb 7.2.x} | |
190 | + {$define GDB_VERSION_RECOGNIZED} | |
191 | {$define GDB_V7} | |
192 | {$define GDB_BP_LOCATION_HAS_GDBARCH} | |
193 | {$define GDB_HAS_PROGRAM_SPACE} | |
9a6604f5 | 194 | @@ -163,6 +178,7 @@ |
3c782031 JB |
195 | { 7.1.x } |
196 | {$ifdef GDB_V701} | |
197 | {$info using gdb 7.1.x} | |
198 | + {$define GDB_VERSION_RECOGNIZED} | |
199 | {$define GDB_V7} | |
200 | {$define GDB_BP_LOCATION_HAS_GDBARCH} | |
201 | {$define GDB_HAS_PROGRAM_SPACE} | |
9a6604f5 | 202 | @@ -173,6 +189,7 @@ |
3c782031 JB |
203 | { 7.0.x } |
204 | {$ifdef GDB_V700} | |
205 | {$info using gdb 7.0.x} | |
206 | + {$define GDB_VERSION_RECOGNIZED} | |
207 | {$define GDB_V7} | |
208 | {$ifdef GDB_CVS} | |
209 | {$define GDB_BP_LOCATION_HAS_GDBARCH} | |
9a6604f5 | 210 | @@ -197,9 +214,92 @@ |
3c782031 JB |
211 | {$define GDB_HAS_OBSERVER_NOTIFY_BREAKPOINT_CREATED} |
212 | {$define GDB_TARGET_CLOSE_HAS_PTARGET_ARG} | |
213 | {$define GDB_HAS_BP_NONE} | |
214 | + {$define GDB_USE_XSTRVPRINTF} | |
215 | {$endif def GDB_V7} | |
216 | ||
217 | ||
218 | +{ 6.8.x } | |
219 | +{$ifdef GDB_V608} | |
220 | + {$info using gdb 6.8.x} | |
221 | + {$define GDB_VERSION_RECOGNIZED} | |
222 | + {$define GDB_V6} | |
223 | + {$define GDB_USES_BP_LOCATION} | |
224 | + {$define GDB_BP_LOCATION_HAS_GLOBAL_NEXT} | |
225 | + {$define GDB_NEEDS_NO_ERROR_INIT} | |
226 | + {$define GDB_USES_EXPAT_LIB} | |
227 | + {$define GDB_HAS_DEBUG_FILE_DIRECTORY} | |
228 | + {$define GDB_USES_LIBDECNUMBER} | |
229 | + // {$define GDB_HAS_OBSERVER_NOTIFY_BREAKPOINT_CREATED} | |
230 | + {$define GDB_HAS_BP_NONE} | |
231 | +{$endif def GDB_V608} | |
232 | + | |
233 | +{ 6.7.x } | |
234 | +{$ifdef GDB_V607} | |
235 | + {$info using gdb 6.7.x} | |
236 | + {$define GDB_VERSION_RECOGNIZED} | |
237 | + {$define GDB_V6} | |
238 | + {$define GDB_USES_BP_LOCATION} | |
239 | + {$define GDB_NEEDS_NO_ERROR_INIT} | |
240 | + {$define GDB_USES_EXPAT_LIB} | |
241 | + {$define GDB_HAS_DEBUG_FILE_DIRECTORY} | |
242 | +{$endif def GDB_V607} | |
243 | + | |
244 | +{ 6.6.x } | |
245 | +{$ifdef GDB_V606} | |
246 | + {$info using gdb 6.6.x} | |
247 | + {$define GDB_VERSION_RECOGNIZED} | |
248 | + {$define GDB_V6} | |
249 | + {$define GDB_USES_BP_LOCATION} | |
250 | + {$define GDB_NEEDS_NO_ERROR_INIT} | |
251 | + {$define GDB_USES_EXPAT_LIB} | |
9a6604f5 | 252 | + {Official 6.6 release doesn't have GDB_HAS_DEBUG_FILE_DIRECTORY} |
3c782031 JB |
253 | +{$endif def GDB_V606} |
254 | + | |
255 | +{ 6.5.x } | |
256 | +{$ifdef GDB_V605} | |
257 | + {$info using gdb 6.5.x} | |
258 | + {$define GDB_VERSION_RECOGNIZED} | |
259 | + {$define GDB_V6} | |
260 | + {$define GDB_NEEDS_NO_ERROR_INIT} | |
261 | +{$endif def GDB_V605} | |
262 | + | |
263 | +{ 6.4.x } | |
264 | +{$ifdef GDB_V604} | |
265 | + {$info using gdb 6.4.x} | |
266 | + {$define GDB_VERSION_RECOGNIZED} | |
267 | + {$define GDB_V6} | |
268 | + {$define GDB_NEEDS_NO_ERROR_INIT} | |
269 | +{$endif def GDB_V604} | |
270 | + | |
271 | +{ 6.3.x } | |
272 | +{$ifdef GDB_V603} | |
273 | + {$info using gdb 6.3.x} | |
274 | + {$define GDB_VERSION_RECOGNIZED} | |
275 | + {$define GDB_V6} | |
276 | +{$endif def GDB_V603} | |
277 | + | |
278 | +{ 6.2.x } | |
279 | +{$ifdef GDB_V602} | |
280 | + {$info using gdb 6.2.x} | |
281 | + {$define GDB_VERSION_RECOGNIZED} | |
282 | + {$define GDB_V6} | |
283 | +{$endif def GDB_V602} | |
284 | + | |
285 | +{ 6.1.x } | |
286 | +{$ifdef GDB_V601} | |
287 | + {$info using gdb 6.1.x} | |
288 | + {$define GDB_VERSION_RECOGNIZED} | |
289 | + {$define GDB_V6} | |
290 | + {$undef GDB_HAS_DEPRECATED_CBPH} | |
291 | +{$endif def GDB_V601} | |
292 | + | |
293 | +{ 6.0.x } | |
294 | +{$ifdef GDB_V600} | |
295 | + {$info using gdb 6.0.x} | |
296 | + {$define GDB_VERSION_RECOGNIZED} | |
297 | + {$define GDB_V6} | |
298 | +{$endif def GDB_V600} | |
299 | + | |
300 | {$ifdef GDB_V6} | |
301 | {$define GDB_HAS_SYSROOT} | |
302 | {$define GDB_HAS_DB_COMMANDS} | |
9a6604f5 | 303 | @@ -207,6 +307,10 @@ |
3c782031 JB |
304 | {$define GDB_INIT_HAS_ARGV0} |
305 | {$endif GDB_V6} | |
306 | ||
307 | +{$ifdef GDB_VERSION_RECOGNIZED} | |
308 | + {$warning no recognized GDB_VXYZ conditional found, linking might fail. } | |
309 | +{$endif} | |
310 | + | |
311 | ||
312 | {$ifdef GDB_HAS_OBSERVER_NOTIFY_BREAKPOINT_CREATED} | |
313 | {$define DO_NOT_USE_CBPH} | |
9a6604f5 JR |
314 | @@ -426,9 +530,9 @@ |
315 | {$ifdef NotImplemented} | |
316 | {$undef NotImplemented} | |
317 | {$LINKLIB libgdb.a} | |
318 | - {$ifdef GDB_HAS_SIM} | |
319 | - {$LINKLIB libsim.a} | |
320 | - {$endif GDB_HAS_SIM} | |
321 | + {$ifdef GDB_HAS_SIM} | |
322 | + {$LINKLIB libsim.a} | |
323 | + {$endif GDB_HAS_SIM} | |
324 | {$LINKLIB libbfd.a} | |
325 | {$LINKLIB libreadline.a} | |
326 | {$LINKLIB libopcodes.a} | |
327 | @@ -552,6 +656,11 @@ | |
328 | {$LINKLIB gcc} | |
329 | {$endif beos} | |
330 | ||
331 | +{$ifdef aix} | |
332 | + { AIX linker requires more precise external/public separation } | |
333 | + {$define NEED_EXTERNAL_CVAR} | |
334 | + {$undef NotImplemented} | |
335 | +{$endif aix} | |
336 | ||
337 | {$ifdef go32v2} | |
338 | {$define supportexceptions} | |
339 | @@ -631,6 +740,9 @@ | |
340 | {$ifdef GDB_V6} | |
341 | ui_file_read_ftype = function (stream : pui_file; buffer : pchar; len : longint):longint;cdecl; | |
342 | {$endif} | |
343 | + {$ifdef GDB_UI_FILE_HAS_FSEEK} | |
344 | + ui_file_fseek_ftype = function (stream : pui_file; offset : longint{clong}; whence : longint {cint}) : longint{cint};cdecl; | |
345 | + {$endif GDB_UI_FILE_HAS_FSEEK} | |
346 | ||
347 | ui_file = record | |
348 | magic : plongint; | |
349 | @@ -647,6 +759,9 @@ | |
350 | to_isatty : ui_file_isatty_ftype; | |
351 | to_rewind : ui_file_rewind_ftype; | |
352 | to_put : ui_file_put_ftype; | |
353 | + {$ifdef GDB_UI_FILE_HAS_FSEEK} | |
354 | + to_fseek : ui_file_fseek_ftype; | |
355 | + {$endif GDB_UI_FILE_HAS_FSEEK} | |
356 | to_data : pointer; | |
357 | end; | |
358 | ||
359 | @@ -822,6 +937,8 @@ | |
360 | var | |
361 | cli_uiout : ui_out;cvar;external; | |
362 | current_uiout : ui_out;cvar;external; | |
363 | + { out local copy for catch_exceptions call } | |
364 | + our_uiout : ui_out; | |
365 | {$endif GDB_NO_UIOUT} | |
366 | function cli_out_new (stream : pui_file):ui_out;cdecl;external; | |
367 | {$endif GDB_V6} | |
368 | @@ -960,7 +1077,7 @@ | |
3c782031 JB |
369 | pprogram_space = pointer; |
370 | pgdbarch = pointer; | |
371 | ||
372 | -{$PACKRECORDS 4} | |
373 | +{$PACKRECORDS C} | |
374 | pbreakpoint = ^breakpoint; | |
375 | breakpoint = record | |
376 | {$ifdef GDB_USES_BP_OPS} | |
9a6604f5 JR |
377 | @@ -984,8 +1101,10 @@ |
378 | {$ifdef GDB_USES_BP_OPS} | |
379 | display_canonical: byte; | |
380 | {$endif GDB_USES_BP_OPS} | |
381 | - | |
382 | ignore_count : longint; | |
383 | +{$ifdef GDB_BP_HAS_ENABLE_COUNT} | |
384 | + enable_count : longint; | |
385 | +{$endif GDB_BP_HAS_ENABLE_COUNT} | |
386 | {$ifndef GDB_USES_BP_LOCATION} | |
387 | shadow_contents : array[0..15] of char; | |
388 | inserted : char; | |
389 | @@ -1021,6 +1140,9 @@ | |
3c782031 JB |
390 | section : pointer; {^asection} |
391 | end; | |
392 | ||
393 | + pagent_expr = pointer; | |
394 | + tcondition_status = (condition_unchanged, condition_modified); | |
395 | + | |
396 | bp_target_info = record | |
397 | placed_address_space : pointer;{paddress_space;} | |
398 | placed_address : CORE_ADDR; | |
9a6604f5 | 399 | @@ -1049,6 +1171,12 @@ |
3c782031 JB |
400 | owner : pbreakpoint; |
401 | {$ifdef GDB_BP_LOCATION_HAS_GLOBAL_NEXT} | |
402 | cond : pointer;{pexpression;} | |
403 | +{$ifdef GDB_BP_LOCATION_HAS_COND_BYTECODE} | |
404 | + cond_bytecode : pagent_expr; | |
405 | + condition_changed : tcondition_status; | |
406 | + cmd_bytecode : pagent_expr; | |
407 | + needs_update : byte; | |
408 | +{$endif} | |
409 | shlib_disabled : byte; | |
410 | enabled : byte; | |
411 | {$endif GDB_BP_LOCATION_HAS_GLOBAL_NEXT} | |
9a6604f5 | 412 | @@ -1067,6 +1195,10 @@ |
3c782031 JB |
413 | {$endif GDB_BP_LOCATION_HAS_GLOBAL_NEXT} |
414 | section : pointer;{pobj_section;} | |
415 | requested_address : CORE_ADDR; | |
416 | +{$ifdef GDB_BP_LOCATION_HAS_RELATED_ADDRESS} | |
417 | + related_address : CORE_ADDR; | |
418 | + probe : pointer; { struct probe *probe; } | |
419 | +{$endif} | |
420 | {$ifdef GDB_BP_LOCATION_HAS_GLOBAL_NEXT} | |
421 | function_name : ^char; | |
422 | {$endif GDB_BP_LOCATION_HAS_GLOBAL_NEXT} | |
9a6604f5 | 423 | @@ -1121,6 +1253,10 @@ |
3c782031 JB |
424 | avoid stack memory corruption PM } |
425 | explicit_pc : longint; | |
426 | explicit_line : longint; | |
427 | + { New field added in GDB 7.5 version } | |
428 | + probe : pointer;{struct probe *probe; } | |
9a6604f5 JR |
429 | + { New field added in GDB 7.8? version } |
430 | + objfile : pointer; { struct objfile * } | |
3c782031 JB |
431 | end; |
432 | ||
433 | symtabs_and_lines = record | |
9a6604f5 | 434 | @@ -1566,7 +1702,7 @@ |
3c782031 JB |
435 | to_magic : longint; |
436 | end; | |
437 | ||
438 | -{$PACKRECORDS NORMAL} | |
439 | +{$PACKRECORDS C} | |
440 | ||
441 | {***************************************************************************** | |
442 | Define external calls to libgdb.a | |
9a6604f5 JR |
443 | @@ -1576,7 +1712,8 @@ |
444 | { external variables } | |
445 | error_return : jmp_buf;cvar;public; | |
446 | quit_return : jmp_buf;cvar;public; | |
447 | - deprecated_query_hook : pointer;cvar;public; | |
448 | + deprecated_query_hook : pointer;cvar; | |
449 | +{$ifdef NEED_EXTERNAL_CVAR}external;{$else}public;{$endif} | |
450 | ||
451 | {$ifndef GDB_HAS_OBSERVER_NOTIFY_BREAKPOINT_CREATED} | |
452 | {$ifdef GDB_HAS_DEPRECATED_CBPH} | |
453 | @@ -1615,9 +1752,17 @@ | |
3c782031 JB |
454 | var |
455 | instream : P_C_FILE;cvar;external; | |
456 | function gdb_fopen (filename : pchar; mode : pchar) : pui_file;cdecl;external; | |
457 | +{$ifdef LIBGDB_HAS_GET_STDIN} | |
458 | + { this function is generated by the gen-libgdb-inc.sh script | |
459 | + in a object called gdb_get_stdin.o added to the libgdb.a archive } | |
460 | + function gdb_get_stdin : P_C_FILE; cdecl; external; | |
461 | +var | |
462 | + saved_command_line : pchar;cvar;external; { defined in top.c source } | |
463 | + saved_command_line_size : longint;cvar;external; {defined in top.c source } | |
464 | +{$endif} | |
465 | {$endif GDB_NEEDS_SET_INSTREAM} | |
466 | var | |
467 | - { The four following variables are defined in defs.h | |
468 | + { The four following variables are defined in defs.h | |
469 | and instanciated in main.c since version 5.0 } | |
470 | gdb_stdout : pui_file;cvar;public; | |
471 | gdb_stderr : pui_file;cvar;public; | |
9a6604f5 | 472 | @@ -1639,7 +1784,11 @@ |
3c782031 JB |
473 | { xvasprintf is present at least from GDB 5.3 |
474 | while xstrvprintf only appears in version 6.2, | |
475 | so only use xvasprintf function } | |
476 | +{$ifdef GDB_USE_XSTRVPRINTF} | |
477 | +function xstrvprintf(msg : pchar) : pchar; varargs; cdecl; external; | |
478 | +{$else} | |
479 | function xvasprintf(ret : ppchar; msg : pchar) : pchar; varargs; cdecl; external; | |
480 | +{$endif} | |
481 | procedure xfree(p : pointer); cdecl; external; | |
482 | function find_pc_line(i:CORE_ADDR;l:longint):symtab_and_line;cdecl;external; | |
483 | function find_pc_function(i:CORE_ADDR):psymbol;cdecl;external; | |
9a6604f5 | 484 | @@ -2021,6 +2170,13 @@ |
3c782031 JB |
485 | stop_breakpoint_number:=num; |
486 | end; | |
487 | ||
488 | +procedure annotate_breakpoints_changed;cdecl;public; | |
489 | +begin | |
490 | +{$ifdef Verbose} | |
491 | + Debug('|breakpoints_changed|'); | |
492 | +{$endif} | |
493 | +end; | |
494 | + | |
495 | ||
496 | procedure annotate_watchpoint(num:longint);cdecl;public; | |
497 | begin | |
9a6604f5 | 498 | @@ -2358,6 +2514,14 @@ |
3c782031 JB |
499 | {$endif} |
500 | end; | |
501 | ||
502 | +procedure annotate_display_prompt;cdecl;public; | |
503 | +begin | |
504 | +{$ifdef Verbose} | |
505 | + Debug('|display_prompt|'); | |
506 | +{$endif} | |
507 | +end; | |
508 | + | |
509 | + | |
510 | procedure annotate_display_begin;cdecl;public; | |
511 | begin | |
512 | {$ifdef Verbose} | |
9a6604f5 | 513 | @@ -2527,7 +2691,11 @@ |
3c782031 JB |
514 | QueryHook:=1 |
515 | else if pos('%',question)>0 then | |
516 | begin | |
517 | +{$ifdef GDB_USE_XSTRVPRINTF} | |
518 | + local:=xstrvprintf(question,arg); | |
519 | +{$else} | |
520 | xvasprintf(@local,question,arg); | |
521 | +{$endif} | |
522 | { xvasprintf can failed, in that case local is set to nil } | |
523 | if not assigned(local) then | |
524 | local:=question; | |
9a6604f5 JR |
525 | @@ -2752,6 +2920,16 @@ |
526 | var | |
527 | top_level_val : longint; | |
3c782031 | 528 | |
9a6604f5 JR |
529 | +{$ifdef USE_CATCH_EXCEPTIONS} |
530 | +function catch_exceptions(uiout : ui_out; func : pointer; command : pchar; mask : longint) : longint;cdecl;external; | |
531 | + | |
532 | +function gdbint_execute_command(uiout : ui_out; command : pchar) : longint;cdecl; | |
533 | +begin | |
534 | + gdbint_execute_command:=1; | |
535 | + execute_command(command,1); | |
536 | + gdbint_execute_command:=0; | |
537 | +end; | |
538 | +{$else not USE_CATCH_EXCEPTIONS} | |
539 | function catch_command_errors(func : pointer; command : pchar; from_tty,mask : longint) : longint;cdecl;external; | |
540 | ||
541 | function gdbint_execute_command(command : pchar; from_tty : longint) : longint;cdecl; | |
542 | @@ -2760,6 +2938,7 @@ | |
543 | execute_command(command,from_tty); | |
544 | gdbint_execute_command:=0; | |
545 | end; | |
546 | +{$endif not USE_CATCH_EXCEPTIONS} | |
547 | ||
548 | {$ifdef cpui386} | |
549 | type | |
550 | @@ -2861,8 +3040,12 @@ | |
551 | begin | |
552 | quit_return:=error_return; | |
553 | mask:=longint($ffffffff); | |
554 | +{$ifdef USE_CATCH_EXCEPTIONS} | |
555 | + catch_exceptions(our_uiout, @gdbint_execute_command,@command,mask); | |
556 | +{$else i.e. not USE_CATCH_EXCEPTIONS} | |
557 | catch_command_errors(@gdbint_execute_command,@command, | |
558 | 1,mask); | |
559 | +{$endif not def USE_CATCH_EXCEPTIONS} | |
3c782031 | 560 | {$ifdef go32v2} |
9a6604f5 JR |
561 | reload_fs; |
562 | {$endif go32v2} | |
563 | @@ -3226,6 +3409,10 @@ | |
3c782031 JB |
564 | ui_file_delete(gdb_stdin); |
565 | gdb_stdin:=mem_fileopen; | |
566 | save_gdb_stdin:=gdb_stdin; | |
567 | +{$ifdef LIBGDB_HAS_GET_STDIN} | |
568 | + instream:=gdb_get_stdin; | |
569 | + saved_command_line:=xmalloc(saved_command_line_size); | |
570 | +{$else} | |
571 | dummy_file :=gdb_fopen('dummy.$$$','a'); | |
572 | {in captured_main code, this is simply | |
573 | instream:=stdin; but stdin is a highly system dependent macro | |
9a6604f5 | 574 | @@ -3234,6 +3421,7 @@ |
3c782031 JB |
575 | instream:=pstdio_file(dummy_file^.to_data)^._file |
576 | else | |
577 | instream:=nil; | |
578 | +{$endif} | |
579 | {$endif GDB_NEEDS_SET_INSTREAM} | |
580 | ||
581 | gdb_stderr:=mem_fileopen; | |
9a6604f5 JR |
582 | @@ -3297,6 +3485,7 @@ |
583 | {$ifdef GDB_NO_UIOUT} | |
584 | cli_uiout := cli_out_new (gdb_stdout); | |
585 | current_uiout:=cli_uiout; | |
586 | + our_uiout:=cli_uiout; | |
587 | {$endif GDB_NO_UIOUT} | |
588 | {$endif GDB_NEEDS_INTERPRETER_SETUP} | |
589 | {$ifdef supportexceptions} | |
590 | @@ -3328,10 +3517,10 @@ | |
3c782031 JB |
591 | variables that are defined in main.c source. |
592 | We must not load main.o otherwise, we will get | |
593 | into multiply defined symbols troubles. } | |
594 | -var | |
595 | +var | |
596 | gdb_sysrootc : char; | |
597 | { used locally only to provide a pchar pointing to '\0' } | |
598 | - gdb_sysroot : pchar; cvar;public; | |
599 | + gdb_sysroot : pchar; cvar;public; | |
600 | { gdb_sysroot global variable is declared in defs.h and | |
601 | instanciated in main.c since version 6.0 } | |
602 | gdb_datadir : pchar; cvar;public; | |
9a6604f5 JR |
603 | @@ -3358,6 +3547,15 @@ |
604 | debug_file_directory : pchar; cvar; external; | |
605 | {$endif GDB_HAS_DEBUG_FILE_DIRECTORY} | |
606 | ||
607 | +{$ifdef USE_LOCAL_SET_GDB_DATA_DIRECTORY} | |
608 | +{ Avoid loading of main.o object by providing a | |
609 | + stripped down version of relocate_gdb_directory function } | |
610 | +procedure set_gdb_data_directory(path : pchar); cdecl; public; | |
611 | +begin | |
612 | + gdb_datadir:=path; | |
613 | +end; | |
614 | +{$endif USE_LOCAL_SET_GDB_DATA_DIRECTORY} | |
615 | + | |
616 | begin | |
617 | {$ifdef GDB_HAS_SYSROOT} | |
618 | gdb_sysrootc := #0; |