mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-16 04:29:20 +02:00
Try to fix problems for more recent GDB versions.
Move GDB_NEW_UI macro def. to GDB_VER_GE_712 Add GDB_INTERP_LOOKUP_HAS_UI and GDB_HAS_SAVED_COMMAND_LINE_BUT_NO_SIZE to same GDB_VER_GE_712. Use stdio_filopen to create gdb_stdout and gdb_stderr if GDB_HAS_GET_STDIN macro is set. git-svn-id: trunk@44471 -
This commit is contained in:
parent
625e847e56
commit
4861761150
@ -72,11 +72,13 @@ interface
|
|||||||
{$define GDB_VER_GE_712}
|
{$define GDB_VER_GE_712}
|
||||||
{$define GDB_NO_INSTREAM_VAR}
|
{$define GDB_NO_INSTREAM_VAR}
|
||||||
{$define GDB_CURRENT_UIOUT_MACRO}
|
{$define GDB_CURRENT_UIOUT_MACRO}
|
||||||
{$define GDB_NEW_UI}
|
|
||||||
{$endif}
|
{$endif}
|
||||||
|
|
||||||
{$ifdef GDB_VER_GE_712}
|
{$ifdef GDB_VER_GE_712}
|
||||||
{$define GDB_VER_GE_711}
|
{$define GDB_VER_GE_711}
|
||||||
|
{$define GDB_HAS_SAVED_COMMAND_LINE_BUT_NO_SIZE}
|
||||||
|
{$define GDB_NEW_UI}
|
||||||
|
{$define GDB_INTERP_LOOKUP_HAS_UI}
|
||||||
{$endif}
|
{$endif}
|
||||||
|
|
||||||
{ 7.11.x }
|
{ 7.11.x }
|
||||||
@ -84,7 +86,6 @@ interface
|
|||||||
{$info using gdb 7.11.x}
|
{$info using gdb 7.11.x}
|
||||||
{$define GDB_VERSION_RECOGNIZED}
|
{$define GDB_VERSION_RECOGNIZED}
|
||||||
{$define GDB_VER_GE_711}
|
{$define GDB_VER_GE_711}
|
||||||
{$define GDB_HAS_SAVED_COMMAND_LINE_SIZE}
|
|
||||||
{$endif}
|
{$endif}
|
||||||
|
|
||||||
{$ifdef GDB_VER_GE_711}
|
{$ifdef GDB_VER_GE_711}
|
||||||
@ -187,6 +188,7 @@ interface
|
|||||||
{$ifdef win32}
|
{$ifdef win32}
|
||||||
{$define GDB_USES_LIBADVAPI32}
|
{$define GDB_USES_LIBADVAPI32}
|
||||||
{$endif win32}
|
{$endif win32}
|
||||||
|
{$define GDB_HAS_SAVED_COMMAND_LINE_SIZE}
|
||||||
{$endif def GDB_VER_GE_704}
|
{$endif def GDB_VER_GE_704}
|
||||||
|
|
||||||
{ 7.3.x }
|
{ 7.3.x }
|
||||||
@ -858,6 +860,7 @@ type
|
|||||||
|
|
||||||
{ used to recreate gdb_stdout and gdb_stderr as memory streams }
|
{ used to recreate gdb_stdout and gdb_stderr as memory streams }
|
||||||
function mem_fileopen : pui_file;cdecl;external;
|
function mem_fileopen : pui_file;cdecl;external;
|
||||||
|
function stdio_fileopen(_file : P_C_FILE) : pui_file;cdecl;external;
|
||||||
|
|
||||||
{ used to change the write procvar to ours }
|
{ used to change the write procvar to ours }
|
||||||
|
|
||||||
@ -1034,6 +1037,8 @@ type
|
|||||||
{$ifdef GDB_NEW_UI}
|
{$ifdef GDB_NEW_UI}
|
||||||
var
|
var
|
||||||
local_ui : pui;
|
local_ui : pui;
|
||||||
|
main_ui : pui; cvar;
|
||||||
|
current_ui : pui; cvar;
|
||||||
|
|
||||||
function new_ui (instream, outstream,errstream: pui_file) : pui; cdecl;external;
|
function new_ui (instream, outstream,errstream: pui_file) : pui; cdecl;external;
|
||||||
{$endif GDB_NEW_UI}
|
{$endif GDB_NEW_UI}
|
||||||
@ -1879,13 +1884,24 @@ var
|
|||||||
{ this function is generated by the gen-libgdb-inc.sh script
|
{ 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 }
|
in a object called gdb_get_stdin.o added to the libgdb.a archive }
|
||||||
function gdb_get_stdin : P_C_FILE; cdecl; external;
|
function gdb_get_stdin : P_C_FILE; cdecl; external;
|
||||||
{$ifdef GDB_HAS_SAVED_COMMAND_LINE_SIZE}
|
function gdb_get_stdout : P_C_FILE; cdecl; external;
|
||||||
|
function gdb_get_stderr : P_C_FILE; cdecl; external;
|
||||||
|
{$ifdef GDB_HAS_SAVED_COMMAND_LINE_BUT_NO_SIZE}
|
||||||
|
var
|
||||||
|
saved_command_line : pchar;cvar;external; { defined in top.c source }
|
||||||
|
const
|
||||||
|
saved_command_line_size : longint = 100; {not anymore in top.c source }
|
||||||
|
{$define GDB_SET_SAVED_COMMAND_LINE}
|
||||||
|
{$else}
|
||||||
|
{$ifdef GDB_HAS_SAVED_COMMAND_LINE_SIZE}
|
||||||
{ In some GDB versions, saved_command_line needs to
|
{ In some GDB versions, saved_command_line needs to
|
||||||
be explicitly allocated at startup }
|
be explicitly allocated at startup }
|
||||||
var
|
var
|
||||||
saved_command_line : pchar;cvar;external; { defined in top.c source }
|
saved_command_line : pchar;cvar;external; { defined in top.c source }
|
||||||
saved_command_line_size : longint;cvar;external; {defined in top.c source }
|
saved_command_line_size : longint;cvar;external; {defined in top.c source }
|
||||||
{$endif def GDB_HAS_SAVED_COMMAND_LINE_SIZE}
|
{$define GDB_SET_SAVED_COMMAND_LINE}
|
||||||
|
{$endif def GDB_HAS_SAVED_COMMAND_LINE_SIZE}
|
||||||
|
{$endif def GDB_HAS_SAVED_COMMAND_LINE_BUT_NO_SIZE}
|
||||||
{$endif}
|
{$endif}
|
||||||
{$endif GDB_NEEDS_SET_INSTREAM}
|
{$endif GDB_NEEDS_SET_INSTREAM}
|
||||||
var
|
var
|
||||||
@ -3494,8 +3510,8 @@ var
|
|||||||
{$ifdef GDB_NEEDS_INTERPRETER_SETUP}
|
{$ifdef GDB_NEEDS_INTERPRETER_SETUP}
|
||||||
type
|
type
|
||||||
interpreter_struct_p = pointer; { to opaque type }
|
interpreter_struct_p = pointer; { to opaque type }
|
||||||
function interp_lookup (name : pchar) : interpreter_struct_p;cdecl; external;
|
function interp_lookup ({$ifdef GDB_INTERP_LOOKUP_HAS_UI} ui :pui ;{$endif} name : pchar) : interpreter_struct_p;cdecl; external;
|
||||||
function interp_set (interp : interpreter_struct_p) : longbool;cdecl; external;
|
function interp_set (interp : interpreter_struct_p;top_level : cint) : longbool;cdecl; external;
|
||||||
{$endif GDB_NEEDS_INTERPRETER_SETUP}
|
{$endif GDB_NEEDS_INTERPRETER_SETUP}
|
||||||
const
|
const
|
||||||
DIRBUF_SIZE = 1024;
|
DIRBUF_SIZE = 1024;
|
||||||
@ -3555,9 +3571,9 @@ begin
|
|||||||
{$ifndef GDB_NO_INSTREAM_VAR}
|
{$ifndef GDB_NO_INSTREAM_VAR}
|
||||||
instream:=gdb_get_stdin;
|
instream:=gdb_get_stdin;
|
||||||
{$endif ndef GDB_NO_INSTREAM_VAR}
|
{$endif ndef GDB_NO_INSTREAM_VAR}
|
||||||
{$ifdef GDB_HAS_SAVED_COMMAND_LINE_SIZE}
|
{$ifdef GDB_SET_SAVED_COMMAND_LINE}
|
||||||
saved_command_line:=xmalloc(saved_command_line_size);
|
saved_command_line:=xmalloc(saved_command_line_size);
|
||||||
{$endif def GDB_HAS_SAVED_COMMAND_LINE_SIZE}
|
{$endif def GDB_SET_SAVED_COMMAND_LINE}
|
||||||
{$else}
|
{$else}
|
||||||
dummy_file :=gdb_fopen('dummy.$$$','a');
|
dummy_file :=gdb_fopen('dummy.$$$','a');
|
||||||
{in captured_main code, this is simply
|
{in captured_main code, this is simply
|
||||||
@ -3570,8 +3586,13 @@ begin
|
|||||||
{$endif}
|
{$endif}
|
||||||
{$endif GDB_NEEDS_SET_INSTREAM}
|
{$endif GDB_NEEDS_SET_INSTREAM}
|
||||||
|
|
||||||
|
{$ifdef LIBGDB_HAS_GET_STDIN}
|
||||||
|
gdb_stderr:=stdio_fileopen(gdb_get_stderr);
|
||||||
|
gdb_stdout:=stdio_fileopen(gdb_get_stdout);
|
||||||
|
{$else}
|
||||||
gdb_stderr:=mem_fileopen;
|
gdb_stderr:=mem_fileopen;
|
||||||
gdb_stdout:=mem_fileopen;
|
gdb_stdout:=mem_fileopen;
|
||||||
|
{$endif}
|
||||||
save_gdb_stderr:=gdb_stderr;
|
save_gdb_stderr:=gdb_stderr;
|
||||||
save_gdb_stdout:=gdb_stdout;
|
save_gdb_stdout:=gdb_stdout;
|
||||||
gdb_stdlog:=gdb_stderr;
|
gdb_stdlog:=gdb_stderr;
|
||||||
@ -3602,6 +3623,8 @@ begin
|
|||||||
{$endif GDB_V6}
|
{$endif GDB_V6}
|
||||||
{$ifdef GDB_NEW_UI}
|
{$ifdef GDB_NEW_UI}
|
||||||
local_ui := new_ui (gdb_stdin,gdb_stdout,gdb_stderr);
|
local_ui := new_ui (gdb_stdin,gdb_stdout,gdb_stderr);
|
||||||
|
main_ui:=local_ui;
|
||||||
|
current_ui:=main_ui;
|
||||||
{$endif not GDB_NEW_UI}
|
{$endif not GDB_NEW_UI}
|
||||||
{$ifdef GDB_INIT_HAS_ARGV0}
|
{$ifdef GDB_INIT_HAS_ARGV0}
|
||||||
getmem(argv0,length(paramstr(0))+1);
|
getmem(argv0,length(paramstr(0))+1);
|
||||||
@ -3614,9 +3637,9 @@ begin
|
|||||||
{$ifdef GDB_NEEDS_INTERPRETER_SETUP}
|
{$ifdef GDB_NEEDS_INTERPRETER_SETUP}
|
||||||
{ interpreter can only be set after all files are
|
{ interpreter can only be set after all files are
|
||||||
initialized, which is done in gdb_init function. }
|
initialized, which is done in gdb_init function. }
|
||||||
interp := interp_lookup ('console');
|
interp := interp_lookup ({$ifdef GDB_INTERP_LOOKUP_HAS_UI}current_ui,{$endif}'console');
|
||||||
interp_set (interp);
|
if not interp_set (interp,1) then
|
||||||
|
writeln(stderr,'Failed to set GDB console interpreter');
|
||||||
{ We need to re-set gdb_stdXX ui_files }
|
{ We need to re-set gdb_stdXX ui_files }
|
||||||
if assigned(gdb_stderr) then
|
if assigned(gdb_stderr) then
|
||||||
ui_file_delete(gdb_stderr);
|
ui_file_delete(gdb_stderr);
|
||||||
@ -3638,6 +3661,8 @@ begin
|
|||||||
{$endif GDB_NO_UIOUT}
|
{$endif GDB_NO_UIOUT}
|
||||||
{$ifdef GDB_NEW_UI}
|
{$ifdef GDB_NEW_UI}
|
||||||
local_ui := new_ui (gdb_stdin,gdb_stdout,gdb_stderr);
|
local_ui := new_ui (gdb_stdin,gdb_stdout,gdb_stderr);
|
||||||
|
main_ui:=local_ui;
|
||||||
|
current_ui:=main_ui;
|
||||||
{$endif not GDB_NEW_UI}
|
{$endif not GDB_NEW_UI}
|
||||||
{$endif GDB_NEEDS_INTERPRETER_SETUP}
|
{$endif GDB_NEEDS_INTERPRETER_SETUP}
|
||||||
{$ifdef supportexceptions}
|
{$ifdef supportexceptions}
|
||||||
|
Loading…
Reference in New Issue
Block a user