~ubuntu-branches/debian/lenny/fpc/lenny

« back to all changes in this revision

Viewing changes to fpcsrc/ide/fakegdb/gdbint.pas

  • Committer: Bazaar Package Importer
  • Author(s): Mazen Neifer, Torsten Werner, Mazen Neifer
  • Date: 2008-05-17 17:12:11 UTC
  • mfrom: (3.1.9 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080517171211-9qi33xhd9evfa0kg
Tags: 2.2.0-dfsg1-9
[ Torsten Werner ]
* Add Mazen Neifer to Uploaders field.

[ Mazen Neifer ]
* Moved FPC sources into a version dependent directory from /usr/share/fpcsrc
  to /usr/share/fpcsrc/${FPCVERSION}. This allow installing more than on FPC
  release.
* Fixed far call issue in compiler preventing building huge binearies.
  (closes: #477743)
* Updated building dependencies, recomennded and suggested packages.
* Moved fppkg to fp-utils as it is just a helper tool and is not required by
  compiler.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
{
 
2
 
 
3
    Fake GDBInt unit
 
4
 
 
5
 **********************************************************************}
 
6
unit GDBInt;
 
7
interface
 
8
 
 
9
type
 
10
  CORE_ADDR = cardinal; { might be target dependent PM }
 
11
  streamtype = (afile,astring);
 
12
  C_FILE     = longint; { at least under DJGPP }
 
13
  P_C_FILE   = ^C_FILE;
 
14
 
 
15
  psyminfo=^tsyminfo;
 
16
  tsyminfo=record
 
17
    address  : longint;
 
18
    fname    : pchar;
 
19
    line     : longint;
 
20
    funcname : pchar;
 
21
  end;
 
22
 
 
23
  tframeentry = object
 
24
    file_name : pchar;
 
25
    function_name : pchar;
 
26
    args : pchar;
 
27
    line_number : longint;
 
28
    address : longint;
 
29
    constructor init;
 
30
    destructor done;
 
31
    procedure reset;
 
32
    procedure clear;
 
33
  end;
 
34
  pframeentry=^tframeentry;
 
35
  ppframeentry=^pframeentry;
 
36
 
 
37
  tgdbbuffer=object
 
38
    buf   : pchar;
 
39
    size,
 
40
    idx   : longint;
 
41
    constructor Init;
 
42
    destructor  Done;
 
43
    procedure Reset;
 
44
    procedure Resize(nsize : longint);
 
45
    procedure Append(p:pchar);
 
46
  end;
 
47
 
 
48
  PGDBInterface=^TGDBInterface;
 
49
  TGDBInterface=object
 
50
    gdberrorbuf,
 
51
    gdboutputbuf  : tgdbbuffer;
 
52
    command_level,
 
53
    got_error,
 
54
    reset_command,
 
55
    call_reset,
 
56
    Debuggee_started : boolean;
 
57
    { frames and frame info while recording a frame }
 
58
    frames        : ppframeentry;
 
59
    frame_size,
 
60
    frame_count   : longint;
 
61
    record_frames,
 
62
    frame_begin_seen : boolean;
 
63
    stop_breakpoint_number,
 
64
    current_address,
 
65
    current_line_number,
 
66
    signal_start,
 
67
    signal_end,
 
68
    error_start,
 
69
    error_end,
 
70
    function_start,
 
71
    function_end,
 
72
    args_start,
 
73
    args_end,
 
74
    file_start,
 
75
    file_end,
 
76
    line_start,
 
77
    line_end : longint;
 
78
    signal_name,
 
79
    signal_string : pchar;
 
80
    current_pc      : CORE_ADDR;
 
81
    { breakpoint }
 
82
    last_breakpoint_number,
 
83
    last_breakpoint_address,
 
84
    last_breakpoint_line : longint;
 
85
    last_breakpoint_file : pchar;
 
86
    invalid_breakpoint_line : boolean;
 
87
    { Highlevel }
 
88
    user_screen_shown,
 
89
    switch_to_user     : boolean;
 
90
    constructor Init;
 
91
    destructor  Done;
 
92
    procedure clear_frames;
 
93
    { functions }
 
94
    function  error:boolean;
 
95
    function  error_num:longint;
 
96
    function  get_current_frame : longint;
 
97
    function  set_current_frame(level : longint) : boolean;
 
98
    procedure DebuggerScreen;
 
99
    procedure UserScreen;
 
100
    { Hooks }
 
101
    procedure DoSelectSourceline(const fn:string;line:longint);virtual;
 
102
    procedure DoStartSession;virtual;
 
103
    procedure DoBreakSession;virtual;
 
104
    procedure DoEndSession(code:longint);virtual;
 
105
    procedure DoDebuggerScreen;virtual;
 
106
    procedure DoUserScreen;virtual;
 
107
    function  AllowQuit : boolean;virtual;
 
108
  end;
 
109
 
 
110
function  GDBVersion : string;
 
111
 
 
112
var
 
113
  curr_gdb : pgdbinterface;
 
114
 
 
115
const
 
116
  use_gdb_file : boolean = false;
 
117
var
 
118
  gdb_file : text;
 
119
  inferior_pid : longint;
 
120
 
 
121
implementation
 
122
 
 
123
uses
 
124
  strings;
 
125
 
 
126
 
 
127
constructor TGDBInterface.Init;
 
128
begin
 
129
end;
 
130
 
 
131
 
 
132
destructor TGDBInterface.Done;
 
133
begin
 
134
end;
 
135
 
 
136
 
 
137
function tgdbinterface.error:boolean;
 
138
begin
 
139
  error:=false;
 
140
end;
 
141
 
 
142
function tgdbinterface.error_num:longint;
 
143
begin
 
144
  error_num:=0;
 
145
end;
 
146
 
 
147
function TGDBInterface.get_current_frame : longint;
 
148
begin
 
149
  get_current_frame:=0;
 
150
end;
 
151
 
 
152
function TGDBInterface.set_current_frame(level : longint) : boolean;
 
153
begin
 
154
  set_current_frame:=true;
 
155
end;
 
156
 
 
157
procedure TGDBInterface.Clear_Frames;
 
158
begin
 
159
end;
 
160
 
 
161
 
 
162
procedure TGDBInterface.DebuggerScreen;
 
163
begin
 
164
end;
 
165
 
 
166
 
 
167
procedure TGDBInterface.UserScreen;
 
168
begin
 
169
end;
 
170
 
 
171
 
 
172
procedure TGDBInterface.DoSelectSourceline(const fn:string;line:longint);
 
173
begin
 
174
end;
 
175
 
 
176
 
 
177
procedure TGDBInterface.DoStartSession;
 
178
begin
 
179
end;
 
180
 
 
181
 
 
182
procedure TGDBInterface.DoBreakSession;
 
183
begin
 
184
end;
 
185
 
 
186
 
 
187
procedure TGDBInterface.DoEndSession(code:longint);
 
188
begin
 
189
end;
 
190
 
 
191
 
 
192
procedure TGDBInterface.DoDebuggerScreen;
 
193
begin
 
194
end;
 
195
 
 
196
 
 
197
procedure TGDBInterface.DoUserScreen;
 
198
begin
 
199
end;
 
200
 
 
201
function  tgdbinterface.AllowQuit : boolean;
 
202
begin
 
203
  AllowQuit:=true;
 
204
end;
 
205
 
 
206
function  GDBVersion : string;
 
207
begin
 
208
  GDBVersion:='Fake GDB';
 
209
end;
 
210
 
 
211
{*****************************************************************************
 
212
                               TFrameEntry
 
213
*****************************************************************************}
 
214
 
 
215
constructor tframeentry.init;
 
216
begin
 
217
  Reset;
 
218
end;
 
219
 
 
220
destructor tframeentry.done;
 
221
begin
 
222
  Clear;
 
223
end;
 
224
 
 
225
procedure tframeentry.reset;
 
226
begin
 
227
  file_name:=nil;
 
228
  function_name:=nil;
 
229
  args:=nil;
 
230
  line_number:=0;
 
231
  address:=0;
 
232
end;
 
233
 
 
234
procedure tframeentry.clear;
 
235
begin
 
236
  if assigned(file_name) then
 
237
   strdispose(file_name);
 
238
  if assigned(function_name) then
 
239
   strdispose(function_name);
 
240
  if assigned(args) then
 
241
   strdispose(args);
 
242
  reset;
 
243
end;
 
244
 
 
245
 
 
246
{*****************************************************************************
 
247
                                 tgdbbuffer
 
248
*****************************************************************************}
 
249
 
 
250
const
 
251
  blocksize=2048;
 
252
 
 
253
constructor tgdbbuffer.init;
 
254
begin
 
255
  Buf:=nil;
 
256
  Size:=0;
 
257
  Resize(blocksize);
 
258
  Reset;
 
259
end;
 
260
 
 
261
 
 
262
destructor tgdbbuffer.done;
 
263
begin
 
264
  if assigned(buf) then
 
265
    freemem(buf,size);
 
266
end;
 
267
 
 
268
 
 
269
 
 
270
procedure tgdbbuffer.reset;
 
271
begin
 
272
  idx:=0;
 
273
  Buf[0]:=#0;
 
274
end;
 
275
 
 
276
 
 
277
procedure tgdbbuffer.append(p:pchar);
 
278
var
 
279
  len : longint;
 
280
begin
 
281
  if not assigned(p) then
 
282
   exit;
 
283
  len:=Strlen(p);
 
284
  if len+idx>size then
 
285
   Resize(len+idx);
 
286
  Move(p^,buf[idx],len);
 
287
  inc(idx,len);
 
288
  buf[idx]:=#0;
 
289
end;
 
290
 
 
291
 
 
292
procedure tgdbbuffer.resize(nsize : longint);
 
293
var
 
294
  np    : pchar;
 
295
begin
 
296
  nsize:=((nsize+blocksize-1) div blocksize)*blocksize;
 
297
  getmem(np,nsize);
 
298
  move(buf^,np^,size);
 
299
  freemem(buf,size);
 
300
  buf:=np;
 
301
  size:=nsize;
 
302
end;
 
303
 
 
304
 
 
305
end.