mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-12-09 22:31:22 +01:00
* updated
This commit is contained in:
parent
70c1def540
commit
8416f94f56
@ -6,91 +6,10 @@
|
||||
**********************************************************************}
|
||||
unit GDBCon;
|
||||
interface
|
||||
uses
|
||||
GdbInt;
|
||||
|
||||
type
|
||||
psyminfo=^tsyminfo;
|
||||
tsyminfo=record
|
||||
address : longint;
|
||||
fname : pchar;
|
||||
line : longint;
|
||||
funcname : pchar;
|
||||
end;
|
||||
|
||||
tframeentry = object
|
||||
file_name : pchar;
|
||||
function_name : pchar;
|
||||
args : pchar;
|
||||
line_number : longint;
|
||||
address : longint;
|
||||
constructor init;
|
||||
destructor done;
|
||||
procedure reset;
|
||||
procedure clear;
|
||||
end;
|
||||
pframeentry=^tframeentry;
|
||||
ppframeentry=^pframeentry;
|
||||
|
||||
tgdbbuffer=object
|
||||
buf : pchar;
|
||||
size,
|
||||
idx : longint;
|
||||
constructor Init;
|
||||
destructor Done;
|
||||
procedure Reset;
|
||||
procedure Resize(nsize : longint);
|
||||
procedure Append(p:pchar);
|
||||
end;
|
||||
|
||||
PGDBInterface=^TGDBInterface;
|
||||
TGDBInterface=object
|
||||
gdberrorbuf,
|
||||
gdboutputbuf : tgdbbuffer;
|
||||
command_level,
|
||||
got_error,
|
||||
reset_command,
|
||||
call_reset,
|
||||
Debugger_started : boolean;
|
||||
{ frames and frame info while recording a frame }
|
||||
frames : ppframeentry;
|
||||
frame_size,
|
||||
frame_count : longint;
|
||||
record_frames,
|
||||
frame_begin_seen : boolean;
|
||||
stop_breakpoint_number,
|
||||
current_address,
|
||||
current_line_number,
|
||||
signal_start,
|
||||
signal_end,
|
||||
error_start,
|
||||
error_end,
|
||||
function_start,
|
||||
function_end,
|
||||
args_start,
|
||||
args_end,
|
||||
file_start,
|
||||
file_end,
|
||||
line_start,
|
||||
line_end : longint;
|
||||
{ breakpoint }
|
||||
last_breakpoint_number,
|
||||
last_breakpoint_address,
|
||||
last_breakpoint_line : longint;
|
||||
last_breakpoint_file : pchar;
|
||||
invalid_breakpoint_line : boolean;
|
||||
constructor Init;
|
||||
destructor Done;
|
||||
{ functions }
|
||||
function error:boolean;
|
||||
function error_num:longint;
|
||||
{ Hooks }
|
||||
procedure DoSelectSourceline(const fn:string;line:longint);virtual;
|
||||
procedure DoStartSession;virtual;
|
||||
procedure DoBreakSession;virtual;
|
||||
procedure DoEndSession(code:longint);virtual;
|
||||
procedure DoDebuggerScreen;virtual;
|
||||
procedure DoUserScreen;virtual;
|
||||
end;
|
||||
|
||||
PGDBController=^TGDBController;
|
||||
TGDBController=object(TGDBInterface)
|
||||
progname : pchar;
|
||||
@ -118,22 +37,12 @@ type
|
||||
procedure ClearSymbols;
|
||||
end;
|
||||
|
||||
|
||||
var
|
||||
curr_gdb : pgdbinterface;
|
||||
|
||||
const
|
||||
use_gdb_file : boolean = false;
|
||||
var
|
||||
gdb_file : text;
|
||||
|
||||
{ gdb does not allow \ in dir or filenames }
|
||||
procedure UnixDir(var s : string);
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
strings;
|
||||
|
||||
procedure UnixDir(var s : string);
|
||||
var i : longint;
|
||||
@ -159,11 +68,11 @@ procedure TGDBController.Command(const s:string);
|
||||
begin
|
||||
end;
|
||||
|
||||
procedure TGDBController.CommandBegin;
|
||||
procedure TGDBController.CommandBegin(const s:string);
|
||||
begin
|
||||
end;
|
||||
|
||||
procedure TGDBController.CommandEnd;
|
||||
procedure TGDBController.CommandEnd(const s:string);
|
||||
begin
|
||||
end;
|
||||
|
||||
@ -242,154 +151,13 @@ begin
|
||||
GetError:=nil;
|
||||
end;
|
||||
|
||||
constructor TGDBInterface.Init;
|
||||
begin
|
||||
end;
|
||||
|
||||
|
||||
destructor TGDBInterface.Done;
|
||||
begin
|
||||
end;
|
||||
|
||||
|
||||
function tgdbinterface.error:boolean;
|
||||
begin
|
||||
error:=false;
|
||||
end;
|
||||
|
||||
function tgdbinterface.error_num:longint;
|
||||
begin
|
||||
error_num:=0;
|
||||
end;
|
||||
|
||||
procedure TGDBInterface.DoSelectSourceline(const fn:string;line:longint);
|
||||
begin
|
||||
end;
|
||||
|
||||
|
||||
procedure TGDBInterface.DoStartSession;
|
||||
begin
|
||||
end;
|
||||
|
||||
|
||||
procedure TGDBInterface.DoBreakSession;
|
||||
begin
|
||||
end;
|
||||
|
||||
|
||||
procedure TGDBInterface.DoEndSession(code:longint);
|
||||
begin
|
||||
end;
|
||||
|
||||
|
||||
procedure TGDBInterface.DoDebuggerScreen;
|
||||
begin
|
||||
end;
|
||||
|
||||
|
||||
procedure TGDBInterface.DoUserScreen;
|
||||
begin
|
||||
end;
|
||||
|
||||
{*****************************************************************************
|
||||
TFrameEntry
|
||||
*****************************************************************************}
|
||||
|
||||
constructor tframeentry.init;
|
||||
begin
|
||||
Reset;
|
||||
end;
|
||||
|
||||
destructor tframeentry.done;
|
||||
begin
|
||||
Clear;
|
||||
end;
|
||||
|
||||
procedure tframeentry.reset;
|
||||
begin
|
||||
file_name:=nil;
|
||||
function_name:=nil;
|
||||
args:=nil;
|
||||
line_number:=0;
|
||||
address:=0;
|
||||
end;
|
||||
|
||||
procedure tframeentry.clear;
|
||||
begin
|
||||
if assigned(file_name) then
|
||||
strdispose(file_name);
|
||||
if assigned(function_name) then
|
||||
strdispose(function_name);
|
||||
if assigned(args) then
|
||||
strdispose(args);
|
||||
reset;
|
||||
end;
|
||||
|
||||
|
||||
{*****************************************************************************
|
||||
tgdbbuffer
|
||||
*****************************************************************************}
|
||||
|
||||
const
|
||||
blocksize=2048;
|
||||
|
||||
constructor tgdbbuffer.init;
|
||||
begin
|
||||
Buf:=nil;
|
||||
Size:=0;
|
||||
Resize(blocksize);
|
||||
Reset;
|
||||
end;
|
||||
|
||||
|
||||
destructor tgdbbuffer.done;
|
||||
begin
|
||||
if assigned(buf) then
|
||||
freemem(buf,size);
|
||||
end;
|
||||
|
||||
|
||||
|
||||
procedure tgdbbuffer.reset;
|
||||
begin
|
||||
idx:=0;
|
||||
Buf[0]:=#0;
|
||||
end;
|
||||
|
||||
|
||||
procedure tgdbbuffer.append(p:pchar);
|
||||
var
|
||||
len : longint;
|
||||
begin
|
||||
if not assigned(p) then
|
||||
exit;
|
||||
len:=Strlen(p);
|
||||
if len+idx>size then
|
||||
Resize(len+idx);
|
||||
Move(p^,buf[idx],len);
|
||||
inc(idx,len);
|
||||
buf[idx]:=#0;
|
||||
end;
|
||||
|
||||
|
||||
procedure tgdbbuffer.resize(nsize : longint);
|
||||
var
|
||||
np : pchar;
|
||||
begin
|
||||
nsize:=((nsize+blocksize-1) div blocksize)*blocksize;
|
||||
getmem(np,nsize);
|
||||
move(buf^,np^,size);
|
||||
freemem(buf,size);
|
||||
buf:=np;
|
||||
size:=nsize;
|
||||
end;
|
||||
|
||||
|
||||
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.9 1999-02-11 13:03:28 pierre
|
||||
Revision 1.10 1999-02-16 10:44:14 peter
|
||||
* updated
|
||||
|
||||
Revision 1.9 1999/02/11 13:03:28 pierre
|
||||
Problem with last commit
|
||||
+ added virtuals CommandBegin and CommandEnd
|
||||
+ added command_level for TGDBInterface
|
||||
|
||||
259
ide/fake/gdb/gdbint.pas
Normal file
259
ide/fake/gdb/gdbint.pas
Normal file
@ -0,0 +1,259 @@
|
||||
{
|
||||
$Id$
|
||||
|
||||
Fake GDBInt unit
|
||||
|
||||
**********************************************************************}
|
||||
unit GDBInt;
|
||||
interface
|
||||
|
||||
type
|
||||
psyminfo=^tsyminfo;
|
||||
tsyminfo=record
|
||||
address : longint;
|
||||
fname : pchar;
|
||||
line : longint;
|
||||
funcname : pchar;
|
||||
end;
|
||||
|
||||
tframeentry = object
|
||||
file_name : pchar;
|
||||
function_name : pchar;
|
||||
args : pchar;
|
||||
line_number : longint;
|
||||
address : longint;
|
||||
constructor init;
|
||||
destructor done;
|
||||
procedure reset;
|
||||
procedure clear;
|
||||
end;
|
||||
pframeentry=^tframeentry;
|
||||
ppframeentry=^pframeentry;
|
||||
|
||||
tgdbbuffer=object
|
||||
buf : pchar;
|
||||
size,
|
||||
idx : longint;
|
||||
constructor Init;
|
||||
destructor Done;
|
||||
procedure Reset;
|
||||
procedure Resize(nsize : longint);
|
||||
procedure Append(p:pchar);
|
||||
end;
|
||||
|
||||
PGDBInterface=^TGDBInterface;
|
||||
TGDBInterface=object
|
||||
gdberrorbuf,
|
||||
gdboutputbuf : tgdbbuffer;
|
||||
command_level,
|
||||
got_error,
|
||||
reset_command,
|
||||
call_reset,
|
||||
Debugger_started : boolean;
|
||||
{ frames and frame info while recording a frame }
|
||||
frames : ppframeentry;
|
||||
frame_size,
|
||||
frame_count : longint;
|
||||
record_frames,
|
||||
frame_begin_seen : boolean;
|
||||
stop_breakpoint_number,
|
||||
current_address,
|
||||
current_line_number,
|
||||
signal_start,
|
||||
signal_end,
|
||||
error_start,
|
||||
error_end,
|
||||
function_start,
|
||||
function_end,
|
||||
args_start,
|
||||
args_end,
|
||||
file_start,
|
||||
file_end,
|
||||
line_start,
|
||||
line_end : longint;
|
||||
{ breakpoint }
|
||||
last_breakpoint_number,
|
||||
last_breakpoint_address,
|
||||
last_breakpoint_line : longint;
|
||||
last_breakpoint_file : pchar;
|
||||
invalid_breakpoint_line : boolean;
|
||||
constructor Init;
|
||||
destructor Done;
|
||||
{ functions }
|
||||
function error:boolean;
|
||||
function error_num:longint;
|
||||
{ Hooks }
|
||||
procedure DoSelectSourceline(const fn:string;line:longint);virtual;
|
||||
procedure DoStartSession;virtual;
|
||||
procedure DoBreakSession;virtual;
|
||||
procedure DoEndSession(code:longint);virtual;
|
||||
procedure DoDebuggerScreen;virtual;
|
||||
procedure DoUserScreen;virtual;
|
||||
end;
|
||||
|
||||
var
|
||||
curr_gdb : pgdbinterface;
|
||||
|
||||
const
|
||||
use_gdb_file : boolean = false;
|
||||
var
|
||||
gdb_file : text;
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
strings;
|
||||
|
||||
|
||||
constructor TGDBInterface.Init;
|
||||
begin
|
||||
end;
|
||||
|
||||
|
||||
destructor TGDBInterface.Done;
|
||||
begin
|
||||
end;
|
||||
|
||||
|
||||
function tgdbinterface.error:boolean;
|
||||
begin
|
||||
error:=false;
|
||||
end;
|
||||
|
||||
function tgdbinterface.error_num:longint;
|
||||
begin
|
||||
error_num:=0;
|
||||
end;
|
||||
|
||||
procedure TGDBInterface.DoSelectSourceline(const fn:string;line:longint);
|
||||
begin
|
||||
end;
|
||||
|
||||
|
||||
procedure TGDBInterface.DoStartSession;
|
||||
begin
|
||||
end;
|
||||
|
||||
|
||||
procedure TGDBInterface.DoBreakSession;
|
||||
begin
|
||||
end;
|
||||
|
||||
|
||||
procedure TGDBInterface.DoEndSession(code:longint);
|
||||
begin
|
||||
end;
|
||||
|
||||
|
||||
procedure TGDBInterface.DoDebuggerScreen;
|
||||
begin
|
||||
end;
|
||||
|
||||
|
||||
procedure TGDBInterface.DoUserScreen;
|
||||
begin
|
||||
end;
|
||||
|
||||
{*****************************************************************************
|
||||
TFrameEntry
|
||||
*****************************************************************************}
|
||||
|
||||
constructor tframeentry.init;
|
||||
begin
|
||||
Reset;
|
||||
end;
|
||||
|
||||
destructor tframeentry.done;
|
||||
begin
|
||||
Clear;
|
||||
end;
|
||||
|
||||
procedure tframeentry.reset;
|
||||
begin
|
||||
file_name:=nil;
|
||||
function_name:=nil;
|
||||
args:=nil;
|
||||
line_number:=0;
|
||||
address:=0;
|
||||
end;
|
||||
|
||||
procedure tframeentry.clear;
|
||||
begin
|
||||
if assigned(file_name) then
|
||||
strdispose(file_name);
|
||||
if assigned(function_name) then
|
||||
strdispose(function_name);
|
||||
if assigned(args) then
|
||||
strdispose(args);
|
||||
reset;
|
||||
end;
|
||||
|
||||
|
||||
{*****************************************************************************
|
||||
tgdbbuffer
|
||||
*****************************************************************************}
|
||||
|
||||
const
|
||||
blocksize=2048;
|
||||
|
||||
constructor tgdbbuffer.init;
|
||||
begin
|
||||
Buf:=nil;
|
||||
Size:=0;
|
||||
Resize(blocksize);
|
||||
Reset;
|
||||
end;
|
||||
|
||||
|
||||
destructor tgdbbuffer.done;
|
||||
begin
|
||||
if assigned(buf) then
|
||||
freemem(buf,size);
|
||||
end;
|
||||
|
||||
|
||||
|
||||
procedure tgdbbuffer.reset;
|
||||
begin
|
||||
idx:=0;
|
||||
Buf[0]:=#0;
|
||||
end;
|
||||
|
||||
|
||||
procedure tgdbbuffer.append(p:pchar);
|
||||
var
|
||||
len : longint;
|
||||
begin
|
||||
if not assigned(p) then
|
||||
exit;
|
||||
len:=Strlen(p);
|
||||
if len+idx>size then
|
||||
Resize(len+idx);
|
||||
Move(p^,buf[idx],len);
|
||||
inc(idx,len);
|
||||
buf[idx]:=#0;
|
||||
end;
|
||||
|
||||
|
||||
procedure tgdbbuffer.resize(nsize : longint);
|
||||
var
|
||||
np : pchar;
|
||||
begin
|
||||
nsize:=((nsize+blocksize-1) div blocksize)*blocksize;
|
||||
getmem(np,nsize);
|
||||
move(buf^,np^,size);
|
||||
freemem(buf,size);
|
||||
buf:=np;
|
||||
size:=nsize;
|
||||
end;
|
||||
|
||||
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.1 1999-02-16 10:44:15 peter
|
||||
* updated
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user