This linux powerpc/powerpc64 release was generated using GDB 7.6 sources (other GDb verison gave compilation errors). As 7.6 is not supported in 2.6.4 gdbint pacakge, I had to use trunk packages/gdbint/src/gdbint.pp source (svn revision 26711). To generate the powerpc release, some tweaks to get install/makepack to work were also required. Pierre Muller Only in ./fpcbuild-2.6.4-mod/fpcsrc: libgdb diff -ru ./fpcbuild-2.6.4/fpcsrc/packages/gdbint/src/gdbint.pp ./fpcbuild-2.6.4-mod/fpcsrc/packages/gdbint/src/gdbint.pp --- ./fpcbuild-2.6.4/fpcsrc/packages/gdbint/src/gdbint.pp 2013-05-16 12:25:57.000000000 -0700 +++ ./fpcbuild-2.6.4-mod/fpcsrc/packages/gdbint/src/gdbint.pp 2014-04-14 03:07:22.735721004 -0700 @@ -14,6 +14,7 @@ unit GdbInt; {$mode objfpc} +{$smartlink off} {$define NotImplemented} @@ -39,83 +40,69 @@ 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} +{$undef GDB_VERSION_RECOGNIZED} -{ 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} +{ 7.7.x } +{$ifdef GDB_V707} + {$info using gdb 7.7.x} + {$define GDB_VERSION_RECOGNIZED} + {$define GDB_VER_GE_707} +{$endif} -{ 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} +{$ifdef GDB_VER_GE_707} + {$define GDB_VER_GE_706} +{$endif} -{ 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} - {$define GDB_HAS_DEBUG_FILE_DIRECTORY} -{$endif def GDB_V606} +{ 7.6.x } +{$ifdef GDB_V706} + {$info using gdb 7.6.x} + {$define GDB_VERSION_RECOGNIZED} + {$define GDB_VER_GE_706} +{$endif} -{ 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} +{$ifdef GDB_VER_GE_706} + {$define GDB_VER_GE_705} +{$endif} -{ 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} +{ 7.5.x } +{$ifdef GDB_V705} + {$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} + {$define GDB_BP_HAS_ENABLE_COUNT} +{$endif} { 7.4.x } {$ifdef GDB_V704} {$info using gdb 7.4.x} + {$define GDB_VERSION_RECOGNIZED} + {$define GDB_VER_GE_704} +{$endif} + +{$ifdef GDB_VER_GE_704} {$define GDB_V7} {$define GDB_BP_LOCATION_HAS_GDBARCH} {$define GDB_HAS_PROGRAM_SPACE} @@ -131,11 +118,12 @@ {$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} @@ -150,11 +138,13 @@ {$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} @@ -163,6 +153,7 @@ { 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} @@ -173,6 +164,7 @@ { 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} @@ -197,9 +189,92 @@ {$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} @@ -207,6 +282,10 @@ {$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} @@ -426,9 +505,9 @@ {$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} @@ -960,7 +1039,7 @@ pprogram_space = pointer; pgdbarch = pointer; -{$PACKRECORDS 4} +{$PACKRECORDS C} pbreakpoint = ^breakpoint; breakpoint = record {$ifdef GDB_USES_BP_OPS} @@ -984,8 +1063,10 @@ {$ifdef GDB_USES_BP_OPS} display_canonical: byte; {$endif GDB_USES_BP_OPS} - ignore_count : longint; +{$ifdef GDB_BP_HAS_ENABLE_COUNT} + enable_count : longint; +{$endif GDB_BP_HAS_ENABLE_COUNT} {$ifndef GDB_USES_BP_LOCATION} shadow_contents : array[0..15] of char; inserted : char; @@ -1021,6 +1102,9 @@ section : pointer; {^asection} end; + pagent_expr = pointer; + tcondition_status = (condition_unchanged, condition_modified); + bp_target_info = record placed_address_space : pointer;{paddress_space;} placed_address : CORE_ADDR; @@ -1049,6 +1133,12 @@ owner : pbreakpoint; {$ifdef GDB_BP_LOCATION_HAS_GLOBAL_NEXT} cond : pointer;{pexpression;} +{$ifdef GDB_BP_LOCATION_HAS_COND_BYTECODE} + cond_bytecode : pagent_expr; + condition_changed : tcondition_status; + cmd_bytecode : pagent_expr; + needs_update : byte; +{$endif} shlib_disabled : byte; enabled : byte; {$endif GDB_BP_LOCATION_HAS_GLOBAL_NEXT} @@ -1067,6 +1157,10 @@ {$endif GDB_BP_LOCATION_HAS_GLOBAL_NEXT} section : pointer;{pobj_section;} requested_address : CORE_ADDR; +{$ifdef GDB_BP_LOCATION_HAS_RELATED_ADDRESS} + related_address : CORE_ADDR; + probe : pointer; { struct probe *probe; } +{$endif} {$ifdef GDB_BP_LOCATION_HAS_GLOBAL_NEXT} function_name : ^char; {$endif GDB_BP_LOCATION_HAS_GLOBAL_NEXT} @@ -1121,6 +1215,8 @@ avoid stack memory corruption PM } explicit_pc : longint; explicit_line : longint; + { New field added in GDB 7.5 version } + probe : pointer;{struct probe *probe; } end; symtabs_and_lines = record @@ -1566,7 +1662,7 @@ to_magic : longint; end; -{$PACKRECORDS NORMAL} +{$PACKRECORDS C} {***************************************************************************** Define external calls to libgdb.a @@ -1615,9 +1711,17 @@ 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; @@ -1639,7 +1743,11 @@ { 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; @@ -2021,6 +2129,13 @@ 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 @@ -2358,6 +2473,14 @@ {$endif} end; +procedure annotate_display_prompt;cdecl;public; +begin +{$ifdef Verbose} + Debug('|display_prompt|'); +{$endif} +end; + + procedure annotate_display_begin;cdecl;public; begin {$ifdef Verbose} @@ -2527,7 +2650,11 @@ 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; @@ -3226,6 +3353,10 @@ 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 @@ -3234,6 +3365,7 @@ instream:=pstdio_file(dummy_file^.to_data)^._file else instream:=nil; +{$endif} {$endif GDB_NEEDS_SET_INSTREAM} gdb_stderr:=mem_fileopen; @@ -3328,10 +3460,10 @@ 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; diff -ru ./fpcbuild-2.6.4/install/makepack ./fpcbuild-2.6.4-mod/install/makepack --- ./fpcbuild-2.6.4/install/makepack 2011-11-29 02:55:48.000000000 -0800 +++ ./fpcbuild-2.6.4-mod/install/makepack 2014-04-15 00:38:03.193460468 -0700 @@ -87,8 +87,11 @@ exit 1 fi else - NOGDB=1 + export NOGDB=1 fi +else + + export NOGDB=1 fi # First check for doc-pdf.tar.gz before building anything @@ -113,7 +116,7 @@ fi # check existence of binutils if cross packing -if [ ! "$CROSS" = "" ]; then +if [ ! "$CROSSDISABLED" = "" ]; then if [ ! -f binutils-${CROSSPREFIX}$FULLSOURCE.tar.gz ]; then echo "No cross binutils available: binutils-${CROSSPREFIX}$FULLSOURCE.tar.gz missing." exit 1 @@ -122,7 +125,7 @@ # Build everything using the makefiles ${MAKE} distclean CPU_TARGET=$TARGETCPU OS_TARGET=$TARGETOS -${MAKE} ${CROSS}zipinstall CPU_TARGET=$TARGETCPU OS_TARGET=$TARGETOS OPT="${EXTRAOPT}" FPC_VERSION=$VERSION +${MAKE} ${CROSS}zipinstall CPU_TARGET=$TARGETCPU OS_TARGET=$TARGETOS OPT="${EXTRAOPT}" FPC_VERSION=$VERSION "$EXTRAS" if [ $? != 0 ]; then echo "Failed to make distribution archive." exit 1