mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-21 21:51:42 +02:00
* move smartlink off to before interface
* Reorganize ifdef GDB_VXYZ part + Add code for LIBGDB_HAS_GET_STDIN (possibly set in gen-gdblib-inc.sh script). + Use GDB_USE_XSTRVPRINTF conditional. git-svn-id: trunk@23660 -
This commit is contained in:
parent
3b1465f314
commit
f095c98e76
@ -14,6 +14,7 @@
|
||||
unit GdbInt;
|
||||
|
||||
{$mode objfpc}
|
||||
{$smartlink off}
|
||||
|
||||
{$define NotImplemented}
|
||||
|
||||
@ -39,94 +40,46 @@ unit GdbInt;
|
||||
|
||||
interface
|
||||
|
||||
{$smartlink off}
|
||||
|
||||
|
||||
{ Is create_breakpoint_hook deprecated? }
|
||||
{ Seem not so for 6.1 }
|
||||
{$define GDB_HAS_DEPRECATED_CBPH}
|
||||
|
||||
{ 6.1.x }
|
||||
{$ifdef GDB_V601}
|
||||
{$info using gdb 6.1.x}
|
||||
{$define GDB_V6}
|
||||
{$undef GDB_HAS_DEPRECATED_CBPH}
|
||||
{$endif def GDB_V601}
|
||||
|
||||
{ 6.2.x }
|
||||
{$ifdef GDB_V602}
|
||||
{$info using gdb 6.2.x}
|
||||
{$define GDB_V6}
|
||||
{$endif def GDB_V602}
|
||||
{
|
||||
Excatly one
|
||||
GDB_VXYZ macro
|
||||
where XYZ are three numbers
|
||||
needs to defined
|
||||
either inside gdblib.inc or gdbver.inc
|
||||
This corresponds to version
|
||||
X.YZ.patch_level
|
||||
}
|
||||
|
||||
{ 6.3.x }
|
||||
{$ifdef GDB_V603}
|
||||
{$info using gdb 6.3.x}
|
||||
{$define GDB_V6}
|
||||
{$endif def GDB_V603}
|
||||
|
||||
{ 6.4.x }
|
||||
{$ifdef GDB_V604}
|
||||
{$info using gdb 6.4.x}
|
||||
{$define GDB_V6}
|
||||
{$define GDB_NEEDS_NO_ERROR_INIT}
|
||||
{$endif def GDB_V604}
|
||||
|
||||
{ 6.5.x }
|
||||
{$ifdef GDB_V605}
|
||||
{$info using gdb 6.5.x}
|
||||
{$define GDB_V6}
|
||||
{$define GDB_NEEDS_NO_ERROR_INIT}
|
||||
{$endif def GDB_V605}
|
||||
|
||||
{ 6.6.x }
|
||||
{$ifdef GDB_V606}
|
||||
{$info using gdb 6.6.x}
|
||||
{$define GDB_V6}
|
||||
{$define GDB_USES_BP_LOCATION}
|
||||
{$define GDB_NEEDS_NO_ERROR_INIT}
|
||||
{$define GDB_USES_EXPAT_LIB}
|
||||
{this was wrong, 6.6 doesn't have debug_file_directory }
|
||||
{ was define GDB_HAS_DEBUG_FILE_DIRECTORY}
|
||||
{$endif def GDB_V606}
|
||||
|
||||
{ 6.7.x }
|
||||
{$ifdef GDB_V607}
|
||||
{$info using gdb 6.7.x}
|
||||
{$define GDB_V6}
|
||||
{$define GDB_USES_BP_LOCATION}
|
||||
{$define GDB_NEEDS_NO_ERROR_INIT}
|
||||
{$define GDB_USES_EXPAT_LIB}
|
||||
{$define GDB_HAS_DEBUG_FILE_DIRECTORY}
|
||||
{$endif def GDB_V607}
|
||||
|
||||
{ 6.8.x }
|
||||
{$ifdef GDB_V608}
|
||||
{$info using gdb 6.8.x}
|
||||
{$define GDB_V6}
|
||||
{$define GDB_USES_BP_LOCATION}
|
||||
{$define GDB_BP_LOCATION_HAS_GLOBAL_NEXT}
|
||||
{$define GDB_NEEDS_NO_ERROR_INIT}
|
||||
{$define GDB_USES_EXPAT_LIB}
|
||||
{$define GDB_HAS_DEBUG_FILE_DIRECTORY}
|
||||
{$define GDB_USES_LIBDECNUMBER}
|
||||
// {$define GDB_HAS_OBSERVER_NOTIFY_BREAKPOINT_CREATED}
|
||||
{$define GDB_HAS_BP_NONE}
|
||||
{$endif def GDB_V608}
|
||||
{$undef GDB_VERSION_RECOGNIZED}
|
||||
|
||||
{ 7.5.x }
|
||||
{$ifdef GDB_V705}
|
||||
{$define GDB_V_704}
|
||||
{$define GDB_BO_LOCATION_HAS_COND_BYTECODE}
|
||||
{$info using gdb 7.5.x}
|
||||
{$define GDB_VERSION_RECOGNIZED}
|
||||
{$define GDB_VER_GE_705}
|
||||
{$endif}
|
||||
|
||||
{$ifdef GDB_VER_GE_705}
|
||||
{$define GDB_VER_GE_704}
|
||||
{$define GDB_BP_LOCATION_HAS_COND_BYTECODE}
|
||||
{$define GDB_BP_LOCATION_HAS_RELATED_ADDRESS}
|
||||
{$endif}
|
||||
|
||||
{ 7.4.x }
|
||||
{$ifdef GDB_V704}
|
||||
{$info using gdb 7.4.x}
|
||||
{$define GDB_V_704}
|
||||
{$define GDB_VERSION_RECOGNIZED}
|
||||
{$define GDB_VER_GE_704}
|
||||
{$endif}
|
||||
|
||||
{$ifdef GDB_V_704}
|
||||
{$ifdef GDB_VER_GE_704}
|
||||
{$define GDB_V7}
|
||||
{$define GDB_BP_LOCATION_HAS_GDBARCH}
|
||||
{$define GDB_HAS_PROGRAM_SPACE}
|
||||
@ -142,11 +95,12 @@ interface
|
||||
{$ifdef win32}
|
||||
{$define GDB_USES_LIBADVAPI32}
|
||||
{$endif win32}
|
||||
{$endif def GDB_V704}
|
||||
{$endif def GDB_VER_GE_704}
|
||||
|
||||
{ 7.3.x }
|
||||
{$ifdef GDB_V703}
|
||||
{$info using gdb 7.3.x}
|
||||
{$define GDB_VERSION_RECOGNIZED}
|
||||
{$define GDB_V7}
|
||||
{$define GDB_BP_LOCATION_HAS_GDBARCH}
|
||||
{$define GDB_HAS_PROGRAM_SPACE}
|
||||
@ -161,11 +115,13 @@ interface
|
||||
{$define GDB_BP_LOCATION_HAS_OPS}
|
||||
{$define GDB_UI_FILE_HAS_WRITE_ASYNC}
|
||||
{$endif GDB_CVS}
|
||||
{$define GDB_VERSION_RECOGNIZED}
|
||||
{$endif def GDB_V703}
|
||||
|
||||
{ 7.2.x }
|
||||
{$ifdef GDB_V702}
|
||||
{$info using gdb 7.2.x}
|
||||
{$define GDB_VERSION_RECOGNIZED}
|
||||
{$define GDB_V7}
|
||||
{$define GDB_BP_LOCATION_HAS_GDBARCH}
|
||||
{$define GDB_HAS_PROGRAM_SPACE}
|
||||
@ -174,6 +130,7 @@ interface
|
||||
{ 7.1.x }
|
||||
{$ifdef GDB_V701}
|
||||
{$info using gdb 7.1.x}
|
||||
{$define GDB_VERSION_RECOGNIZED}
|
||||
{$define GDB_V7}
|
||||
{$define GDB_BP_LOCATION_HAS_GDBARCH}
|
||||
{$define GDB_HAS_PROGRAM_SPACE}
|
||||
@ -184,6 +141,7 @@ interface
|
||||
{ 7.0.x }
|
||||
{$ifdef GDB_V700}
|
||||
{$info using gdb 7.0.x}
|
||||
{$define GDB_VERSION_RECOGNIZED}
|
||||
{$define GDB_V7}
|
||||
{$ifdef GDB_CVS}
|
||||
{$define GDB_BP_LOCATION_HAS_GDBARCH}
|
||||
@ -208,9 +166,92 @@ interface
|
||||
{$define GDB_HAS_OBSERVER_NOTIFY_BREAKPOINT_CREATED}
|
||||
{$define GDB_TARGET_CLOSE_HAS_PTARGET_ARG}
|
||||
{$define GDB_HAS_BP_NONE}
|
||||
{$define GDB_USE_XSTRVPRINTF}
|
||||
{$endif def GDB_V7}
|
||||
|
||||
|
||||
{ 6.8.x }
|
||||
{$ifdef GDB_V608}
|
||||
{$info using gdb 6.8.x}
|
||||
{$define GDB_VERSION_RECOGNIZED}
|
||||
{$define GDB_V6}
|
||||
{$define GDB_USES_BP_LOCATION}
|
||||
{$define GDB_BP_LOCATION_HAS_GLOBAL_NEXT}
|
||||
{$define GDB_NEEDS_NO_ERROR_INIT}
|
||||
{$define GDB_USES_EXPAT_LIB}
|
||||
{$define GDB_HAS_DEBUG_FILE_DIRECTORY}
|
||||
{$define GDB_USES_LIBDECNUMBER}
|
||||
// {$define GDB_HAS_OBSERVER_NOTIFY_BREAKPOINT_CREATED}
|
||||
{$define GDB_HAS_BP_NONE}
|
||||
{$endif def GDB_V608}
|
||||
|
||||
{ 6.7.x }
|
||||
{$ifdef GDB_V607}
|
||||
{$info using gdb 6.7.x}
|
||||
{$define GDB_VERSION_RECOGNIZED}
|
||||
{$define GDB_V6}
|
||||
{$define GDB_USES_BP_LOCATION}
|
||||
{$define GDB_NEEDS_NO_ERROR_INIT}
|
||||
{$define GDB_USES_EXPAT_LIB}
|
||||
{$define GDB_HAS_DEBUG_FILE_DIRECTORY}
|
||||
{$endif def GDB_V607}
|
||||
|
||||
{ 6.6.x }
|
||||
{$ifdef GDB_V606}
|
||||
{$info using gdb 6.6.x}
|
||||
{$define GDB_VERSION_RECOGNIZED}
|
||||
{$define GDB_V6}
|
||||
{$define GDB_USES_BP_LOCATION}
|
||||
{$define GDB_NEEDS_NO_ERROR_INIT}
|
||||
{$define GDB_USES_EXPAT_LIB}
|
||||
{$define GDB_HAS_DEBUG_FILE_DIRECTORY}
|
||||
{$endif def GDB_V606}
|
||||
|
||||
{ 6.5.x }
|
||||
{$ifdef GDB_V605}
|
||||
{$info using gdb 6.5.x}
|
||||
{$define GDB_VERSION_RECOGNIZED}
|
||||
{$define GDB_V6}
|
||||
{$define GDB_NEEDS_NO_ERROR_INIT}
|
||||
{$endif def GDB_V605}
|
||||
|
||||
{ 6.4.x }
|
||||
{$ifdef GDB_V604}
|
||||
{$info using gdb 6.4.x}
|
||||
{$define GDB_VERSION_RECOGNIZED}
|
||||
{$define GDB_V6}
|
||||
{$define GDB_NEEDS_NO_ERROR_INIT}
|
||||
{$endif def GDB_V604}
|
||||
|
||||
{ 6.3.x }
|
||||
{$ifdef GDB_V603}
|
||||
{$info using gdb 6.3.x}
|
||||
{$define GDB_VERSION_RECOGNIZED}
|
||||
{$define GDB_V6}
|
||||
{$endif def GDB_V603}
|
||||
|
||||
{ 6.2.x }
|
||||
{$ifdef GDB_V602}
|
||||
{$info using gdb 6.2.x}
|
||||
{$define GDB_VERSION_RECOGNIZED}
|
||||
{$define GDB_V6}
|
||||
{$endif def GDB_V602}
|
||||
|
||||
{ 6.1.x }
|
||||
{$ifdef GDB_V601}
|
||||
{$info using gdb 6.1.x}
|
||||
{$define GDB_VERSION_RECOGNIZED}
|
||||
{$define GDB_V6}
|
||||
{$undef GDB_HAS_DEPRECATED_CBPH}
|
||||
{$endif def GDB_V601}
|
||||
|
||||
{ 6.0.x }
|
||||
{$ifdef GDB_V600}
|
||||
{$info using gdb 6.0.x}
|
||||
{$define GDB_VERSION_RECOGNIZED}
|
||||
{$define GDB_V6}
|
||||
{$endif def GDB_V600}
|
||||
|
||||
{$ifdef GDB_V6}
|
||||
{$define GDB_HAS_SYSROOT}
|
||||
{$define GDB_HAS_DB_COMMANDS}
|
||||
@ -218,6 +259,10 @@ interface
|
||||
{$define GDB_INIT_HAS_ARGV0}
|
||||
{$endif GDB_V6}
|
||||
|
||||
{$ifdef GDB_VERSION_RECOGNIZED}
|
||||
{$warning no recognized GDB_VXYZ conditional found, linking might fail. }
|
||||
{$endif}
|
||||
|
||||
|
||||
{$ifdef GDB_HAS_OBSERVER_NOTIFY_BREAKPOINT_CREATED}
|
||||
{$define DO_NOT_USE_CBPH}
|
||||
@ -437,9 +482,9 @@ interface
|
||||
{$ifdef NotImplemented}
|
||||
{$undef NotImplemented}
|
||||
{$LINKLIB libgdb.a}
|
||||
{$ifdef GDB_HAS_SIM}
|
||||
{$LINKLIB libsim.a}
|
||||
{$endif GDB_HAS_SIM}
|
||||
{$ifdef GDB_HAS_SIM}
|
||||
{$LINKLIB libsim.a}
|
||||
{$endif GDB_HAS_SIM}
|
||||
{$LINKLIB libbfd.a}
|
||||
{$LINKLIB libreadline.a}
|
||||
{$LINKLIB libopcodes.a}
|
||||
@ -1063,7 +1108,7 @@ type
|
||||
owner : pbreakpoint;
|
||||
{$ifdef GDB_BP_LOCATION_HAS_GLOBAL_NEXT}
|
||||
cond : pointer;{pexpression;}
|
||||
{$ifdef GDB_BO_LOCATION_HAS_COND_BYTECODE}
|
||||
{$ifdef GDB_BP_LOCATION_HAS_COND_BYTECODE}
|
||||
cond_bytecode : pagent_expr;
|
||||
condition_changed : tcondition_status;
|
||||
cmd_bytecode : pagent_expr;
|
||||
@ -1641,9 +1686,17 @@ var
|
||||
var
|
||||
instream : P_C_FILE;cvar;external;
|
||||
function gdb_fopen (filename : pchar; mode : pchar) : pui_file;cdecl;external;
|
||||
{$ifdef LIBGDB_HAS_GET_STDIN}
|
||||
{ this function is generated by the gen-libgdb-inc.sh script
|
||||
in a object called gdb_get_stdin.o added to the libgdb.a archive }
|
||||
function gdb_get_stdin : P_C_FILE; cdecl; external;
|
||||
var
|
||||
saved_command_line : pchar;cvar;external; { defined in top.c source }
|
||||
saved_command_line_size : longint;cvar;external; {defined in top.c source }
|
||||
{$endif}
|
||||
{$endif GDB_NEEDS_SET_INSTREAM}
|
||||
var
|
||||
{ The four following variables are defined in defs.h
|
||||
{ The four following variables are defined in defs.h
|
||||
and instanciated in main.c since version 5.0 }
|
||||
gdb_stdout : pui_file;cvar;public;
|
||||
gdb_stderr : pui_file;cvar;public;
|
||||
@ -1665,7 +1718,11 @@ function xmalloc(size : longint) : pointer;cdecl;external;
|
||||
{ xvasprintf is present at least from GDB 5.3
|
||||
while xstrvprintf only appears in version 6.2,
|
||||
so only use xvasprintf function }
|
||||
{$ifdef GDB_USE_XSTRVPRINTF}
|
||||
function xstrvprintf(msg : pchar) : pchar; varargs; cdecl; external;
|
||||
{$else}
|
||||
function xvasprintf(ret : ppchar; msg : pchar) : pchar; varargs; cdecl; external;
|
||||
{$endif}
|
||||
procedure xfree(p : pointer); cdecl; external;
|
||||
function find_pc_line(i:CORE_ADDR;l:longint):symtab_and_line;cdecl;external;
|
||||
function find_pc_function(i:CORE_ADDR):psymbol;cdecl;external;
|
||||
@ -2047,6 +2104,13 @@ begin
|
||||
stop_breakpoint_number:=num;
|
||||
end;
|
||||
|
||||
procedure annotate_breakpoints_changed;cdecl;public;
|
||||
begin
|
||||
{$ifdef Verbose}
|
||||
Debug('|breakpoints_changed|');
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
|
||||
procedure annotate_watchpoint(num:longint);cdecl;public;
|
||||
begin
|
||||
@ -2553,7 +2617,11 @@ begin
|
||||
QueryHook:=1
|
||||
else if pos('%',question)>0 then
|
||||
begin
|
||||
{$ifdef GDB_USE_XSTRVPRINTF}
|
||||
local:=xstrvprintf(question,arg);
|
||||
{$else}
|
||||
xvasprintf(@local,question,arg);
|
||||
{$endif}
|
||||
{ xvasprintf can failed, in that case local is set to nil }
|
||||
if not assigned(local) then
|
||||
local:=question;
|
||||
@ -3236,6 +3304,10 @@ begin
|
||||
ui_file_delete(gdb_stdin);
|
||||
gdb_stdin:=mem_fileopen;
|
||||
save_gdb_stdin:=gdb_stdin;
|
||||
{$ifdef LIBGDB_HAS_GET_STDIN}
|
||||
instream:=gdb_get_stdin;
|
||||
saved_command_line:=xmalloc(saved_command_line_size);
|
||||
{$else}
|
||||
dummy_file :=gdb_fopen('dummy.$$$','a');
|
||||
{in captured_main code, this is simply
|
||||
instream:=stdin; but stdin is a highly system dependent macro
|
||||
@ -3244,6 +3316,7 @@ begin
|
||||
instream:=pstdio_file(dummy_file^.to_data)^._file
|
||||
else
|
||||
instream:=nil;
|
||||
{$endif}
|
||||
{$endif GDB_NEEDS_SET_INSTREAM}
|
||||
|
||||
gdb_stderr:=mem_fileopen;
|
||||
@ -3338,10 +3411,10 @@ end;
|
||||
variables that are defined in main.c source.
|
||||
We must not load main.o otherwise, we will get
|
||||
into multiply defined symbols troubles. }
|
||||
var
|
||||
var
|
||||
gdb_sysrootc : char;
|
||||
{ used locally only to provide a pchar pointing to '\0' }
|
||||
gdb_sysroot : pchar; cvar;public;
|
||||
gdb_sysroot : pchar; cvar;public;
|
||||
{ gdb_sysroot global variable is declared in defs.h and
|
||||
instanciated in main.c since version 6.0 }
|
||||
gdb_datadir : pchar; cvar;public;
|
||||
|
Loading…
Reference in New Issue
Block a user