1 --- fpcbuild-2.6.2/fpcsrc/packages/gdbint/src/gdbint.pp.orig 2013-08-07 20:58:05.756050489 +0200
2 +++ fpcbuild-2.6.2/fpcsrc/packages/gdbint/src/gdbint.pp 2013-08-07 21:09:31.746021701 +0200
9 {$define NotImplemented}
18 { Is create_breakpoint_hook deprecated? }
19 { Seem not so for 6.1 }
20 {$define GDB_HAS_DEPRECATED_CBPH}
24 - {$info using gdb 6.1.x}
26 - {$undef GDB_HAS_DEPRECATED_CBPH}
27 -{$endif def GDB_V601}
31 - {$info using gdb 6.2.x}
33 -{$endif def GDB_V602}
37 - {$info using gdb 6.3.x}
39 -{$endif def GDB_V603}
43 - {$info using gdb 6.4.x}
45 - {$define GDB_NEEDS_NO_ERROR_INIT}
46 -{$endif def GDB_V604}
50 + where XYZ are three numbers
52 + either inside gdblib.inc or gdbver.inc
53 + This corresponds to version
59 - {$info using gdb 6.5.x}
61 - {$define GDB_NEEDS_NO_ERROR_INIT}
62 -{$endif def GDB_V605}
63 +{$undef GDB_VERSION_RECOGNIZED}
67 - {$info using gdb 6.6.x}
69 - {$define GDB_USES_BP_LOCATION}
70 - {$define GDB_NEEDS_NO_ERROR_INIT}
71 - {$define GDB_USES_EXPAT_LIB}
72 - {$define GDB_HAS_DEBUG_FILE_DIRECTORY}
73 -{$endif def GDB_V606}
76 + {$info using gdb 7.6.x}
77 + {$define GDB_VERSION_RECOGNIZED}
78 + {$define GDB_VER_GE_706}
83 - {$info using gdb 6.7.x}
85 - {$define GDB_USES_BP_LOCATION}
86 - {$define GDB_NEEDS_NO_ERROR_INIT}
87 - {$define GDB_USES_EXPAT_LIB}
88 - {$define GDB_HAS_DEBUG_FILE_DIRECTORY}
89 -{$endif def GDB_V607}
90 +{$ifdef GDB_VER_GE_706}
91 + {$define GDB_VER_GE_705}
95 + {$info using gdb 7.5.x}
96 + {$define GDB_VERSION_RECOGNIZED}
97 + {$define GDB_VER_GE_705}
102 - {$info using gdb 6.8.x}
104 - {$define GDB_USES_BP_LOCATION}
105 - {$define GDB_BP_LOCATION_HAS_GLOBAL_NEXT}
106 - {$define GDB_NEEDS_NO_ERROR_INIT}
107 - {$define GDB_USES_EXPAT_LIB}
108 - {$define GDB_HAS_DEBUG_FILE_DIRECTORY}
109 - {$define GDB_USES_LIBDECNUMBER}
110 - // {$define GDB_HAS_OBSERVER_NOTIFY_BREAKPOINT_CREATED}
111 - {$define GDB_HAS_BP_NONE}
112 -{$endif def GDB_V608}
113 +{$ifdef GDB_VER_GE_705}
114 + {$define GDB_VER_GE_704}
115 + {$define GDB_BP_LOCATION_HAS_COND_BYTECODE}
116 + {$define GDB_BP_LOCATION_HAS_RELATED_ADDRESS}
121 {$info using gdb 7.4.x}
122 + {$define GDB_VERSION_RECOGNIZED}
123 + {$define GDB_VER_GE_704}
126 +{$ifdef GDB_VER_GE_704}
128 {$define GDB_BP_LOCATION_HAS_GDBARCH}
129 {$define GDB_HAS_PROGRAM_SPACE}
130 @@ -131,11 +105,12 @@
132 {$define GDB_USES_LIBADVAPI32}
134 -{$endif def GDB_V704}
135 +{$endif def GDB_VER_GE_704}
139 {$info using gdb 7.3.x}
140 + {$define GDB_VERSION_RECOGNIZED}
142 {$define GDB_BP_LOCATION_HAS_GDBARCH}
143 {$define GDB_HAS_PROGRAM_SPACE}
144 @@ -150,11 +125,13 @@
145 {$define GDB_BP_LOCATION_HAS_OPS}
146 {$define GDB_UI_FILE_HAS_WRITE_ASYNC}
148 + {$define GDB_VERSION_RECOGNIZED}
149 {$endif def GDB_V703}
153 {$info using gdb 7.2.x}
154 + {$define GDB_VERSION_RECOGNIZED}
156 {$define GDB_BP_LOCATION_HAS_GDBARCH}
157 {$define GDB_HAS_PROGRAM_SPACE}
161 {$info using gdb 7.1.x}
162 + {$define GDB_VERSION_RECOGNIZED}
164 {$define GDB_BP_LOCATION_HAS_GDBARCH}
165 {$define GDB_HAS_PROGRAM_SPACE}
169 {$info using gdb 7.0.x}
170 + {$define GDB_VERSION_RECOGNIZED}
173 {$define GDB_BP_LOCATION_HAS_GDBARCH}
175 {$define GDB_HAS_OBSERVER_NOTIFY_BREAKPOINT_CREATED}
176 {$define GDB_TARGET_CLOSE_HAS_PTARGET_ARG}
177 {$define GDB_HAS_BP_NONE}
178 + {$define GDB_USE_XSTRVPRINTF}
184 + {$info using gdb 6.8.x}
185 + {$define GDB_VERSION_RECOGNIZED}
187 + {$define GDB_USES_BP_LOCATION}
188 + {$define GDB_BP_LOCATION_HAS_GLOBAL_NEXT}
189 + {$define GDB_NEEDS_NO_ERROR_INIT}
190 + {$define GDB_USES_EXPAT_LIB}
191 + {$define GDB_HAS_DEBUG_FILE_DIRECTORY}
192 + {$define GDB_USES_LIBDECNUMBER}
193 + // {$define GDB_HAS_OBSERVER_NOTIFY_BREAKPOINT_CREATED}
194 + {$define GDB_HAS_BP_NONE}
195 +{$endif def GDB_V608}
199 + {$info using gdb 6.7.x}
200 + {$define GDB_VERSION_RECOGNIZED}
202 + {$define GDB_USES_BP_LOCATION}
203 + {$define GDB_NEEDS_NO_ERROR_INIT}
204 + {$define GDB_USES_EXPAT_LIB}
205 + {$define GDB_HAS_DEBUG_FILE_DIRECTORY}
206 +{$endif def GDB_V607}
210 + {$info using gdb 6.6.x}
211 + {$define GDB_VERSION_RECOGNIZED}
213 + {$define GDB_USES_BP_LOCATION}
214 + {$define GDB_NEEDS_NO_ERROR_INIT}
215 + {$define GDB_USES_EXPAT_LIB}
216 + {$define GDB_HAS_DEBUG_FILE_DIRECTORY}
217 +{$endif def GDB_V606}
221 + {$info using gdb 6.5.x}
222 + {$define GDB_VERSION_RECOGNIZED}
224 + {$define GDB_NEEDS_NO_ERROR_INIT}
225 +{$endif def GDB_V605}
229 + {$info using gdb 6.4.x}
230 + {$define GDB_VERSION_RECOGNIZED}
232 + {$define GDB_NEEDS_NO_ERROR_INIT}
233 +{$endif def GDB_V604}
237 + {$info using gdb 6.3.x}
238 + {$define GDB_VERSION_RECOGNIZED}
240 +{$endif def GDB_V603}
244 + {$info using gdb 6.2.x}
245 + {$define GDB_VERSION_RECOGNIZED}
247 +{$endif def GDB_V602}
251 + {$info using gdb 6.1.x}
252 + {$define GDB_VERSION_RECOGNIZED}
254 + {$undef GDB_HAS_DEPRECATED_CBPH}
255 +{$endif def GDB_V601}
259 + {$info using gdb 6.0.x}
260 + {$define GDB_VERSION_RECOGNIZED}
262 +{$endif def GDB_V600}
265 {$define GDB_HAS_SYSROOT}
266 {$define GDB_HAS_DB_COMMANDS}
268 {$define GDB_INIT_HAS_ARGV0}
271 +{$ifdef GDB_VERSION_RECOGNIZED}
272 + {$warning no recognized GDB_VXYZ conditional found, linking might fail. }
276 {$ifdef GDB_HAS_OBSERVER_NOTIFY_BREAKPOINT_CREATED}
277 {$define DO_NOT_USE_CBPH}
279 pprogram_space = pointer;
284 pbreakpoint = ^breakpoint;
286 {$ifdef GDB_USES_BP_OPS}
287 @@ -1022,6 +1088,9 @@
288 section : pointer; {^asection}
291 + pagent_expr = pointer;
292 + tcondition_status = (condition_unchanged, condition_modified);
294 bp_target_info = record
295 placed_address_space : pointer;{paddress_space;}
296 placed_address : CORE_ADDR;
297 @@ -1050,6 +1119,12 @@
299 {$ifdef GDB_BP_LOCATION_HAS_GLOBAL_NEXT}
300 cond : pointer;{pexpression;}
301 +{$ifdef GDB_BP_LOCATION_HAS_COND_BYTECODE}
302 + cond_bytecode : pagent_expr;
303 + condition_changed : tcondition_status;
304 + cmd_bytecode : pagent_expr;
305 + needs_update : byte;
307 shlib_disabled : byte;
309 {$endif GDB_BP_LOCATION_HAS_GLOBAL_NEXT}
310 @@ -1068,6 +1143,10 @@
311 {$endif GDB_BP_LOCATION_HAS_GLOBAL_NEXT}
312 section : pointer;{pobj_section;}
313 requested_address : CORE_ADDR;
314 +{$ifdef GDB_BP_LOCATION_HAS_RELATED_ADDRESS}
315 + related_address : CORE_ADDR;
316 + probe : pointer; { struct probe *probe; }
318 {$ifdef GDB_BP_LOCATION_HAS_GLOBAL_NEXT}
319 function_name : ^char;
320 {$endif GDB_BP_LOCATION_HAS_GLOBAL_NEXT}
321 @@ -1122,6 +1201,8 @@
322 avoid stack memory corruption PM }
323 explicit_pc : longint;
324 explicit_line : longint;
325 + { New field added in GDB 7.5 version }
326 + probe : pointer;{struct probe *probe; }
329 symtabs_and_lines = record
330 @@ -1567,7 +1648,7 @@
334 -{$PACKRECORDS NORMAL}
337 {*****************************************************************************
338 Define external calls to libgdb.a
339 @@ -1616,9 +1697,17 @@
341 instream : P_C_FILE;cvar;external;
342 function gdb_fopen (filename : pchar; mode : pchar) : pui_file;cdecl;external;
343 +{$ifdef LIBGDB_HAS_GET_STDIN}
344 + { this function is generated by the gen-libgdb-inc.sh script
345 + in a object called gdb_get_stdin.o added to the libgdb.a archive }
346 + function gdb_get_stdin : P_C_FILE; cdecl; external;
348 + saved_command_line : pchar;cvar;external; { defined in top.c source }
349 + saved_command_line_size : longint;cvar;external; {defined in top.c source }
351 {$endif GDB_NEEDS_SET_INSTREAM}
353 - { The four following variables are defined in defs.h
354 + { The four following variables are defined in defs.h
355 and instanciated in main.c since version 5.0 }
356 gdb_stdout : pui_file;cvar;public;
357 gdb_stderr : pui_file;cvar;public;
358 @@ -1640,7 +1729,11 @@
359 { xvasprintf is present at least from GDB 5.3
360 while xstrvprintf only appears in version 6.2,
361 so only use xvasprintf function }
362 +{$ifdef GDB_USE_XSTRVPRINTF}
363 +function xstrvprintf(msg : pchar) : pchar; varargs; cdecl; external;
365 function xvasprintf(ret : ppchar; msg : pchar) : pchar; varargs; cdecl; external;
367 procedure xfree(p : pointer); cdecl; external;
368 function find_pc_line(i:CORE_ADDR;l:longint):symtab_and_line;cdecl;external;
369 function find_pc_function(i:CORE_ADDR):psymbol;cdecl;external;
370 @@ -2022,6 +2115,13 @@
371 stop_breakpoint_number:=num;
374 +procedure annotate_breakpoints_changed;cdecl;public;
377 + Debug('|breakpoints_changed|');
382 procedure annotate_watchpoint(num:longint);cdecl;public;
384 @@ -2359,6 +2459,14 @@
388 +procedure annotate_display_prompt;cdecl;public;
391 + Debug('|display_prompt|');
396 procedure annotate_display_begin;cdecl;public;
399 @@ -2528,7 +2636,11 @@
401 else if pos('%',question)>0 then
403 +{$ifdef GDB_USE_XSTRVPRINTF}
404 + local:=xstrvprintf(question,arg);
406 xvasprintf(@local,question,arg);
408 { xvasprintf can failed, in that case local is set to nil }
409 if not assigned(local) then
411 @@ -3117,32 +3229,48 @@
415 - c_environ : ppchar;external name '_environ';
416 + c_environ : ppchar;external name '__environ';
417 c_argc : longint;external name '___crt0_argc';
418 c_argv : ppchar;external name '___crt0_argv';
420 procedure ReallocateEnvironUsingCMalloc;
423 - neededsize , count : longint;
424 + neededsize , i, count : longint;
428 if not assigned(c_environ) then
430 + neededsize:=sizeof(pchar)
435 + penv:=c_environ[count];
436 while assigned(penv) do
439 - inc(penv,sizeof(pchar));
440 + penv:=c_environ[count];
443 neededsize:=count*sizeof(pchar);
445 newenv:=malloc(neededsize);
446 - system.move(c_environ,newenv,neededsize);
447 + system.move(c_environ^,newenv^,neededsize);
448 + if assigned(c_environ) then
450 + for i:=0 to count-1 do
452 + penv:=c_environ[i];
453 + if assigned(penv) then
455 + neededsize:=strlen(penv)+1;
456 + newenv[i]:=malloc(neededsize);
457 + system.move(penv^,newenv[i]^,neededsize);
466 @@ -3211,6 +3339,10 @@
467 ui_file_delete(gdb_stdin);
468 gdb_stdin:=mem_fileopen;
469 save_gdb_stdin:=gdb_stdin;
470 +{$ifdef LIBGDB_HAS_GET_STDIN}
471 + instream:=gdb_get_stdin;
472 + saved_command_line:=xmalloc(saved_command_line_size);
474 dummy_file :=gdb_fopen('dummy.$$$','a');
475 {in captured_main code, this is simply
476 instream:=stdin; but stdin is a highly system dependent macro
477 @@ -3219,6 +3351,7 @@
478 instream:=pstdio_file(dummy_file^.to_data)^._file
482 {$endif GDB_NEEDS_SET_INSTREAM}
484 gdb_stderr:=mem_fileopen;
485 @@ -3313,10 +3446,10 @@
486 variables that are defined in main.c source.
487 We must not load main.o otherwise, we will get
488 into multiply defined symbols troubles. }
492 { used locally only to provide a pchar pointing to '\0' }
493 - gdb_sysroot : pchar; cvar;public;
494 + gdb_sysroot : pchar; cvar;public;
495 { gdb_sysroot global variable is declared in defs.h and
496 instanciated in main.c since version 6.0 }
497 gdb_datadir : pchar; cvar;public;
498 --- fpcbuild-2.6.2/fpcsrc/packages/gdbint/src/gdbint.pp.orig 2013-08-08 20:14:59.169199840 +0200
499 +++ fpcbuild-2.6.2/fpcsrc/packages/gdbint/src/gdbint.pp 2013-08-08 21:50:53.262291698 +0200
502 {$ifdef GDB_VER_GE_706}
503 {$define GDB_VER_GE_705}
504 + {$define GDB_UI_FILE_HAS_TO_FSEEK}
509 ui_file_rewind_ftype = procedure(stream : pui_file);cdecl;
510 ui_file_put_method_ftype = procedure(var _object; buffer : pchar;length_buffer : longint);cdecl;
511 ui_file_put_ftype = procedure(stream : pui_file;method : ui_file_put_method_ftype;var context);cdecl;
512 + ui_file_fseek_ftype = function(stream : pui_file; offset : longint; whence : integer):integer;cdecl;
514 ui_file_read_ftype = function (stream : pui_file; buffer : pchar; len : longint):longint;cdecl;
517 to_isatty : ui_file_isatty_ftype;
518 to_rewind : ui_file_rewind_ftype;
519 to_put : ui_file_put_ftype;
520 + {$ifdef GDB_UI_FILE_HAS_TO_FSEEK}
521 + to_fseek : ui_file_fseek_ftype;