]> git.pld-linux.org Git - packages/fpc.git/blob - fpc-gdb.patch
- rebuild with binutils 2.24.51.0.1
[packages/fpc.git] / fpc-gdb.patch
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
3 @@ -14,6 +14,7 @@
4  unit GdbInt;
5  
6  {$mode objfpc}
7 +{$smartlink off}
8  
9  {$define NotImplemented}
10  
11 @@ -39,83 +40,56 @@
12  
13  interface
14  
15 -{$smartlink off}
16  
17  
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}
28 -
29 -{ 6.2.x }
30 -{$ifdef GDB_V602}
31 -  {$info using gdb 6.2.x}
32 -  {$define GDB_V6}
33 -{$endif def GDB_V602}
34 -
35 -{ 6.3.x }
36 -{$ifdef GDB_V603}
37 -  {$info using gdb 6.3.x}
38 -  {$define GDB_V6}
39 -{$endif def GDB_V603}
40  
41 -{ 6.4.x }
42 -{$ifdef GDB_V604}
43 -  {$info using gdb 6.4.x}
44 -  {$define GDB_V6}
45 -  {$define GDB_NEEDS_NO_ERROR_INIT}
46 -{$endif def GDB_V604}
47 +{
48 +  Excatly one
49 +  GDB_VXYZ macro
50 +  where XYZ are three numbers
51 +  needs to defined
52 +  either inside gdblib.inc or gdbver.inc
53 +  This corresponds to version
54 +  X.YZ.patch_level
55 +}
56  
57 -{ 6.5.x }
58 -{$ifdef GDB_V605}
59 -  {$info using gdb 6.5.x}
60 -  {$define GDB_V6}
61 -  {$define GDB_NEEDS_NO_ERROR_INIT}
62 -{$endif def GDB_V605}
63 +{$undef GDB_VERSION_RECOGNIZED}
64  
65 -{ 6.6.x }
66 -{$ifdef GDB_V606}
67 -  {$info using gdb 6.6.x}
68 -  {$define GDB_V6}
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}
74 +{ 7.6.x }
75 +{$ifdef GDB_V706}
76 +  {$info using gdb 7.6.x}
77 +  {$define GDB_VERSION_RECOGNIZED}
78 +  {$define GDB_VER_GE_706}
79 +{$endif}
80  
81 -{ 6.7.x }
82 -{$ifdef GDB_V607}
83 -  {$info using gdb 6.7.x}
84 -  {$define GDB_V6}
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}
92 +{$endif}
93 +{ 7.5.x }
94 +{$ifdef GDB_V705}
95 +  {$info using gdb 7.5.x}
96 +  {$define GDB_VERSION_RECOGNIZED}
97 +  {$define GDB_VER_GE_705}
98 +{$endif}
99  
100 -{ 6.8.x }
101 -{$ifdef GDB_V608}
102 -  {$info using gdb 6.8.x}
103 -  {$define GDB_V6}
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}
117 +{$endif}
118  
119  { 7.4.x }
120  {$ifdef GDB_V704}
121    {$info using gdb 7.4.x}
122 +  {$define GDB_VERSION_RECOGNIZED}
123 +  {$define GDB_VER_GE_704}
124 +{$endif}
125 +
126 +{$ifdef GDB_VER_GE_704}
127    {$define GDB_V7}
128    {$define GDB_BP_LOCATION_HAS_GDBARCH}
129    {$define GDB_HAS_PROGRAM_SPACE}
130 @@ -131,11 +105,12 @@
131    {$ifdef win32}
132        {$define GDB_USES_LIBADVAPI32}
133    {$endif win32}
134 -{$endif def GDB_V704}
135 +{$endif def GDB_VER_GE_704}
136  
137  { 7.3.x }
138  {$ifdef GDB_V703}
139    {$info using gdb 7.3.x}
140 +  {$define GDB_VERSION_RECOGNIZED}
141    {$define GDB_V7}
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}
147    {$endif GDB_CVS}
148 +  {$define GDB_VERSION_RECOGNIZED}
149  {$endif def GDB_V703}
150  
151  { 7.2.x }
152  {$ifdef GDB_V702}
153    {$info using gdb 7.2.x}
154 +  {$define GDB_VERSION_RECOGNIZED}
155    {$define GDB_V7}
156    {$define GDB_BP_LOCATION_HAS_GDBARCH}
157    {$define GDB_HAS_PROGRAM_SPACE}
158 @@ -163,6 +140,7 @@
159  { 7.1.x }
160  {$ifdef GDB_V701}
161    {$info using gdb 7.1.x}
162 +  {$define GDB_VERSION_RECOGNIZED}
163    {$define GDB_V7}
164    {$define GDB_BP_LOCATION_HAS_GDBARCH}
165    {$define GDB_HAS_PROGRAM_SPACE}
166 @@ -173,6 +151,7 @@
167  { 7.0.x }
168  {$ifdef GDB_V700}
169    {$info using gdb 7.0.x}
170 +  {$define GDB_VERSION_RECOGNIZED}
171    {$define GDB_V7}
172    {$ifdef GDB_CVS}
173      {$define GDB_BP_LOCATION_HAS_GDBARCH}
174 @@ -197,9 +176,92 @@
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}
179  {$endif def GDB_V7}
180  
181  
182 +{ 6.8.x }
183 +{$ifdef GDB_V608}
184 +  {$info using gdb 6.8.x}
185 +  {$define GDB_VERSION_RECOGNIZED}
186 +  {$define GDB_V6}
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}
196 +
197 +{ 6.7.x }
198 +{$ifdef GDB_V607}
199 +  {$info using gdb 6.7.x}
200 +  {$define GDB_VERSION_RECOGNIZED}
201 +  {$define GDB_V6}
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}
207 +
208 +{ 6.6.x }
209 +{$ifdef GDB_V606}
210 +  {$info using gdb 6.6.x}
211 +  {$define GDB_VERSION_RECOGNIZED}
212 +  {$define GDB_V6}
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}
218 +
219 +{ 6.5.x }
220 +{$ifdef GDB_V605}
221 +  {$info using gdb 6.5.x}
222 +  {$define GDB_VERSION_RECOGNIZED}
223 +  {$define GDB_V6}
224 +  {$define GDB_NEEDS_NO_ERROR_INIT}
225 +{$endif def GDB_V605}
226 +
227 +{ 6.4.x }
228 +{$ifdef GDB_V604}
229 +  {$info using gdb 6.4.x}
230 +  {$define GDB_VERSION_RECOGNIZED}
231 +  {$define GDB_V6}
232 +  {$define GDB_NEEDS_NO_ERROR_INIT}
233 +{$endif def GDB_V604}
234 +
235 +{ 6.3.x }
236 +{$ifdef GDB_V603}
237 +  {$info using gdb 6.3.x}
238 +  {$define GDB_VERSION_RECOGNIZED}
239 +  {$define GDB_V6}
240 +{$endif def GDB_V603}
241 +
242 +{ 6.2.x }
243 +{$ifdef GDB_V602}
244 +  {$info using gdb 6.2.x}
245 +  {$define GDB_VERSION_RECOGNIZED}
246 +  {$define GDB_V6}
247 +{$endif def GDB_V602}
248 +
249 +{ 6.1.x }
250 +{$ifdef GDB_V601}
251 +  {$info using gdb 6.1.x}
252 +  {$define GDB_VERSION_RECOGNIZED}
253 +  {$define GDB_V6}
254 +  {$undef GDB_HAS_DEPRECATED_CBPH}
255 +{$endif def GDB_V601}
256 +
257 +{ 6.0.x }
258 +{$ifdef GDB_V600}
259 +  {$info using gdb 6.0.x}
260 +  {$define GDB_VERSION_RECOGNIZED}
261 +  {$define GDB_V6}
262 +{$endif def GDB_V600}
263 +
264  {$ifdef GDB_V6}
265    {$define GDB_HAS_SYSROOT}
266    {$define GDB_HAS_DB_COMMANDS}
267 @@ -207,6 +269,10 @@
268    {$define GDB_INIT_HAS_ARGV0}
269  {$endif GDB_V6}
270  
271 +{$ifdef GDB_VERSION_RECOGNIZED}
272 +  {$warning no recognized GDB_VXYZ conditional found, linking might fail. }
273 +{$endif}
274 +
275  
276  {$ifdef GDB_HAS_OBSERVER_NOTIFY_BREAKPOINT_CREATED}
277    {$define DO_NOT_USE_CBPH}
278 @@ -961,7 +1027,7 @@
279       pprogram_space = pointer;
280       pgdbarch = pointer;
281  
282 -{$PACKRECORDS 4}
283 +{$PACKRECORDS C}
284       pbreakpoint = ^breakpoint;
285       breakpoint = record
286  {$ifdef GDB_USES_BP_OPS}
287 @@ -1022,6 +1088,9 @@
288            section : pointer; {^asection}
289         end;
290  
291 +     pagent_expr = pointer;
292 +     tcondition_status = (condition_unchanged, condition_modified);
293 +
294       bp_target_info = record
295            placed_address_space : pointer;{paddress_space;}
296            placed_address : CORE_ADDR;
297 @@ -1050,6 +1119,12 @@
298           owner : pbreakpoint;
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;
306 +{$endif}
307           shlib_disabled : byte;
308           enabled : 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; }
317 +{$endif}
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; }
327         end;
328  
329       symtabs_and_lines = record
330 @@ -1567,7 +1648,7 @@
331            to_magic : longint;
332         end;
333  
334 -{$PACKRECORDS NORMAL}
335 +{$PACKRECORDS C}
336  
337  {*****************************************************************************
338                     Define external calls to libgdb.a
339 @@ -1616,9 +1697,17 @@
340  var
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;
347 +var
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 }
350 +{$endif}
351  {$endif GDB_NEEDS_SET_INSTREAM}
352  var
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;
364 +{$else}
365  function xvasprintf(ret : ppchar; msg : pchar) : pchar; varargs; cdecl; external;
366 +{$endif}
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;
372  end;
373  
374 +procedure annotate_breakpoints_changed;cdecl;public;
375 +begin
376 +{$ifdef Verbose}
377 +  Debug('|breakpoints_changed|');
378 +{$endif}
379 +end;
380 +
381  
382  procedure annotate_watchpoint(num:longint);cdecl;public;
383  begin
384 @@ -2359,6 +2459,14 @@
385  {$endif}
386  end;
387  
388 +procedure annotate_display_prompt;cdecl;public;
389 +begin
390 +{$ifdef Verbose}
391 +  Debug('|display_prompt|');
392 +{$endif}
393 +end;
394 +
395 +
396  procedure annotate_display_begin;cdecl;public;
397  begin
398  {$ifdef Verbose}
399 @@ -2528,7 +2636,11 @@
400          QueryHook:=1
401        else if pos('%',question)>0 then
402          begin
403 +{$ifdef GDB_USE_XSTRVPRINTF}
404 +          local:=xstrvprintf(question,arg);
405 +{$else}
406            xvasprintf(@local,question,arg);
407 +{$endif}
408            { xvasprintf can failed, in that case local is set to nil }
409            if not assigned(local) then
410              local:=question;
411 @@ -3117,32 +3229,48 @@
412  
413  {$ifdef go32v2}
414  var
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';
419  
420    procedure ReallocateEnvironUsingCMalloc;
421  
422    var
423 -    neededsize , count : longint;
424 +    neededsize , i, count : longint;
425      penv : pchar;
426      newenv : ppchar;
427    begin
428      if not assigned(c_environ) then
429 -      neededsize:=0
430 +      neededsize:=sizeof(pchar)
431      else
432        begin
433          count:=0;
434 -        penv:=c_environ^;
435 +        penv:=c_environ[count];
436          while assigned(penv) do
437            begin
438              inc(count);
439 -            inc(penv,sizeof(pchar));
440 +            penv:=c_environ[count];
441            end;
442 +        inc(count);
443          neededsize:=count*sizeof(pchar);
444        end;
445      newenv:=malloc(neededsize);
446 -    system.move(c_environ,newenv,neededsize);
447 +    system.move(c_environ^,newenv^,neededsize);
448 +    if assigned(c_environ) then
449 +      begin
450 +        for i:=0 to count-1 do
451 +          begin
452 +            penv:=c_environ[i];
453 +            if assigned(penv) then
454 +              begin
455 +                neededsize:=strlen(penv)+1;
456 +                newenv[i]:=malloc(neededsize);
457 +                system.move(penv^,newenv[i]^,neededsize);
458 +              end
459 +            else
460 +              newenv[i]:=nil;
461 +          end;
462 +      end;
463      c_environ:=newenv;
464    end;
465  
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);
473 +{$else}
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
479    else
480      instream:=nil;
481 +{$endif}
482  {$endif GDB_NEEDS_SET_INSTREAM}
483  
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. }
489 -var 
490 +var
491      gdb_sysrootc : char;
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
500 @@ -68,6 +68,7 @@
501  
502  {$ifdef GDB_VER_GE_706}
503    {$define GDB_VER_GE_705}
504 +  {$define GDB_UI_FILE_HAS_TO_FSEEK}
505  {$endif}
506  { 7.5.x }
507  {$ifdef GDB_V705}
508 @@ -695,6 +696,7 @@
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;
513    {$ifdef GDB_V6}
514    ui_file_read_ftype = function (stream : pui_file; buffer : pchar; len : longint):longint;cdecl;
515    {$endif}
516 @@ -714,6 +716,9 @@
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;
522 +      {$endif}
523        to_data   : pointer;
524      end;
525  
This page took 0.094417 seconds and 3 git commands to generate.