Date: Thursday, February 16, 2017 @ 12:01:36 Author: spupykin Revision: 212570
archrelease: copy trunk to community-i686, community-x86_64 Added: fpc/repos/community-i686/PKGBUILD (from rev 212569, fpc/trunk/PKGBUILD) fpc/repos/community-i686/fpc-gdb.patch (from rev 212569, fpc/trunk/fpc-gdb.patch) fpc/repos/community-x86_64/PKGBUILD (from rev 212569, fpc/trunk/PKGBUILD) fpc/repos/community-x86_64/fpc-gdb.patch (from rev 212569, fpc/trunk/fpc-gdb.patch) Deleted: fpc/repos/community-i686/PKGBUILD fpc/repos/community-i686/fpc-gdb.patch fpc/repos/community-x86_64/PKGBUILD fpc/repos/community-x86_64/fpc-gdb.patch --------------------------------+ /PKGBUILD | 142 +++ /fpc-gdb.patch | 1474 +++++++++++++++++++++++++++++++++++++++ community-i686/PKGBUILD | 69 - community-i686/fpc-gdb.patch | 737 ------------------- community-x86_64/PKGBUILD | 69 - community-x86_64/fpc-gdb.patch | 737 ------------------- 6 files changed, 1616 insertions(+), 1612 deletions(-) Deleted: community-i686/PKGBUILD =================================================================== --- community-i686/PKGBUILD 2017-02-16 12:01:19 UTC (rev 212569) +++ community-i686/PKGBUILD 2017-02-16 12:01:36 UTC (rev 212570) @@ -1,69 +0,0 @@ -# $Id$ -# Maintainer: Sergej Pupykin <pupykin.s+a...@gmail.com> -# Contributor: Valeriy Lyasotskiy <ones...@ukr.net> -# Contributor: Jan Willemson <jan...@hot.ee> -# Contributor: Hugo Ideler <hugoide...@dse.nl> -# Contributor: BlackIkeEagle <ike DOT devolder AT gmail DOT com> -# Original PKGBUILD: Andre Naumann <anaum...@sparced.org> -# See http://bbs.archlinux.org/viewtopic.php?t=9318&highlight=fpc - -pkgname=fpc -pkgver=3.0.0 -_gdbver=7.10 -pkgrel=1 -pkgdesc="The Free Pascal Compiler is a Turbo Pascal 7.0 and Delphi compatible 32bit Pascal Compiler. It comes with fully TP 7.0 compatible run-time library." -arch=('i686' 'x86_64') -url="http://www.freepascal.org/" -license=('GPL' 'LGPL' 'custom') -backup=("etc/fpc.cfg") -depends=(ncurses zlib expat) -makedepends=(fpc) -options=(zipman staticlibs) -source=(ftp://ftp.freepascal.org/pub/fpc/dist/$pkgver/source/fpcbuild-$pkgver.tar.gz - http://ftp.gnu.org/gnu/gdb/gdb-${_gdbver}.tar.xz - fpc-gdb.patch) -md5sums=('bb7d17ef5c7c007466368262c0779cb7' - '2a35bac41fa8e10bf04f3a0dd7f7f363' - '1e45ece6b5d4ee60b860e75926b4122d') - -build() { - cd ${srcdir}/gdb-${_gdbver} -# ./configure --prefix=/usr --disable-nls --without-python --disable-werror --disable-tui -# make -# make -C gdb libgdb.a -# cp libdecnumber/libdecnumber.a gdb/ - - cd ${srcdir}/fpcbuild-$pkgver -# patch -p1 <$srcdir/fpc-gdb.patch - export GDBLIBDIR=${srcdir}/gdb-${_gdbver}/gdb - export LIBGDBFILE=$GDBLIBDIR/libgdb.a - pushd fpcsrc/compiler - fpcmake -Tall - popd - make build NOGDB=1 -} - -package() { - cd ${srcdir}/fpcbuild-$pkgver - - export HOME=$srcdir - - make -j1 PREFIX=${pkgdir}/usr install - - export PATH=$pkgdir/usr/bin:$PATH - - install -Dm0644 fpcsrc/rtl/COPYING.FPC ${pkgdir}/usr/share/licenses/${pkgname}/COPYING.FPC - - [ "$CARCH" = "i686" ] && ln -s /usr/lib/fpc/${pkgver}/ppc386 ${pkgdir}/usr/bin/ - [ "$CARCH" = "x86_64" ] && ln -s /usr/lib/fpc/${pkgver}/ppcx64 ${pkgdir}/usr/bin/ - - mkdir -p ${pkgdir}/etc - ${pkgdir}/usr/lib/fpc/${pkgver}/samplecfg $pkgdir/usr/lib/fpc/${pkgver} ${pkgdir}/etc - - # use -fPIC by default - echo -e "#ifdef cpux86_64\n# for x86_64 use -fPIC by default\n-Cg\n#endif" >> "$pkgdir/etc/fpc.cfg" - - mv $pkgdir/usr/man $pkgdir/usr/share/ - - find $pkgdir/etc/ -type f -exec sed -i "s|$pkgdir||g" {} \; -} Copied: fpc/repos/community-i686/PKGBUILD (from rev 212569, fpc/trunk/PKGBUILD) =================================================================== --- community-i686/PKGBUILD (rev 0) +++ community-i686/PKGBUILD 2017-02-16 12:01:36 UTC (rev 212570) @@ -0,0 +1,71 @@ +# $Id$ +# Maintainer: Sergej Pupykin <pupykin.s+a...@gmail.com> +# Contributor: Valeriy Lyasotskiy <ones...@ukr.net> +# Contributor: Jan Willemson <jan...@hot.ee> +# Contributor: Hugo Ideler <hugoide...@dse.nl> +# Contributor: BlackIkeEagle <ike DOT devolder AT gmail DOT com> +# Original PKGBUILD: Andre Naumann <anaum...@sparced.org> +# See http://bbs.archlinux.org/viewtopic.php?t=9318&highlight=fpc + +pkgname=fpc +pkgver=3.0.2 +_gdbver=7.10 +pkgrel=1 +pkgdesc="The Free Pascal Compiler is a Turbo Pascal 7.0 and Delphi compatible 32bit Pascal Compiler. It comes with fully TP 7.0 compatible run-time library." +arch=('i686' 'x86_64') +url="http://www.freepascal.org/" +license=('GPL' 'LGPL' 'custom') +backup=("etc/fpc.cfg") +depends=(ncurses zlib expat) +makedepends=(fpc) +options=(zipman staticlibs) +validpgpkeys=('F40ADB902B24264AA42E50BF92EDB04BFF325CF3') +source=(ftp://ftp.freepascal.org/pub/fpc/dist/$pkgver/source/fpcbuild-$pkgver.tar.gz + https://ftp.gnu.org/gnu/gdb/gdb-${_gdbver}.tar.xz{,.sig} + fpc-gdb.patch) +sha256sums=('f261ed0a361f190169fff428d65b707df1507df317fc0ed101b0e63596541b75' + '7ebdaa44f9786ce0c142da4e36797d2020c55fa091905ac5af1846b5756208a8' + 'SKIP' + 'da73eed880c8d1f0f6ab0b78f72ea380ebe514fc524cfd87678de38939f8fbc7') + +build() { + cd "$srcdir"/gdb-${_gdbver} +# ./configure --prefix=/usr --disable-nls --without-python --disable-werror --disable-tui +# make +# make -C gdb libgdb.a +# cp libdecnumber/libdecnumber.a gdb/ + + cd "$srcdir"/fpcbuild-$pkgver +# patch -p1 <"$srcdir"/fpc-gdb.patch + export GDBLIBDIR="$srcdir"/gdb-${_gdbver}/gdb + export LIBGDBFILE=$GDBLIBDIR/libgdb.a + pushd fpcsrc/compiler + fpcmake -Tall + popd + make build NOGDB=1 +} + +package() { + cd "$srcdir"/fpcbuild-$pkgver + + export HOME="$srcdir" + + make -j1 PREFIX="$pkgdir"/usr install + + export PATH="$pkgdir"/usr/bin:$PATH + + install -Dm0644 fpcsrc/rtl/COPYING.FPC "$pkgdir"/usr/share/licenses/${pkgname}/COPYING.FPC + + [ "$CARCH" = "i686" ] && ln -s /usr/lib/fpc/${pkgver}/ppc386 "$pkgdir"/usr/bin/ + [ "$CARCH" = "x86_64" ] && ln -s /usr/lib/fpc/${pkgver}/ppcx64 "$pkgdir"/usr/bin/ + + mkdir -p "$pkgdir"/etc + "$pkgdir"/usr/lib/fpc/${pkgver}/samplecfg "$pkgdir"/usr/lib/fpc/${pkgver} "$pkgdir"/etc + + # use -fPIC by default + echo -e "#ifdef cpux86_64\n# for x86_64 use -fPIC by default\n-Cg\n#endif" >> "$pkgdir/etc/fpc.cfg" + + mv "$pkgdir"/usr/man "$pkgdir"/usr/share/ + + find "$pkgdir"/etc/ -type f -exec sed -i "s|"$pkgdir"||g" {} \; +} Deleted: community-i686/fpc-gdb.patch =================================================================== --- community-i686/fpc-gdb.patch 2017-02-16 12:01:19 UTC (rev 212569) +++ community-i686/fpc-gdb.patch 2017-02-16 12:01:36 UTC (rev 212570) @@ -1,737 +0,0 @@ -diff -wbBur fpcbuild-2.6.0/fpcsrc/ide/fp.pas fpcbuild-2.6.0.my/fpcsrc/ide/fp.pas ---- fpcbuild-2.6.0/fpcsrc/ide/fp.pas 2010-08-20 15:04:44.000000000 +0400 -+++ fpcbuild-2.6.0.my/fpcsrc/ide/fp.pas 2013-01-14 20:55:58.472376421 +0400 -@@ -14,6 +14,9 @@ - **********************************************************************} - program FP; - -+{$LINKLIB libz.so} -+ -+ - {$ifdef Windows} - { some windows versions, namely at least XP x64 don't like if the IDE stack - is too big } -diff -wbBur fpcbuild-2.6.0/fpcsrc/packages/gdbint/Makefile fpcbuild-2.6.0.my/fpcsrc/packages/gdbint/Makefile ---- fpcbuild-2.6.0/fpcsrc/packages/gdbint/Makefile 2011-12-11 00:19:00.000000000 +0400 -+++ fpcbuild-2.6.0.my/fpcsrc/packages/gdbint/Makefile 2013-01-14 20:32:15.545303270 +0400 -@@ -2337,10 +2337,12 @@ - endif - ifeq ($(OS_SOURCE),openbsd) - override FPCOPT+=-FD$(NEW_BINUTILS_PATH) -+override FPCMAKEOPT+=-FD$(NEW_BINUTILS_PATH) - endif - ifndef CROSSBOOTSTRAP - ifneq ($(BINUTILSPREFIX),) - override FPCOPT+=-XP$(BINUTILSPREFIX) -+override FPCMAKEOPT+=-XP$(BINUTILSPREFIX) - endif - ifneq ($(BINUTILSPREFIX),) - override FPCOPT+=-Xr$(RLINKPATH) -diff -wbBur fpcbuild-2.6.0/fpcsrc/packages/gdbint/src/gdbint.pp fpcbuild-2.6.0.my/fpcsrc/packages/gdbint/src/gdbint.pp ---- fpcbuild-2.6.0/fpcsrc/packages/gdbint/src/gdbint.pp 2011-12-10 20:50:23.000000000 +0400 -+++ fpcbuild-2.6.0.my/fpcsrc/packages/gdbint/src/gdbint.pp 2013-01-14 20:53:27.332331458 +0400 -@@ -17,6 +17,7 @@ - - {$define NotImplemented} - -+{$define GDB_DISABLE_PYTHON} - {$define COMPILING_GDBINT_UNIT} - {$ifdef USE_GDBLIBINC} - {$i gdblib.inc} -@@ -50,7 +51,6 @@ - {$ifdef GDB_V601} - {$info using gdb 6.1.x} - {$define GDB_V6} -- {$define GDB_HAS_DB_COMMANDS} - {$undef GDB_HAS_DEPRECATED_CBPH} - {$endif def GDB_V601} - -@@ -58,14 +58,12 @@ - {$ifdef GDB_V602} - {$info using gdb 6.2.x} - {$define GDB_V6} -- {$define GDB_HAS_DB_COMMANDS} - {$endif def GDB_V602} - - { 6.3.x } - {$ifdef GDB_V603} - {$info using gdb 6.3.x} - {$define GDB_V6} -- {$define GDB_HAS_DB_COMMANDS} - {$endif def GDB_V603} - - { 6.4.x } -@@ -73,7 +71,6 @@ - {$info using gdb 6.4.x} - {$define GDB_V6} - {$define GDB_NEEDS_NO_ERROR_INIT} -- {$define GDB_HAS_DB_COMMANDS} - {$endif def GDB_V604} - - { 6.5.x } -@@ -87,7 +84,6 @@ - {$ifdef GDB_V606} - {$info using gdb 6.6.x} - {$define GDB_V6} -- {$define GDB_HAS_DB_COMMANDS} - {$define GDB_USES_BP_LOCATION} - {$define GDB_NEEDS_NO_ERROR_INIT} - {$define GDB_USES_EXPAT_LIB} -@@ -98,7 +94,6 @@ - {$ifdef GDB_V607} - {$info using gdb 6.7.x} - {$define GDB_V6} -- {$define GDB_HAS_DB_COMMANDS} - {$define GDB_USES_BP_LOCATION} - {$define GDB_NEEDS_NO_ERROR_INIT} - {$define GDB_USES_EXPAT_LIB} -@@ -109,7 +104,6 @@ - {$ifdef GDB_V608} - {$info using gdb 6.8.x} - {$define GDB_V6} -- {$define GDB_HAS_DB_COMMANDS} - {$define GDB_USES_BP_LOCATION} - {$define GDB_BP_LOCATION_HAS_GLOBAL_NEXT} - {$define GDB_NEEDS_NO_ERROR_INIT} -@@ -120,13 +114,64 @@ - {$define GDB_HAS_BP_NONE} - {$endif def GDB_V608} - -+{ 7.5.x } -+{$ifdef GDB_V705} -+ {$info using gdb 7.5.x} -+ {$define GDB_V7} -+ {$define GDB_BP_LOCATION_HAS_GDBARCH} -+ {$define GDB_HAS_PROGRAM_SPACE} -+ {$define GDB_NO_UIOUT} -+ {$define GDB_NEEDS_INTERPRETER_SETUP} -+ {$define GDB_NEEDS_SET_INSTREAM} -+ {$define GDB_NOTIFY_BREAKPOINT_ARG_IS_BREAKPOINT_PTR} -+ {$define GDB_USES_BP_OPS} -+ {$define GDB_BP_TI_HAS_LENGTH} -+ {$define GDB_BP_LOCATION_HAS_REFCOUNT} -+ {$define GDB_BP_LOCATION_HAS_OPS} -+ {$define GDB_UI_FILE_HAS_WRITE_ASYNC} -+ {$ifdef win32} -+ {$define GDB_USES_LIBADVAPI32} -+ {$endif win32} -+{$endif def GDB_V705} -+ -+{ 7.4.x } -+{$ifdef GDB_V704} -+ {$info using gdb 7.4.x} -+ {$define GDB_V7} -+ {$define GDB_BP_LOCATION_HAS_GDBARCH} -+ {$define GDB_HAS_PROGRAM_SPACE} -+ {$define GDB_NO_UIOUT} -+ {$define GDB_NEEDS_INTERPRETER_SETUP} -+ {$define GDB_NEEDS_SET_INSTREAM} -+ {$define GDB_NOTIFY_BREAKPOINT_ARG_IS_BREAKPOINT_PTR} -+ {$define GDB_USES_BP_OPS} -+ {$define GDB_BP_TI_HAS_LENGTH} -+ {$define GDB_BP_LOCATION_HAS_REFCOUNT} -+ {$define GDB_BP_LOCATION_HAS_OPS} -+ {$define GDB_UI_FILE_HAS_WRITE_ASYNC} -+ {$ifdef win32} -+ {$define GDB_USES_LIBADVAPI32} -+ {$endif win32} -+{$endif def GDB_V704} -+ - { 7.3.x } - {$ifdef GDB_V703} - {$info using gdb 7.3.x} - {$define GDB_V7} - {$define GDB_BP_LOCATION_HAS_GDBARCH} - {$define GDB_HAS_PROGRAM_SPACE} --{$endif def GDB_V702} -+ {$define GDB_BP_TI_HAS_LENGTH} -+ {$define GDB_BP_LOCATION_HAS_REFCOUNT} -+ {$ifdef GDB_CVS} -+ {$define GDB_NO_UIOUT} -+ {$define GDB_NEEDS_INTERPRETER_SETUP} -+ {$define GDB_NEEDS_SET_INSTREAM} -+ {$define GDB_NOTIFY_BREAKPOINT_ARG_IS_BREAKPOINT_PTR} -+ {$define GDB_USES_BP_OPS} -+ {$define GDB_BP_LOCATION_HAS_OPS} -+ {$define GDB_UI_FILE_HAS_WRITE_ASYNC} -+ {$endif GDB_CVS} -+{$endif def GDB_V703} - - { 7.2.x } - {$ifdef GDB_V702} -@@ -448,8 +493,11 @@ - {$LINKLIB libintl.a} - {$LINKLIB imagehlp} - {$endif not USE_MINGW_GDB} -- {$LINKLIB kernel32} -+ {$ifdef GDB_USES_LIBADVAPI32} -+ {$LINKLIB advapi32} -+ {$endif GDB_USES_LIBADVAPI32} - {$LINKLIB user32} -+ {$LINKLIB kernel32} - {$endif win32} - - {$ifdef win64} -@@ -588,9 +636,11 @@ - type - - pui_file = ^ui_file; -+ pstdio_file = ^stdio_file; - - ui_file_flush_ftype = procedure(stream : pui_file);cdecl; - ui_file_write_ftype = procedure(stream : pui_file;buf : pchar;len : longint);cdecl; -+ ui_file_write_async_save_ftype = procedure(stream : pui_file;buf : pchar;len : longint);cdecl; - ui_file_fputs_ftype = procedure(buf : pchar; stream : pui_file);cdecl; - ui_file_delete_ftype = procedure(stream : pui_file);cdecl; - ui_file_isatty_ftype = function(stream : pui_file) : longbool;cdecl; -@@ -605,6 +655,9 @@ - magic : plongint; - to_flush : ui_file_flush_ftype; - to_write : ui_file_write_ftype; -+ {$ifdef GDB_UI_FILE_HAS_WRITE_ASYNC} -+ to_write_async_safe : ui_file_write_async_save_ftype; -+ {$endif} - to_fputs : ui_file_fputs_ftype; - {$ifdef GDB_V6} - to_read : ui_file_read_ftype; -@@ -616,6 +669,13 @@ - to_data : pointer; - end; - -+ stdio_file = record -+ magic : plongint; -+ _file : P_C_FILE; -+ df : longint; -+ close_p : longint; -+ end; -+ - { used to delete stdio_ui_file gdb_stdout and gdb_stderr } - procedure ui_file_delete(stream : pui_file);cdecl;external; - -@@ -774,10 +834,16 @@ - {$ifdef GDB_V6} - type - ui_out = pointer; -+{$ifndef GDB_NO_UIOUT} - var - uiout : ui_out;cvar;external; -+{$else GDB_NO_UIOUT} -+var -+ cli_uiout : ui_out;cvar;external; -+ current_uiout : ui_out;cvar;external; -+{$endif GDB_NO_UIOUT} - function cli_out_new (stream : pui_file):ui_out;cdecl;external; --{$endif} -+{$endif GDB_V6} - - {$ifdef go32v2} - { needed to be sure %fs contains the DOS memory selector -@@ -815,8 +881,11 @@ - jmp_buf = dpmi_jmp_buf; - pjmp_buf = pdpmi_jmp_buf; - -+ - function setjmp(var rec : jmp_buf) : longint;cdecl;external; - -+ function malloc(size : longint) : pointer;cdecl;external; -+ - procedure longjmp(var rec : jmp_buf;return_value : longint);cdecl;external; - - procedure reload_fs;assembler; -@@ -869,6 +938,13 @@ - pCORE_ADDR = ^CORE_ADDR; - pblock = ^block; - -+ tframe_id = record -+ stack_addr, code_addr, special_addr : CORE_ADDR; -+ addr_p_flags : byte;{ for three 1 bit flags -+ stack_addr_p, code_addr_p, special_addr_p : cint : 1; } -+ inline_depth : longint; -+ end; -+ - tlanguage = (language_unknown,language_auto,language_c, - language_cplus,language_java,language_chill, - language_fortran,language_m2,language_asm, -@@ -897,9 +973,18 @@ - - target_hw_bp_type = (hw_write, hw_read, hw_access, hw_execute); - -+ { pointer to structures that we don't need } -+ pbp_ops = pointer; -+ pbp_location_ops = pointer; -+ pprogram_space = pointer; -+ pgdbarch = pointer; -+ - {$PACKRECORDS 4} - pbreakpoint = ^breakpoint; - breakpoint = record -+{$ifdef GDB_USES_BP_OPS} -+ ops : pbp_ops; -+{$endif GDB_USES_BP_OPS} - next : pbreakpoint; - typ : bptype; - enable : tenable; -@@ -910,9 +995,15 @@ - {$else not GDB_USES_BP_LOCATION} - address : CORE_ADDR; - {$endif not GDB_USES_BP_LOCATION} -+{$ifndef GDB_USES_BP_OPS} - line_number : longint; - source_file : pchar; -+{$endif not GDB_USES_BP_OPS} - silent : byte; -+{$ifdef GDB_USES_BP_OPS} -+ display_canonical: byte; -+{$endif GDB_USES_BP_OPS} -+ - ignore_count : longint; - {$ifndef GDB_USES_BP_LOCATION} - shadow_contents : array[0..15] of char; -@@ -919,10 +1010,21 @@ - inserted : char; - duplicate : char; - {$endif not GDB_USES_BP_LOCATION} -+ - commands : pointer; {^command_line} -+{$ifdef GDB_USES_BP_OPS} -+ frame_id : tframe_id; -+ pspace : pprogram_space; -+{$else not GDB_USES_BP_OPS} - frame : CORE_ADDR; - cond : pointer; {^expression} -- addr_string : ^char; -+{$endif GDB_USES_BP_OPS} -+ addr_string : pchar; -+{$ifdef GDB_USES_BP_OPS} -+ filter : pchar; -+ addr_string_range_end : pchar; -+ gdbarch : pgdbarch; -+{$endif GDB_USES_BP_OPS} - language : tlanguage; - input_radix : longint; - cond_string : ^char; -@@ -941,6 +1043,9 @@ - bp_target_info = record - placed_address_space : pointer;{paddress_space;} - placed_address : CORE_ADDR; -+{$ifdef GDB_BP_TI_HAS_LENGTH} -+ length : longint; -+{$endif GDB_BP_TI_HAS_LENGTH} - shadow_contents : array[0..15] of char; - shadow_len : longint; - placed_size : longint; -@@ -948,9 +1053,17 @@ - - bp_location = record - next : pbp_location; -+{$ifdef GDB_BP_LOCATION_HAS_OPS} -+ ops : pbp_location_ops; -+{$endif GDB_BP_LOCATION_HAS_OPS} -+ -+{$ifdef GDB_BP_LOCATION_HAS_REFCOUNT} -+ refc : longint; -+{$else} - {$ifdef GDB_BP_LOCATION_HAS_GLOBAL_NEXT} - global_next : pbp_location; - {$endif GDB_BP_LOCATION_HAS_GLOBAL_NEXT} -+{$endif} - loc_type : bp_loc_type; - owner : pbreakpoint; - {$ifdef GDB_BP_LOCATION_HAS_GLOBAL_NEXT} -@@ -961,10 +1074,10 @@ - inserted : byte; - duplicate : byte; - {$ifdef GDB_BP_LOCATION_HAS_GDBARCH} -- gdbarch : pointer;{pgdbarch;} -+ gdbarch : pgdbarch; - {$endif GDB_BP_LOCATION_HAS_GDBARCH} - {$ifdef GDB_HAS_PROGRAM_SPACE} -- pspace : pointer;{pprogram_space;} -+ pspace : pprogram_space; - {$endif GDB_HAS_PROGRAM_SPACE} - address : CORE_ADDR; - {$ifdef GDB_BP_LOCATION_HAS_GLOBAL_NEXT} -@@ -979,6 +1092,11 @@ - target_info : bp_target_info; - overlay_target_info : bp_target_info; - events_till_retirement : longint; -+{$ifdef GDB_USES_BP_OPS} -+ { line and source file are in location } -+ line_number : longint; -+ source_file : pchar; -+{$endif not GDB_USES_BP_OPS} - end; - - tfreecode=(free_nothing,free_contents,free_linetable); -@@ -1488,7 +1606,9 @@ - {$endif ndef GDB_HAS_OBSERVER_NOTIFY_BREAKPOINT_CREATED} - current_target : target_ops;cvar;external; - stop_pc : CORE_ADDR;cvar;external; -- { Only used from GDB 5.01 but doesn't hurst otherwise } -+ { Only used from GDB 5.0 but doesn't hurst otherwise } -+ { This global variable is declared in defs.h as external -+ and instanciated in main.c since version 5.0. } - interpreter_p : pchar;cvar;public; - - { we need also to declare some vars } -@@ -1502,13 +1622,22 @@ - - { Whether xdb commands will be handled } - {$ifdef GDB_HAS_DB_COMMANDS} -+ { These two global variables are declared in defs.h -+ since version 4.18 } - xdb_commands : longint;cvar;public; - - { Whether dbx commands will be handled } - dbx_commands : longint;cvar;public; - {$endif GDB_HAS_DB_COMMANDS} - -+{$ifdef GDB_NEEDS_SET_INSTREAM} - var -+ instream : P_C_FILE;cvar;external; -+ function gdb_fopen (filename : pchar; mode : pchar) : pui_file;cdecl;external; -+{$endif GDB_NEEDS_SET_INSTREAM} -+var -+ { 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; - gdb_stdlog : pui_file;cvar;public; -@@ -1516,6 +1645,9 @@ - event_loop_p : longint;cvar;public; - {$ifdef GDB_V6} - (* target IO streams *) -+ { The three following variables are declared in defs.h -+ and instanciated in main.c since version 6.0 } -+ gdb_stdin : pui_file;cvar;public; - gdb_stdtargin : pui_file;cvar;public; - gdb_stdtargerr : pui_file;cvar;public; - {$endif} -@@ -1523,7 +1655,10 @@ - { used for gdb_stdout and gdb_stderr } - function xmalloc(size : longint) : pointer;cdecl;external; - { used for QueryHook } --function xstrvprintf(msg : pchar) : pchar; varargs; cdecl; external; -+{ xvasprintf is present at least from GDB 5.3 -+ while xstrvprintf only appears in version 6.2, -+ so only use xvasprintf function } -+function xvasprintf(ret : ppchar; msg : pchar) : pchar; varargs; cdecl; external; - 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; -@@ -2406,11 +2541,15 @@ - QueryHook:=0 - else - begin -- if curr_gdb^.reset_command and (pos('Kill',question)>0) then -+ if curr_gdb^.reset_command and ((pos('Kill',question)>0) or -+ (pos('Discard symbol table',question)>0)) then - QueryHook:=1 - else if pos('%',question)>0 then - begin -- local:=xstrvprintf(question,arg); -+ xvasprintf(@local,question,arg); -+ { xvasprintf can failed, in that case local is set to nil } -+ if not assigned(local) then -+ local:=question; - QueryHook:=curr_gdb^.Query(local, nil); - xfree(local); - end -@@ -2451,7 +2590,12 @@ - last_breakpoint_number:=b.number; - { function breakpoints have zero as file and as line !! - but they are valid !! } -+{$ifndef GDB_USES_BP_OPS} - invalid_breakpoint_line:=(b.line_number<>sym.line) and (b.line_number<>0); -+{$else GDB_USES_BP_OPS} -+ invalid_breakpoint_line:=(b.loc=nil) or -+ ((b.loc^.line_number<>sym.line) and (b.loc^.line_number<>0)); -+{$endif GDB_USES_BP_OPS} - {$ifdef GDB_USES_BP_LOCATION} - if assigned (b.loc) then - last_breakpoint_address:=b.loc^.address -@@ -2471,7 +2615,11 @@ - {$ifdef GDB_HAS_OBSERVER_NOTIFY_BREAKPOINT_CREATED} - - type -+{$ifdef GDB_NOTIFY_BREAKPOINT_ARG_IS_BREAKPOINT_PTR} -+ breakpoint_created_function_type = procedure (bpp : pbreakpoint); cdecl; -+{$else not GDB_NOTIFY_BREAKPOINT_ARG_IS_BREAKPOINT_PTR} - breakpoint_created_function_type = procedure (bpnum : longint); cdecl; -+{$endif not GDB_NOTIFY_BREAKPOINT_ARG_IS_BREAKPOINT_PTR} - pobserver = pointer; - var - breakpoint_created_observer : pobserver = nil; -@@ -2479,8 +2627,14 @@ - function observer_attach_breakpoint_created(create_func : breakpoint_created_function_type) : pobserver;cdecl;external; - procedure observer_detach_breakpoint_created(pob : pobserver);cdecl;external; - --var breakpoint_chain : pbreakpoint ;cvar;external; - -+{$ifdef GDB_NOTIFY_BREAKPOINT_ARG_IS_BREAKPOINT_PTR} -+procedure notify_breakpoint_created(bpp : pbreakpoint); cdecl; -+begin -+ CreateBreakpointHook(bpp^); -+end; -+{$else not GDB_NOTIFY_BREAKPOINT_ARG_IS_BREAKPOINT_PTR} -+var breakpoint_chain : pbreakpoint ;cvar;external; - - procedure notify_breakpoint_created(bpnum : longint);cdecl; - var -@@ -2498,8 +2652,16 @@ - pb:=pb^.next; - end; - end; -+{$endif not GDB_NOTIFY_BREAKPOINT_ARG_IS_BREAKPOINT_PTR} - {$endif def GDB_HAS_OBSERVER_NOTIFY_BREAKPOINT_CREATED} - -+{ Avoid loading of main.o object by providing a -+ stripped down version of relocate_gdb_directory function } -+function relocate_gdb_directory(path : pchar) : pchar; cdecl; public; -+begin -+ relocate_gdb_directory:=path; -+end; -+ - {***************************************************************************** - tgdbinterface - *****************************************************************************} -@@ -2528,7 +2690,7 @@ - gdb_command('set print object on'); - gdb_command('set print null-stop'); - {$ifdef USE_MINGW_GDB} // maybe this also should be done for newer cygwin gdbs. -- gdb_command('set confirm off'); -+ //gdb_command('set confirm off'); - {$endif} - end; - -@@ -2609,9 +2771,9 @@ - var - top_level_val : longint; - --function catch_errors(func : pointer; command : pchar; from_tty,mask : longint) : longint;cdecl;external; -+function catch_command_errors(func : pointer; command : pchar; from_tty,mask : longint) : longint;cdecl;external; - --function gdbint_execute_command(command : pchar; from_tty,mask : longint) : longint;cdecl; -+function gdbint_execute_command(command : pchar; from_tty : longint) : longint;cdecl; - begin - gdbint_execute_command:=1; - execute_command(command,from_tty); -@@ -2658,6 +2820,8 @@ - begin - {$ifdef cpui386} - MaskAllFPUExceptions := control or MaskAllExceptions; -+{$else} -+ MaskAllFPUExceptions:=0; - {$endif} - end; - -@@ -2716,7 +2880,8 @@ - begin - quit_return:=error_return; - mask:=longint($ffffffff); -- catch_errors(@gdbint_execute_command,@command,0,mask); -+ catch_command_errors(@gdbint_execute_command,@command, -+ 1,mask); - {$ifdef go32v2} - reload_fs; - {$endif go32v2} -@@ -2973,11 +3138,43 @@ - c_environ : ppchar;external name '_environ'; - c_argc : longint;external name '___crt0_argc'; - c_argv : ppchar;external name '___crt0_argv'; -+ -+ procedure ReallocateEnvironUsingCMalloc; -+ -+ var -+ neededsize , count : longint; -+ penv : pchar; -+ newenv : ppchar; -+ begin -+ if not assigned(c_environ) then -+ neededsize:=0 -+ else -+ begin -+ count:=0; -+ penv:=c_environ^; -+ while assigned(penv) do -+ begin -+ inc(count); -+ inc(penv,sizeof(pchar)); -+ end; -+ neededsize:=count*sizeof(pchar); -+ end; -+ newenv:=malloc(neededsize); -+ system.move(c_environ,newenv,neededsize); -+ c_environ:=newenv; -+ end; -+ - {$endif def go32v2} - var - current_directory : pchar; cvar; external; - gdb_dirbuf : array[0..0] of char; cvar; external; - CurrentDir : AnsiString; -+{$ifdef GDB_NEEDS_INTERPRETER_SETUP} -+ type -+ interpreter_struct_p = pointer; { to opaque type } -+ function interp_lookup (name : pchar) : interpreter_struct_p;cdecl; external; -+ function interp_set (interp : interpreter_struct_p) : longbool;cdecl; external; -+{$endif GDB_NEEDS_INTERPRETER_SETUP} - const - DIRBUF_SIZE = 1024; - -@@ -2986,13 +3183,28 @@ - var - OldSigInt : SignalHandler; - {$endif supportexceptions} -+{$ifdef GDB_NEEDS_SET_INSTREAM} -+var -+ dummy_file : pui_file; -+{$endif GDB_NEEDS_SET_INSTREAM} -+ - {$ifdef GDB_INIT_HAS_ARGV0} - var - argv0 : pchar; - {$endif not GDB_INIT_HAS_ARGV0} -+{$ifdef GDB_NEEDS_INTERPRETER_SETUP} -+var -+ interp : interpreter_struct_p; -+{$endif GDB_NEEDS_INTERPRETER_SETUP} -+var -+ save_gdb_stdin, -+ save_gdb_stdout, -+ save_gdb_stderr : pui_file; - begin - {$ifdef go32v2} -- c_environ:=system.envp; -+ { c_environ:=system.envp; } -+ { DJGPP libC presupposes the c_enivron was malloc'ated } -+ ReallocateEnvironUsingCMalloc; - c_argc:=system.argc; - c_argv:=system.argv; - {$endif def go32v2} -@@ -3012,8 +3224,25 @@ - ui_file_delete(gdb_stderr); - if assigned(gdb_stdout) then - ui_file_delete(gdb_stdout); -+{$ifdef GDB_NEEDS_SET_INSTREAM} -+ if assigned(gdb_stdin) then -+ ui_file_delete(gdb_stdin); -+ gdb_stdin:=mem_fileopen; -+ save_gdb_stdin:=gdb_stdin; -+ dummy_file :=gdb_fopen('dummy.$$$','a'); -+ {in captured_main code, this is simply -+ instream:=stdin; but stdin is a highly system dependent macro -+ so that we try to avoid it here } -+ if assigned(dummy_file) then -+ instream:=pstdio_file(dummy_file^.to_data)^._file -+ else -+ instream:=nil; -+{$endif GDB_NEEDS_SET_INSTREAM} -+ - gdb_stderr:=mem_fileopen; - gdb_stdout:=mem_fileopen; -+ save_gdb_stderr:=gdb_stderr; -+ save_gdb_stdout:=gdb_stdout; - gdb_stdlog:=gdb_stderr; - gdb_stdtarg:=gdb_stderr; - set_ui_file_write(gdb_stdout,@gdbint_ui_file_write); -@@ -3022,7 +3251,9 @@ - error_init; - {$endif GDB_NEEDS_NO_ERROR_INIT} - {$ifdef GDB_V6} --// gdb_stdtargin := gdb_stdin; -+{$ifdef GDB_NEEDS_SET_INSTREAM} -+ gdb_stdtargin := gdb_stdin; -+{$endif GDB_NEEDS_SET_INSTREAM} - gdb_stdtargerr := gdb_stderr; - {$endif} - GetDir(0, CurrentDir); -@@ -3034,8 +3265,10 @@ - next_exit:=exitproc; - exitproc:=@DoneLibGDB; - {$ifdef GDB_V6} -+{$ifndef GDB_NO_UIOUT} - uiout := cli_out_new (gdb_stdout); --{$endif} -+{$endif not GDB_NO_UIOUT} -+{$endif GDB_V6} - {$ifdef GDB_INIT_HAS_ARGV0} - getmem(argv0,length(paramstr(0))+1); - strpcopy(argv0,paramstr(0)); -@@ -3044,6 +3277,31 @@ - {$else not GDB_INIT_HAS_ARGV0} - gdb_init; - {$endif not GDB_INIT_HAS_ARGV0} -+{$ifdef GDB_NEEDS_INTERPRETER_SETUP} -+ { interpreter can only be set after all files are -+ initialized, which is done in gdb_init function. } -+ interp := interp_lookup ('console'); -+ interp_set (interp); -+ -+ { We need to re-set gdb_stdXX ui_files } -+ if assigned(gdb_stderr) then -+ ui_file_delete(gdb_stderr); -+ if assigned(gdb_stdout) then -+ ui_file_delete(gdb_stdout); -+ if assigned(gdb_stdin) then -+ ui_file_delete(gdb_stdin); -+ gdb_stdin:=save_gdb_stdin; -+ gdb_stderr:=save_gdb_stderr; -+ gdb_stdout:=save_gdb_stdout; -+ gdb_stdlog:=gdb_stderr; -+ gdb_stdtarg:=gdb_stderr; -+ set_ui_file_write(gdb_stdout,@gdbint_ui_file_write); -+ set_ui_file_write(gdb_stderr,@gdbint_ui_file_write); -+{$ifdef GDB_NO_UIOUT} -+ cli_uiout := cli_out_new (gdb_stdout); -+ current_uiout:=cli_uiout; -+{$endif GDB_NO_UIOUT} -+{$endif GDB_NEEDS_INTERPRETER_SETUP} - {$ifdef supportexceptions} - {$ifdef unix} - fpsignal(SIGINT,OldSigInt); -@@ -3069,14 +3327,34 @@ - end; - - {$ifdef GDB_HAS_SYSROOT} --var gdb_sysroot : pchar; cvar;public; -+ { Here we declare as cvar;public; a bunch of global -+ variables that are defined in main.c source. -+ We must not load main.o otherwise, we will get -+ into multiply defined symbols troubles. } -+var -+ gdb_sysrootc : char; -+ { used locally only to provide a pchar pointing to '\0' } -+ 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; -+ { gdb_datadir global variable is declared in defs.h and -+ instanciated in main.c since version 7.0 } - python_libdir : pchar;cvar;public; -- gdb_sysrootc : char; -+ { python_libdir global variable is declared in defs.h and instanciated -+ in main.c since version 7.2 } - return_child_result : longbool;cvar;public; -+ { return_chlid_result global variable is declared in main.h and -+ instanciated in main.c since version 6.4 } - return_child_result_value : longint;cvar;public; -+ { return_child_result_value global variable is declared in main.h and -+ instanciated in main.c since version 6.4 with a startup value of -1 } - batch_silent : longbool;cvar;public; -+ { batch_silent global variable is declared in main.h since 7.0, but -+ instanciated in main.c since version 6.4 } - batch_flag : longbool;cvar;public; -+ { batch_flag global variable is declared in main.h and -+ instanciated in main.c since version 7.2 } - {$endif} - {$ifdef GDB_HAS_DEBUG_FILE_DIRECTORY} - var -@@ -3086,6 +3364,7 @@ - begin - {$ifdef GDB_HAS_SYSROOT} - gdb_sysrootc := #0; -+ return_child_result_value := -1; - gdb_sysroot := @gdb_sysrootc; - gdb_datadir := @gdb_sysrootc; - python_libdir := @gdb_sysrootc; Copied: fpc/repos/community-i686/fpc-gdb.patch (from rev 212569, fpc/trunk/fpc-gdb.patch) =================================================================== --- community-i686/fpc-gdb.patch (rev 0) +++ community-i686/fpc-gdb.patch 2017-02-16 12:01:36 UTC (rev 212570) @@ -0,0 +1,737 @@ +diff -wbBur fpcbuild-2.6.0/fpcsrc/ide/fp.pas fpcbuild-2.6.0.my/fpcsrc/ide/fp.pas +--- fpcbuild-2.6.0/fpcsrc/ide/fp.pas 2010-08-20 15:04:44.000000000 +0400 ++++ fpcbuild-2.6.0.my/fpcsrc/ide/fp.pas 2013-01-14 20:55:58.472376421 +0400 +@@ -14,6 +14,9 @@ + **********************************************************************} + program FP; + ++{$LINKLIB libz.so} ++ ++ + {$ifdef Windows} + { some windows versions, namely at least XP x64 don't like if the IDE stack + is too big } +diff -wbBur fpcbuild-2.6.0/fpcsrc/packages/gdbint/Makefile fpcbuild-2.6.0.my/fpcsrc/packages/gdbint/Makefile +--- fpcbuild-2.6.0/fpcsrc/packages/gdbint/Makefile 2011-12-11 00:19:00.000000000 +0400 ++++ fpcbuild-2.6.0.my/fpcsrc/packages/gdbint/Makefile 2013-01-14 20:32:15.545303270 +0400 +@@ -2337,10 +2337,12 @@ + endif + ifeq ($(OS_SOURCE),openbsd) + override FPCOPT+=-FD$(NEW_BINUTILS_PATH) ++override FPCMAKEOPT+=-FD$(NEW_BINUTILS_PATH) + endif + ifndef CROSSBOOTSTRAP + ifneq ($(BINUTILSPREFIX),) + override FPCOPT+=-XP$(BINUTILSPREFIX) ++override FPCMAKEOPT+=-XP$(BINUTILSPREFIX) + endif + ifneq ($(BINUTILSPREFIX),) + override FPCOPT+=-Xr$(RLINKPATH) +diff -wbBur fpcbuild-2.6.0/fpcsrc/packages/gdbint/src/gdbint.pp fpcbuild-2.6.0.my/fpcsrc/packages/gdbint/src/gdbint.pp +--- fpcbuild-2.6.0/fpcsrc/packages/gdbint/src/gdbint.pp 2011-12-10 20:50:23.000000000 +0400 ++++ fpcbuild-2.6.0.my/fpcsrc/packages/gdbint/src/gdbint.pp 2013-01-14 20:53:27.332331458 +0400 +@@ -17,6 +17,7 @@ + + {$define NotImplemented} + ++{$define GDB_DISABLE_PYTHON} + {$define COMPILING_GDBINT_UNIT} + {$ifdef USE_GDBLIBINC} + {$i gdblib.inc} +@@ -50,7 +51,6 @@ + {$ifdef GDB_V601} + {$info using gdb 6.1.x} + {$define GDB_V6} +- {$define GDB_HAS_DB_COMMANDS} + {$undef GDB_HAS_DEPRECATED_CBPH} + {$endif def GDB_V601} + +@@ -58,14 +58,12 @@ + {$ifdef GDB_V602} + {$info using gdb 6.2.x} + {$define GDB_V6} +- {$define GDB_HAS_DB_COMMANDS} + {$endif def GDB_V602} + + { 6.3.x } + {$ifdef GDB_V603} + {$info using gdb 6.3.x} + {$define GDB_V6} +- {$define GDB_HAS_DB_COMMANDS} + {$endif def GDB_V603} + + { 6.4.x } +@@ -73,7 +71,6 @@ + {$info using gdb 6.4.x} + {$define GDB_V6} + {$define GDB_NEEDS_NO_ERROR_INIT} +- {$define GDB_HAS_DB_COMMANDS} + {$endif def GDB_V604} + + { 6.5.x } +@@ -87,7 +84,6 @@ + {$ifdef GDB_V606} + {$info using gdb 6.6.x} + {$define GDB_V6} +- {$define GDB_HAS_DB_COMMANDS} + {$define GDB_USES_BP_LOCATION} + {$define GDB_NEEDS_NO_ERROR_INIT} + {$define GDB_USES_EXPAT_LIB} +@@ -98,7 +94,6 @@ + {$ifdef GDB_V607} + {$info using gdb 6.7.x} + {$define GDB_V6} +- {$define GDB_HAS_DB_COMMANDS} + {$define GDB_USES_BP_LOCATION} + {$define GDB_NEEDS_NO_ERROR_INIT} + {$define GDB_USES_EXPAT_LIB} +@@ -109,7 +104,6 @@ + {$ifdef GDB_V608} + {$info using gdb 6.8.x} + {$define GDB_V6} +- {$define GDB_HAS_DB_COMMANDS} + {$define GDB_USES_BP_LOCATION} + {$define GDB_BP_LOCATION_HAS_GLOBAL_NEXT} + {$define GDB_NEEDS_NO_ERROR_INIT} +@@ -120,13 +114,64 @@ + {$define GDB_HAS_BP_NONE} + {$endif def GDB_V608} + ++{ 7.5.x } ++{$ifdef GDB_V705} ++ {$info using gdb 7.5.x} ++ {$define GDB_V7} ++ {$define GDB_BP_LOCATION_HAS_GDBARCH} ++ {$define GDB_HAS_PROGRAM_SPACE} ++ {$define GDB_NO_UIOUT} ++ {$define GDB_NEEDS_INTERPRETER_SETUP} ++ {$define GDB_NEEDS_SET_INSTREAM} ++ {$define GDB_NOTIFY_BREAKPOINT_ARG_IS_BREAKPOINT_PTR} ++ {$define GDB_USES_BP_OPS} ++ {$define GDB_BP_TI_HAS_LENGTH} ++ {$define GDB_BP_LOCATION_HAS_REFCOUNT} ++ {$define GDB_BP_LOCATION_HAS_OPS} ++ {$define GDB_UI_FILE_HAS_WRITE_ASYNC} ++ {$ifdef win32} ++ {$define GDB_USES_LIBADVAPI32} ++ {$endif win32} ++{$endif def GDB_V705} ++ ++{ 7.4.x } ++{$ifdef GDB_V704} ++ {$info using gdb 7.4.x} ++ {$define GDB_V7} ++ {$define GDB_BP_LOCATION_HAS_GDBARCH} ++ {$define GDB_HAS_PROGRAM_SPACE} ++ {$define GDB_NO_UIOUT} ++ {$define GDB_NEEDS_INTERPRETER_SETUP} ++ {$define GDB_NEEDS_SET_INSTREAM} ++ {$define GDB_NOTIFY_BREAKPOINT_ARG_IS_BREAKPOINT_PTR} ++ {$define GDB_USES_BP_OPS} ++ {$define GDB_BP_TI_HAS_LENGTH} ++ {$define GDB_BP_LOCATION_HAS_REFCOUNT} ++ {$define GDB_BP_LOCATION_HAS_OPS} ++ {$define GDB_UI_FILE_HAS_WRITE_ASYNC} ++ {$ifdef win32} ++ {$define GDB_USES_LIBADVAPI32} ++ {$endif win32} ++{$endif def GDB_V704} ++ + { 7.3.x } + {$ifdef GDB_V703} + {$info using gdb 7.3.x} + {$define GDB_V7} + {$define GDB_BP_LOCATION_HAS_GDBARCH} + {$define GDB_HAS_PROGRAM_SPACE} +-{$endif def GDB_V702} ++ {$define GDB_BP_TI_HAS_LENGTH} ++ {$define GDB_BP_LOCATION_HAS_REFCOUNT} ++ {$ifdef GDB_CVS} ++ {$define GDB_NO_UIOUT} ++ {$define GDB_NEEDS_INTERPRETER_SETUP} ++ {$define GDB_NEEDS_SET_INSTREAM} ++ {$define GDB_NOTIFY_BREAKPOINT_ARG_IS_BREAKPOINT_PTR} ++ {$define GDB_USES_BP_OPS} ++ {$define GDB_BP_LOCATION_HAS_OPS} ++ {$define GDB_UI_FILE_HAS_WRITE_ASYNC} ++ {$endif GDB_CVS} ++{$endif def GDB_V703} + + { 7.2.x } + {$ifdef GDB_V702} +@@ -448,8 +493,11 @@ + {$LINKLIB libintl.a} + {$LINKLIB imagehlp} + {$endif not USE_MINGW_GDB} +- {$LINKLIB kernel32} ++ {$ifdef GDB_USES_LIBADVAPI32} ++ {$LINKLIB advapi32} ++ {$endif GDB_USES_LIBADVAPI32} + {$LINKLIB user32} ++ {$LINKLIB kernel32} + {$endif win32} + + {$ifdef win64} +@@ -588,9 +636,11 @@ + type + + pui_file = ^ui_file; ++ pstdio_file = ^stdio_file; + + ui_file_flush_ftype = procedure(stream : pui_file);cdecl; + ui_file_write_ftype = procedure(stream : pui_file;buf : pchar;len : longint);cdecl; ++ ui_file_write_async_save_ftype = procedure(stream : pui_file;buf : pchar;len : longint);cdecl; + ui_file_fputs_ftype = procedure(buf : pchar; stream : pui_file);cdecl; + ui_file_delete_ftype = procedure(stream : pui_file);cdecl; + ui_file_isatty_ftype = function(stream : pui_file) : longbool;cdecl; +@@ -605,6 +655,9 @@ + magic : plongint; + to_flush : ui_file_flush_ftype; + to_write : ui_file_write_ftype; ++ {$ifdef GDB_UI_FILE_HAS_WRITE_ASYNC} ++ to_write_async_safe : ui_file_write_async_save_ftype; ++ {$endif} + to_fputs : ui_file_fputs_ftype; + {$ifdef GDB_V6} + to_read : ui_file_read_ftype; +@@ -616,6 +669,13 @@ + to_data : pointer; + end; + ++ stdio_file = record ++ magic : plongint; ++ _file : P_C_FILE; ++ df : longint; ++ close_p : longint; ++ end; ++ + { used to delete stdio_ui_file gdb_stdout and gdb_stderr } + procedure ui_file_delete(stream : pui_file);cdecl;external; + +@@ -774,10 +834,16 @@ + {$ifdef GDB_V6} + type + ui_out = pointer; ++{$ifndef GDB_NO_UIOUT} + var + uiout : ui_out;cvar;external; ++{$else GDB_NO_UIOUT} ++var ++ cli_uiout : ui_out;cvar;external; ++ current_uiout : ui_out;cvar;external; ++{$endif GDB_NO_UIOUT} + function cli_out_new (stream : pui_file):ui_out;cdecl;external; +-{$endif} ++{$endif GDB_V6} + + {$ifdef go32v2} + { needed to be sure %fs contains the DOS memory selector +@@ -815,8 +881,11 @@ + jmp_buf = dpmi_jmp_buf; + pjmp_buf = pdpmi_jmp_buf; + ++ + function setjmp(var rec : jmp_buf) : longint;cdecl;external; + ++ function malloc(size : longint) : pointer;cdecl;external; ++ + procedure longjmp(var rec : jmp_buf;return_value : longint);cdecl;external; + + procedure reload_fs;assembler; +@@ -869,6 +938,13 @@ + pCORE_ADDR = ^CORE_ADDR; + pblock = ^block; + ++ tframe_id = record ++ stack_addr, code_addr, special_addr : CORE_ADDR; ++ addr_p_flags : byte;{ for three 1 bit flags ++ stack_addr_p, code_addr_p, special_addr_p : cint : 1; } ++ inline_depth : longint; ++ end; ++ + tlanguage = (language_unknown,language_auto,language_c, + language_cplus,language_java,language_chill, + language_fortran,language_m2,language_asm, +@@ -897,9 +973,18 @@ + + target_hw_bp_type = (hw_write, hw_read, hw_access, hw_execute); + ++ { pointer to structures that we don't need } ++ pbp_ops = pointer; ++ pbp_location_ops = pointer; ++ pprogram_space = pointer; ++ pgdbarch = pointer; ++ + {$PACKRECORDS 4} + pbreakpoint = ^breakpoint; + breakpoint = record ++{$ifdef GDB_USES_BP_OPS} ++ ops : pbp_ops; ++{$endif GDB_USES_BP_OPS} + next : pbreakpoint; + typ : bptype; + enable : tenable; +@@ -910,9 +995,15 @@ + {$else not GDB_USES_BP_LOCATION} + address : CORE_ADDR; + {$endif not GDB_USES_BP_LOCATION} ++{$ifndef GDB_USES_BP_OPS} + line_number : longint; + source_file : pchar; ++{$endif not GDB_USES_BP_OPS} + silent : byte; ++{$ifdef GDB_USES_BP_OPS} ++ display_canonical: byte; ++{$endif GDB_USES_BP_OPS} ++ + ignore_count : longint; + {$ifndef GDB_USES_BP_LOCATION} + shadow_contents : array[0..15] of char; +@@ -919,10 +1010,21 @@ + inserted : char; + duplicate : char; + {$endif not GDB_USES_BP_LOCATION} ++ + commands : pointer; {^command_line} ++{$ifdef GDB_USES_BP_OPS} ++ frame_id : tframe_id; ++ pspace : pprogram_space; ++{$else not GDB_USES_BP_OPS} + frame : CORE_ADDR; + cond : pointer; {^expression} +- addr_string : ^char; ++{$endif GDB_USES_BP_OPS} ++ addr_string : pchar; ++{$ifdef GDB_USES_BP_OPS} ++ filter : pchar; ++ addr_string_range_end : pchar; ++ gdbarch : pgdbarch; ++{$endif GDB_USES_BP_OPS} + language : tlanguage; + input_radix : longint; + cond_string : ^char; +@@ -941,6 +1043,9 @@ + bp_target_info = record + placed_address_space : pointer;{paddress_space;} + placed_address : CORE_ADDR; ++{$ifdef GDB_BP_TI_HAS_LENGTH} ++ length : longint; ++{$endif GDB_BP_TI_HAS_LENGTH} + shadow_contents : array[0..15] of char; + shadow_len : longint; + placed_size : longint; +@@ -948,9 +1053,17 @@ + + bp_location = record + next : pbp_location; ++{$ifdef GDB_BP_LOCATION_HAS_OPS} ++ ops : pbp_location_ops; ++{$endif GDB_BP_LOCATION_HAS_OPS} ++ ++{$ifdef GDB_BP_LOCATION_HAS_REFCOUNT} ++ refc : longint; ++{$else} + {$ifdef GDB_BP_LOCATION_HAS_GLOBAL_NEXT} + global_next : pbp_location; + {$endif GDB_BP_LOCATION_HAS_GLOBAL_NEXT} ++{$endif} + loc_type : bp_loc_type; + owner : pbreakpoint; + {$ifdef GDB_BP_LOCATION_HAS_GLOBAL_NEXT} +@@ -961,10 +1074,10 @@ + inserted : byte; + duplicate : byte; + {$ifdef GDB_BP_LOCATION_HAS_GDBARCH} +- gdbarch : pointer;{pgdbarch;} ++ gdbarch : pgdbarch; + {$endif GDB_BP_LOCATION_HAS_GDBARCH} + {$ifdef GDB_HAS_PROGRAM_SPACE} +- pspace : pointer;{pprogram_space;} ++ pspace : pprogram_space; + {$endif GDB_HAS_PROGRAM_SPACE} + address : CORE_ADDR; + {$ifdef GDB_BP_LOCATION_HAS_GLOBAL_NEXT} +@@ -979,6 +1092,11 @@ + target_info : bp_target_info; + overlay_target_info : bp_target_info; + events_till_retirement : longint; ++{$ifdef GDB_USES_BP_OPS} ++ { line and source file are in location } ++ line_number : longint; ++ source_file : pchar; ++{$endif not GDB_USES_BP_OPS} + end; + + tfreecode=(free_nothing,free_contents,free_linetable); +@@ -1488,7 +1606,9 @@ + {$endif ndef GDB_HAS_OBSERVER_NOTIFY_BREAKPOINT_CREATED} + current_target : target_ops;cvar;external; + stop_pc : CORE_ADDR;cvar;external; +- { Only used from GDB 5.01 but doesn't hurst otherwise } ++ { Only used from GDB 5.0 but doesn't hurst otherwise } ++ { This global variable is declared in defs.h as external ++ and instanciated in main.c since version 5.0. } + interpreter_p : pchar;cvar;public; + + { we need also to declare some vars } +@@ -1502,13 +1622,22 @@ + + { Whether xdb commands will be handled } + {$ifdef GDB_HAS_DB_COMMANDS} ++ { These two global variables are declared in defs.h ++ since version 4.18 } + xdb_commands : longint;cvar;public; + + { Whether dbx commands will be handled } + dbx_commands : longint;cvar;public; + {$endif GDB_HAS_DB_COMMANDS} + ++{$ifdef GDB_NEEDS_SET_INSTREAM} + var ++ instream : P_C_FILE;cvar;external; ++ function gdb_fopen (filename : pchar; mode : pchar) : pui_file;cdecl;external; ++{$endif GDB_NEEDS_SET_INSTREAM} ++var ++ { 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; + gdb_stdlog : pui_file;cvar;public; +@@ -1516,6 +1645,9 @@ + event_loop_p : longint;cvar;public; + {$ifdef GDB_V6} + (* target IO streams *) ++ { The three following variables are declared in defs.h ++ and instanciated in main.c since version 6.0 } ++ gdb_stdin : pui_file;cvar;public; + gdb_stdtargin : pui_file;cvar;public; + gdb_stdtargerr : pui_file;cvar;public; + {$endif} +@@ -1523,7 +1655,10 @@ + { used for gdb_stdout and gdb_stderr } + function xmalloc(size : longint) : pointer;cdecl;external; + { used for QueryHook } +-function xstrvprintf(msg : pchar) : pchar; varargs; cdecl; external; ++{ xvasprintf is present at least from GDB 5.3 ++ while xstrvprintf only appears in version 6.2, ++ so only use xvasprintf function } ++function xvasprintf(ret : ppchar; msg : pchar) : pchar; varargs; cdecl; external; + 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; +@@ -2406,11 +2541,15 @@ + QueryHook:=0 + else + begin +- if curr_gdb^.reset_command and (pos('Kill',question)>0) then ++ if curr_gdb^.reset_command and ((pos('Kill',question)>0) or ++ (pos('Discard symbol table',question)>0)) then + QueryHook:=1 + else if pos('%',question)>0 then + begin +- local:=xstrvprintf(question,arg); ++ xvasprintf(@local,question,arg); ++ { xvasprintf can failed, in that case local is set to nil } ++ if not assigned(local) then ++ local:=question; + QueryHook:=curr_gdb^.Query(local, nil); + xfree(local); + end +@@ -2451,7 +2590,12 @@ + last_breakpoint_number:=b.number; + { function breakpoints have zero as file and as line !! + but they are valid !! } ++{$ifndef GDB_USES_BP_OPS} + invalid_breakpoint_line:=(b.line_number<>sym.line) and (b.line_number<>0); ++{$else GDB_USES_BP_OPS} ++ invalid_breakpoint_line:=(b.loc=nil) or ++ ((b.loc^.line_number<>sym.line) and (b.loc^.line_number<>0)); ++{$endif GDB_USES_BP_OPS} + {$ifdef GDB_USES_BP_LOCATION} + if assigned (b.loc) then + last_breakpoint_address:=b.loc^.address +@@ -2471,7 +2615,11 @@ + {$ifdef GDB_HAS_OBSERVER_NOTIFY_BREAKPOINT_CREATED} + + type ++{$ifdef GDB_NOTIFY_BREAKPOINT_ARG_IS_BREAKPOINT_PTR} ++ breakpoint_created_function_type = procedure (bpp : pbreakpoint); cdecl; ++{$else not GDB_NOTIFY_BREAKPOINT_ARG_IS_BREAKPOINT_PTR} + breakpoint_created_function_type = procedure (bpnum : longint); cdecl; ++{$endif not GDB_NOTIFY_BREAKPOINT_ARG_IS_BREAKPOINT_PTR} + pobserver = pointer; + var + breakpoint_created_observer : pobserver = nil; +@@ -2479,8 +2627,14 @@ + function observer_attach_breakpoint_created(create_func : breakpoint_created_function_type) : pobserver;cdecl;external; + procedure observer_detach_breakpoint_created(pob : pobserver);cdecl;external; + +-var breakpoint_chain : pbreakpoint ;cvar;external; + ++{$ifdef GDB_NOTIFY_BREAKPOINT_ARG_IS_BREAKPOINT_PTR} ++procedure notify_breakpoint_created(bpp : pbreakpoint); cdecl; ++begin ++ CreateBreakpointHook(bpp^); ++end; ++{$else not GDB_NOTIFY_BREAKPOINT_ARG_IS_BREAKPOINT_PTR} ++var breakpoint_chain : pbreakpoint ;cvar;external; + + procedure notify_breakpoint_created(bpnum : longint);cdecl; + var +@@ -2498,8 +2652,16 @@ + pb:=pb^.next; + end; + end; ++{$endif not GDB_NOTIFY_BREAKPOINT_ARG_IS_BREAKPOINT_PTR} + {$endif def GDB_HAS_OBSERVER_NOTIFY_BREAKPOINT_CREATED} + ++{ Avoid loading of main.o object by providing a ++ stripped down version of relocate_gdb_directory function } ++function relocate_gdb_directory(path : pchar) : pchar; cdecl; public; ++begin ++ relocate_gdb_directory:=path; ++end; ++ + {***************************************************************************** + tgdbinterface + *****************************************************************************} +@@ -2528,7 +2690,7 @@ + gdb_command('set print object on'); + gdb_command('set print null-stop'); + {$ifdef USE_MINGW_GDB} // maybe this also should be done for newer cygwin gdbs. +- gdb_command('set confirm off'); ++ //gdb_command('set confirm off'); + {$endif} + end; + +@@ -2609,9 +2771,9 @@ + var + top_level_val : longint; + +-function catch_errors(func : pointer; command : pchar; from_tty,mask : longint) : longint;cdecl;external; ++function catch_command_errors(func : pointer; command : pchar; from_tty,mask : longint) : longint;cdecl;external; + +-function gdbint_execute_command(command : pchar; from_tty,mask : longint) : longint;cdecl; ++function gdbint_execute_command(command : pchar; from_tty : longint) : longint;cdecl; + begin + gdbint_execute_command:=1; + execute_command(command,from_tty); +@@ -2658,6 +2820,8 @@ + begin + {$ifdef cpui386} + MaskAllFPUExceptions := control or MaskAllExceptions; ++{$else} ++ MaskAllFPUExceptions:=0; + {$endif} + end; + +@@ -2716,7 +2880,8 @@ + begin + quit_return:=error_return; + mask:=longint($ffffffff); +- catch_errors(@gdbint_execute_command,@command,0,mask); ++ catch_command_errors(@gdbint_execute_command,@command, ++ 1,mask); + {$ifdef go32v2} + reload_fs; + {$endif go32v2} +@@ -2973,11 +3138,43 @@ + c_environ : ppchar;external name '_environ'; + c_argc : longint;external name '___crt0_argc'; + c_argv : ppchar;external name '___crt0_argv'; ++ ++ procedure ReallocateEnvironUsingCMalloc; ++ ++ var ++ neededsize , count : longint; ++ penv : pchar; ++ newenv : ppchar; ++ begin ++ if not assigned(c_environ) then ++ neededsize:=0 ++ else ++ begin ++ count:=0; ++ penv:=c_environ^; ++ while assigned(penv) do ++ begin ++ inc(count); ++ inc(penv,sizeof(pchar)); ++ end; ++ neededsize:=count*sizeof(pchar); ++ end; ++ newenv:=malloc(neededsize); ++ system.move(c_environ,newenv,neededsize); ++ c_environ:=newenv; ++ end; ++ + {$endif def go32v2} + var + current_directory : pchar; cvar; external; + gdb_dirbuf : array[0..0] of char; cvar; external; + CurrentDir : AnsiString; ++{$ifdef GDB_NEEDS_INTERPRETER_SETUP} ++ type ++ interpreter_struct_p = pointer; { to opaque type } ++ function interp_lookup (name : pchar) : interpreter_struct_p;cdecl; external; ++ function interp_set (interp : interpreter_struct_p) : longbool;cdecl; external; ++{$endif GDB_NEEDS_INTERPRETER_SETUP} + const + DIRBUF_SIZE = 1024; + +@@ -2986,13 +3183,28 @@ + var + OldSigInt : SignalHandler; + {$endif supportexceptions} ++{$ifdef GDB_NEEDS_SET_INSTREAM} ++var ++ dummy_file : pui_file; ++{$endif GDB_NEEDS_SET_INSTREAM} ++ + {$ifdef GDB_INIT_HAS_ARGV0} + var + argv0 : pchar; + {$endif not GDB_INIT_HAS_ARGV0} ++{$ifdef GDB_NEEDS_INTERPRETER_SETUP} ++var ++ interp : interpreter_struct_p; ++{$endif GDB_NEEDS_INTERPRETER_SETUP} ++var ++ save_gdb_stdin, ++ save_gdb_stdout, ++ save_gdb_stderr : pui_file; + begin + {$ifdef go32v2} +- c_environ:=system.envp; ++ { c_environ:=system.envp; } ++ { DJGPP libC presupposes the c_enivron was malloc'ated } ++ ReallocateEnvironUsingCMalloc; + c_argc:=system.argc; + c_argv:=system.argv; + {$endif def go32v2} +@@ -3012,8 +3224,25 @@ + ui_file_delete(gdb_stderr); + if assigned(gdb_stdout) then + ui_file_delete(gdb_stdout); ++{$ifdef GDB_NEEDS_SET_INSTREAM} ++ if assigned(gdb_stdin) then ++ ui_file_delete(gdb_stdin); ++ gdb_stdin:=mem_fileopen; ++ save_gdb_stdin:=gdb_stdin; ++ dummy_file :=gdb_fopen('dummy.$$$','a'); ++ {in captured_main code, this is simply ++ instream:=stdin; but stdin is a highly system dependent macro ++ so that we try to avoid it here } ++ if assigned(dummy_file) then ++ instream:=pstdio_file(dummy_file^.to_data)^._file ++ else ++ instream:=nil; ++{$endif GDB_NEEDS_SET_INSTREAM} ++ + gdb_stderr:=mem_fileopen; + gdb_stdout:=mem_fileopen; ++ save_gdb_stderr:=gdb_stderr; ++ save_gdb_stdout:=gdb_stdout; + gdb_stdlog:=gdb_stderr; + gdb_stdtarg:=gdb_stderr; + set_ui_file_write(gdb_stdout,@gdbint_ui_file_write); +@@ -3022,7 +3251,9 @@ + error_init; + {$endif GDB_NEEDS_NO_ERROR_INIT} + {$ifdef GDB_V6} +-// gdb_stdtargin := gdb_stdin; ++{$ifdef GDB_NEEDS_SET_INSTREAM} ++ gdb_stdtargin := gdb_stdin; ++{$endif GDB_NEEDS_SET_INSTREAM} + gdb_stdtargerr := gdb_stderr; + {$endif} + GetDir(0, CurrentDir); +@@ -3034,8 +3265,10 @@ + next_exit:=exitproc; + exitproc:=@DoneLibGDB; + {$ifdef GDB_V6} ++{$ifndef GDB_NO_UIOUT} + uiout := cli_out_new (gdb_stdout); +-{$endif} ++{$endif not GDB_NO_UIOUT} ++{$endif GDB_V6} + {$ifdef GDB_INIT_HAS_ARGV0} + getmem(argv0,length(paramstr(0))+1); + strpcopy(argv0,paramstr(0)); +@@ -3044,6 +3277,31 @@ + {$else not GDB_INIT_HAS_ARGV0} + gdb_init; + {$endif not GDB_INIT_HAS_ARGV0} ++{$ifdef GDB_NEEDS_INTERPRETER_SETUP} ++ { interpreter can only be set after all files are ++ initialized, which is done in gdb_init function. } ++ interp := interp_lookup ('console'); ++ interp_set (interp); ++ ++ { We need to re-set gdb_stdXX ui_files } ++ if assigned(gdb_stderr) then ++ ui_file_delete(gdb_stderr); ++ if assigned(gdb_stdout) then ++ ui_file_delete(gdb_stdout); ++ if assigned(gdb_stdin) then ++ ui_file_delete(gdb_stdin); ++ gdb_stdin:=save_gdb_stdin; ++ gdb_stderr:=save_gdb_stderr; ++ gdb_stdout:=save_gdb_stdout; ++ gdb_stdlog:=gdb_stderr; ++ gdb_stdtarg:=gdb_stderr; ++ set_ui_file_write(gdb_stdout,@gdbint_ui_file_write); ++ set_ui_file_write(gdb_stderr,@gdbint_ui_file_write); ++{$ifdef GDB_NO_UIOUT} ++ cli_uiout := cli_out_new (gdb_stdout); ++ current_uiout:=cli_uiout; ++{$endif GDB_NO_UIOUT} ++{$endif GDB_NEEDS_INTERPRETER_SETUP} + {$ifdef supportexceptions} + {$ifdef unix} + fpsignal(SIGINT,OldSigInt); +@@ -3069,14 +3327,34 @@ + end; + + {$ifdef GDB_HAS_SYSROOT} +-var gdb_sysroot : pchar; cvar;public; ++ { Here we declare as cvar;public; a bunch of global ++ variables that are defined in main.c source. ++ We must not load main.o otherwise, we will get ++ into multiply defined symbols troubles. } ++var ++ gdb_sysrootc : char; ++ { used locally only to provide a pchar pointing to '\0' } ++ 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; ++ { gdb_datadir global variable is declared in defs.h and ++ instanciated in main.c since version 7.0 } + python_libdir : pchar;cvar;public; +- gdb_sysrootc : char; ++ { python_libdir global variable is declared in defs.h and instanciated ++ in main.c since version 7.2 } + return_child_result : longbool;cvar;public; ++ { return_chlid_result global variable is declared in main.h and ++ instanciated in main.c since version 6.4 } + return_child_result_value : longint;cvar;public; ++ { return_child_result_value global variable is declared in main.h and ++ instanciated in main.c since version 6.4 with a startup value of -1 } + batch_silent : longbool;cvar;public; ++ { batch_silent global variable is declared in main.h since 7.0, but ++ instanciated in main.c since version 6.4 } + batch_flag : longbool;cvar;public; ++ { batch_flag global variable is declared in main.h and ++ instanciated in main.c since version 7.2 } + {$endif} + {$ifdef GDB_HAS_DEBUG_FILE_DIRECTORY} + var +@@ -3086,6 +3364,7 @@ + begin + {$ifdef GDB_HAS_SYSROOT} + gdb_sysrootc := #0; ++ return_child_result_value := -1; + gdb_sysroot := @gdb_sysrootc; + gdb_datadir := @gdb_sysrootc; + python_libdir := @gdb_sysrootc; Deleted: community-x86_64/PKGBUILD =================================================================== --- community-x86_64/PKGBUILD 2017-02-16 12:01:19 UTC (rev 212569) +++ community-x86_64/PKGBUILD 2017-02-16 12:01:36 UTC (rev 212570) @@ -1,69 +0,0 @@ -# $Id$ -# Maintainer: Sergej Pupykin <pupykin.s+a...@gmail.com> -# Contributor: Valeriy Lyasotskiy <ones...@ukr.net> -# Contributor: Jan Willemson <jan...@hot.ee> -# Contributor: Hugo Ideler <hugoide...@dse.nl> -# Contributor: BlackIkeEagle <ike DOT devolder AT gmail DOT com> -# Original PKGBUILD: Andre Naumann <anaum...@sparced.org> -# See http://bbs.archlinux.org/viewtopic.php?t=9318&highlight=fpc - -pkgname=fpc -pkgver=3.0.0 -_gdbver=7.10 -pkgrel=1 -pkgdesc="The Free Pascal Compiler is a Turbo Pascal 7.0 and Delphi compatible 32bit Pascal Compiler. It comes with fully TP 7.0 compatible run-time library." -arch=('i686' 'x86_64') -url="http://www.freepascal.org/" -license=('GPL' 'LGPL' 'custom') -backup=("etc/fpc.cfg") -depends=(ncurses zlib expat) -makedepends=(fpc) -options=(zipman staticlibs) -source=(ftp://ftp.freepascal.org/pub/fpc/dist/$pkgver/source/fpcbuild-$pkgver.tar.gz - http://ftp.gnu.org/gnu/gdb/gdb-${_gdbver}.tar.xz - fpc-gdb.patch) -md5sums=('bb7d17ef5c7c007466368262c0779cb7' - '2a35bac41fa8e10bf04f3a0dd7f7f363' - '1e45ece6b5d4ee60b860e75926b4122d') - -build() { - cd ${srcdir}/gdb-${_gdbver} -# ./configure --prefix=/usr --disable-nls --without-python --disable-werror --disable-tui -# make -# make -C gdb libgdb.a -# cp libdecnumber/libdecnumber.a gdb/ - - cd ${srcdir}/fpcbuild-$pkgver -# patch -p1 <$srcdir/fpc-gdb.patch - export GDBLIBDIR=${srcdir}/gdb-${_gdbver}/gdb - export LIBGDBFILE=$GDBLIBDIR/libgdb.a - pushd fpcsrc/compiler - fpcmake -Tall - popd - make build NOGDB=1 -} - -package() { - cd ${srcdir}/fpcbuild-$pkgver - - export HOME=$srcdir - - make -j1 PREFIX=${pkgdir}/usr install - - export PATH=$pkgdir/usr/bin:$PATH - - install -Dm0644 fpcsrc/rtl/COPYING.FPC ${pkgdir}/usr/share/licenses/${pkgname}/COPYING.FPC - - [ "$CARCH" = "i686" ] && ln -s /usr/lib/fpc/${pkgver}/ppc386 ${pkgdir}/usr/bin/ - [ "$CARCH" = "x86_64" ] && ln -s /usr/lib/fpc/${pkgver}/ppcx64 ${pkgdir}/usr/bin/ - - mkdir -p ${pkgdir}/etc - ${pkgdir}/usr/lib/fpc/${pkgver}/samplecfg $pkgdir/usr/lib/fpc/${pkgver} ${pkgdir}/etc - - # use -fPIC by default - echo -e "#ifdef cpux86_64\n# for x86_64 use -fPIC by default\n-Cg\n#endif" >> "$pkgdir/etc/fpc.cfg" - - mv $pkgdir/usr/man $pkgdir/usr/share/ - - find $pkgdir/etc/ -type f -exec sed -i "s|$pkgdir||g" {} \; -} Copied: fpc/repos/community-x86_64/PKGBUILD (from rev 212569, fpc/trunk/PKGBUILD) =================================================================== --- community-x86_64/PKGBUILD (rev 0) +++ community-x86_64/PKGBUILD 2017-02-16 12:01:36 UTC (rev 212570) @@ -0,0 +1,71 @@ +# $Id$ +# Maintainer: Sergej Pupykin <pupykin.s+a...@gmail.com> +# Contributor: Valeriy Lyasotskiy <ones...@ukr.net> +# Contributor: Jan Willemson <jan...@hot.ee> +# Contributor: Hugo Ideler <hugoide...@dse.nl> +# Contributor: BlackIkeEagle <ike DOT devolder AT gmail DOT com> +# Original PKGBUILD: Andre Naumann <anaum...@sparced.org> +# See http://bbs.archlinux.org/viewtopic.php?t=9318&highlight=fpc + +pkgname=fpc +pkgver=3.0.2 +_gdbver=7.10 +pkgrel=1 +pkgdesc="The Free Pascal Compiler is a Turbo Pascal 7.0 and Delphi compatible 32bit Pascal Compiler. It comes with fully TP 7.0 compatible run-time library." +arch=('i686' 'x86_64') +url="http://www.freepascal.org/" +license=('GPL' 'LGPL' 'custom') +backup=("etc/fpc.cfg") +depends=(ncurses zlib expat) +makedepends=(fpc) +options=(zipman staticlibs) +validpgpkeys=('F40ADB902B24264AA42E50BF92EDB04BFF325CF3') +source=(ftp://ftp.freepascal.org/pub/fpc/dist/$pkgver/source/fpcbuild-$pkgver.tar.gz + https://ftp.gnu.org/gnu/gdb/gdb-${_gdbver}.tar.xz{,.sig} + fpc-gdb.patch) +sha256sums=('f261ed0a361f190169fff428d65b707df1507df317fc0ed101b0e63596541b75' + '7ebdaa44f9786ce0c142da4e36797d2020c55fa091905ac5af1846b5756208a8' + 'SKIP' + 'da73eed880c8d1f0f6ab0b78f72ea380ebe514fc524cfd87678de38939f8fbc7') + +build() { + cd "$srcdir"/gdb-${_gdbver} +# ./configure --prefix=/usr --disable-nls --without-python --disable-werror --disable-tui +# make +# make -C gdb libgdb.a +# cp libdecnumber/libdecnumber.a gdb/ + + cd "$srcdir"/fpcbuild-$pkgver +# patch -p1 <"$srcdir"/fpc-gdb.patch + export GDBLIBDIR="$srcdir"/gdb-${_gdbver}/gdb + export LIBGDBFILE=$GDBLIBDIR/libgdb.a + pushd fpcsrc/compiler + fpcmake -Tall + popd + make build NOGDB=1 +} + +package() { + cd "$srcdir"/fpcbuild-$pkgver + + export HOME="$srcdir" + + make -j1 PREFIX="$pkgdir"/usr install + + export PATH="$pkgdir"/usr/bin:$PATH + + install -Dm0644 fpcsrc/rtl/COPYING.FPC "$pkgdir"/usr/share/licenses/${pkgname}/COPYING.FPC + + [ "$CARCH" = "i686" ] && ln -s /usr/lib/fpc/${pkgver}/ppc386 "$pkgdir"/usr/bin/ + [ "$CARCH" = "x86_64" ] && ln -s /usr/lib/fpc/${pkgver}/ppcx64 "$pkgdir"/usr/bin/ + + mkdir -p "$pkgdir"/etc + "$pkgdir"/usr/lib/fpc/${pkgver}/samplecfg "$pkgdir"/usr/lib/fpc/${pkgver} "$pkgdir"/etc + + # use -fPIC by default + echo -e "#ifdef cpux86_64\n# for x86_64 use -fPIC by default\n-Cg\n#endif" >> "$pkgdir/etc/fpc.cfg" + + mv "$pkgdir"/usr/man "$pkgdir"/usr/share/ + + find "$pkgdir"/etc/ -type f -exec sed -i "s|"$pkgdir"||g" {} \; +} Deleted: community-x86_64/fpc-gdb.patch =================================================================== --- community-x86_64/fpc-gdb.patch 2017-02-16 12:01:19 UTC (rev 212569) +++ community-x86_64/fpc-gdb.patch 2017-02-16 12:01:36 UTC (rev 212570) @@ -1,737 +0,0 @@ -diff -wbBur fpcbuild-2.6.0/fpcsrc/ide/fp.pas fpcbuild-2.6.0.my/fpcsrc/ide/fp.pas ---- fpcbuild-2.6.0/fpcsrc/ide/fp.pas 2010-08-20 15:04:44.000000000 +0400 -+++ fpcbuild-2.6.0.my/fpcsrc/ide/fp.pas 2013-01-14 20:55:58.472376421 +0400 -@@ -14,6 +14,9 @@ - **********************************************************************} - program FP; - -+{$LINKLIB libz.so} -+ -+ - {$ifdef Windows} - { some windows versions, namely at least XP x64 don't like if the IDE stack - is too big } -diff -wbBur fpcbuild-2.6.0/fpcsrc/packages/gdbint/Makefile fpcbuild-2.6.0.my/fpcsrc/packages/gdbint/Makefile ---- fpcbuild-2.6.0/fpcsrc/packages/gdbint/Makefile 2011-12-11 00:19:00.000000000 +0400 -+++ fpcbuild-2.6.0.my/fpcsrc/packages/gdbint/Makefile 2013-01-14 20:32:15.545303270 +0400 -@@ -2337,10 +2337,12 @@ - endif - ifeq ($(OS_SOURCE),openbsd) - override FPCOPT+=-FD$(NEW_BINUTILS_PATH) -+override FPCMAKEOPT+=-FD$(NEW_BINUTILS_PATH) - endif - ifndef CROSSBOOTSTRAP - ifneq ($(BINUTILSPREFIX),) - override FPCOPT+=-XP$(BINUTILSPREFIX) -+override FPCMAKEOPT+=-XP$(BINUTILSPREFIX) - endif - ifneq ($(BINUTILSPREFIX),) - override FPCOPT+=-Xr$(RLINKPATH) -diff -wbBur fpcbuild-2.6.0/fpcsrc/packages/gdbint/src/gdbint.pp fpcbuild-2.6.0.my/fpcsrc/packages/gdbint/src/gdbint.pp ---- fpcbuild-2.6.0/fpcsrc/packages/gdbint/src/gdbint.pp 2011-12-10 20:50:23.000000000 +0400 -+++ fpcbuild-2.6.0.my/fpcsrc/packages/gdbint/src/gdbint.pp 2013-01-14 20:53:27.332331458 +0400 -@@ -17,6 +17,7 @@ - - {$define NotImplemented} - -+{$define GDB_DISABLE_PYTHON} - {$define COMPILING_GDBINT_UNIT} - {$ifdef USE_GDBLIBINC} - {$i gdblib.inc} -@@ -50,7 +51,6 @@ - {$ifdef GDB_V601} - {$info using gdb 6.1.x} - {$define GDB_V6} -- {$define GDB_HAS_DB_COMMANDS} - {$undef GDB_HAS_DEPRECATED_CBPH} - {$endif def GDB_V601} - -@@ -58,14 +58,12 @@ - {$ifdef GDB_V602} - {$info using gdb 6.2.x} - {$define GDB_V6} -- {$define GDB_HAS_DB_COMMANDS} - {$endif def GDB_V602} - - { 6.3.x } - {$ifdef GDB_V603} - {$info using gdb 6.3.x} - {$define GDB_V6} -- {$define GDB_HAS_DB_COMMANDS} - {$endif def GDB_V603} - - { 6.4.x } -@@ -73,7 +71,6 @@ - {$info using gdb 6.4.x} - {$define GDB_V6} - {$define GDB_NEEDS_NO_ERROR_INIT} -- {$define GDB_HAS_DB_COMMANDS} - {$endif def GDB_V604} - - { 6.5.x } -@@ -87,7 +84,6 @@ - {$ifdef GDB_V606} - {$info using gdb 6.6.x} - {$define GDB_V6} -- {$define GDB_HAS_DB_COMMANDS} - {$define GDB_USES_BP_LOCATION} - {$define GDB_NEEDS_NO_ERROR_INIT} - {$define GDB_USES_EXPAT_LIB} -@@ -98,7 +94,6 @@ - {$ifdef GDB_V607} - {$info using gdb 6.7.x} - {$define GDB_V6} -- {$define GDB_HAS_DB_COMMANDS} - {$define GDB_USES_BP_LOCATION} - {$define GDB_NEEDS_NO_ERROR_INIT} - {$define GDB_USES_EXPAT_LIB} -@@ -109,7 +104,6 @@ - {$ifdef GDB_V608} - {$info using gdb 6.8.x} - {$define GDB_V6} -- {$define GDB_HAS_DB_COMMANDS} - {$define GDB_USES_BP_LOCATION} - {$define GDB_BP_LOCATION_HAS_GLOBAL_NEXT} - {$define GDB_NEEDS_NO_ERROR_INIT} -@@ -120,13 +114,64 @@ - {$define GDB_HAS_BP_NONE} - {$endif def GDB_V608} - -+{ 7.5.x } -+{$ifdef GDB_V705} -+ {$info using gdb 7.5.x} -+ {$define GDB_V7} -+ {$define GDB_BP_LOCATION_HAS_GDBARCH} -+ {$define GDB_HAS_PROGRAM_SPACE} -+ {$define GDB_NO_UIOUT} -+ {$define GDB_NEEDS_INTERPRETER_SETUP} -+ {$define GDB_NEEDS_SET_INSTREAM} -+ {$define GDB_NOTIFY_BREAKPOINT_ARG_IS_BREAKPOINT_PTR} -+ {$define GDB_USES_BP_OPS} -+ {$define GDB_BP_TI_HAS_LENGTH} -+ {$define GDB_BP_LOCATION_HAS_REFCOUNT} -+ {$define GDB_BP_LOCATION_HAS_OPS} -+ {$define GDB_UI_FILE_HAS_WRITE_ASYNC} -+ {$ifdef win32} -+ {$define GDB_USES_LIBADVAPI32} -+ {$endif win32} -+{$endif def GDB_V705} -+ -+{ 7.4.x } -+{$ifdef GDB_V704} -+ {$info using gdb 7.4.x} -+ {$define GDB_V7} -+ {$define GDB_BP_LOCATION_HAS_GDBARCH} -+ {$define GDB_HAS_PROGRAM_SPACE} -+ {$define GDB_NO_UIOUT} -+ {$define GDB_NEEDS_INTERPRETER_SETUP} -+ {$define GDB_NEEDS_SET_INSTREAM} -+ {$define GDB_NOTIFY_BREAKPOINT_ARG_IS_BREAKPOINT_PTR} -+ {$define GDB_USES_BP_OPS} -+ {$define GDB_BP_TI_HAS_LENGTH} -+ {$define GDB_BP_LOCATION_HAS_REFCOUNT} -+ {$define GDB_BP_LOCATION_HAS_OPS} -+ {$define GDB_UI_FILE_HAS_WRITE_ASYNC} -+ {$ifdef win32} -+ {$define GDB_USES_LIBADVAPI32} -+ {$endif win32} -+{$endif def GDB_V704} -+ - { 7.3.x } - {$ifdef GDB_V703} - {$info using gdb 7.3.x} - {$define GDB_V7} - {$define GDB_BP_LOCATION_HAS_GDBARCH} - {$define GDB_HAS_PROGRAM_SPACE} --{$endif def GDB_V702} -+ {$define GDB_BP_TI_HAS_LENGTH} -+ {$define GDB_BP_LOCATION_HAS_REFCOUNT} -+ {$ifdef GDB_CVS} -+ {$define GDB_NO_UIOUT} -+ {$define GDB_NEEDS_INTERPRETER_SETUP} -+ {$define GDB_NEEDS_SET_INSTREAM} -+ {$define GDB_NOTIFY_BREAKPOINT_ARG_IS_BREAKPOINT_PTR} -+ {$define GDB_USES_BP_OPS} -+ {$define GDB_BP_LOCATION_HAS_OPS} -+ {$define GDB_UI_FILE_HAS_WRITE_ASYNC} -+ {$endif GDB_CVS} -+{$endif def GDB_V703} - - { 7.2.x } - {$ifdef GDB_V702} -@@ -448,8 +493,11 @@ - {$LINKLIB libintl.a} - {$LINKLIB imagehlp} - {$endif not USE_MINGW_GDB} -- {$LINKLIB kernel32} -+ {$ifdef GDB_USES_LIBADVAPI32} -+ {$LINKLIB advapi32} -+ {$endif GDB_USES_LIBADVAPI32} - {$LINKLIB user32} -+ {$LINKLIB kernel32} - {$endif win32} - - {$ifdef win64} -@@ -588,9 +636,11 @@ - type - - pui_file = ^ui_file; -+ pstdio_file = ^stdio_file; - - ui_file_flush_ftype = procedure(stream : pui_file);cdecl; - ui_file_write_ftype = procedure(stream : pui_file;buf : pchar;len : longint);cdecl; -+ ui_file_write_async_save_ftype = procedure(stream : pui_file;buf : pchar;len : longint);cdecl; - ui_file_fputs_ftype = procedure(buf : pchar; stream : pui_file);cdecl; - ui_file_delete_ftype = procedure(stream : pui_file);cdecl; - ui_file_isatty_ftype = function(stream : pui_file) : longbool;cdecl; -@@ -605,6 +655,9 @@ - magic : plongint; - to_flush : ui_file_flush_ftype; - to_write : ui_file_write_ftype; -+ {$ifdef GDB_UI_FILE_HAS_WRITE_ASYNC} -+ to_write_async_safe : ui_file_write_async_save_ftype; -+ {$endif} - to_fputs : ui_file_fputs_ftype; - {$ifdef GDB_V6} - to_read : ui_file_read_ftype; -@@ -616,6 +669,13 @@ - to_data : pointer; - end; - -+ stdio_file = record -+ magic : plongint; -+ _file : P_C_FILE; -+ df : longint; -+ close_p : longint; -+ end; -+ - { used to delete stdio_ui_file gdb_stdout and gdb_stderr } - procedure ui_file_delete(stream : pui_file);cdecl;external; - -@@ -774,10 +834,16 @@ - {$ifdef GDB_V6} - type - ui_out = pointer; -+{$ifndef GDB_NO_UIOUT} - var - uiout : ui_out;cvar;external; -+{$else GDB_NO_UIOUT} -+var -+ cli_uiout : ui_out;cvar;external; -+ current_uiout : ui_out;cvar;external; -+{$endif GDB_NO_UIOUT} - function cli_out_new (stream : pui_file):ui_out;cdecl;external; --{$endif} -+{$endif GDB_V6} - - {$ifdef go32v2} - { needed to be sure %fs contains the DOS memory selector -@@ -815,8 +881,11 @@ - jmp_buf = dpmi_jmp_buf; - pjmp_buf = pdpmi_jmp_buf; - -+ - function setjmp(var rec : jmp_buf) : longint;cdecl;external; - -+ function malloc(size : longint) : pointer;cdecl;external; -+ - procedure longjmp(var rec : jmp_buf;return_value : longint);cdecl;external; - - procedure reload_fs;assembler; -@@ -869,6 +938,13 @@ - pCORE_ADDR = ^CORE_ADDR; - pblock = ^block; - -+ tframe_id = record -+ stack_addr, code_addr, special_addr : CORE_ADDR; -+ addr_p_flags : byte;{ for three 1 bit flags -+ stack_addr_p, code_addr_p, special_addr_p : cint : 1; } -+ inline_depth : longint; -+ end; -+ - tlanguage = (language_unknown,language_auto,language_c, - language_cplus,language_java,language_chill, - language_fortran,language_m2,language_asm, -@@ -897,9 +973,18 @@ - - target_hw_bp_type = (hw_write, hw_read, hw_access, hw_execute); - -+ { pointer to structures that we don't need } -+ pbp_ops = pointer; -+ pbp_location_ops = pointer; -+ pprogram_space = pointer; -+ pgdbarch = pointer; -+ - {$PACKRECORDS 4} - pbreakpoint = ^breakpoint; - breakpoint = record -+{$ifdef GDB_USES_BP_OPS} -+ ops : pbp_ops; -+{$endif GDB_USES_BP_OPS} - next : pbreakpoint; - typ : bptype; - enable : tenable; -@@ -910,9 +995,15 @@ - {$else not GDB_USES_BP_LOCATION} - address : CORE_ADDR; - {$endif not GDB_USES_BP_LOCATION} -+{$ifndef GDB_USES_BP_OPS} - line_number : longint; - source_file : pchar; -+{$endif not GDB_USES_BP_OPS} - silent : byte; -+{$ifdef GDB_USES_BP_OPS} -+ display_canonical: byte; -+{$endif GDB_USES_BP_OPS} -+ - ignore_count : longint; - {$ifndef GDB_USES_BP_LOCATION} - shadow_contents : array[0..15] of char; -@@ -919,10 +1010,21 @@ - inserted : char; - duplicate : char; - {$endif not GDB_USES_BP_LOCATION} -+ - commands : pointer; {^command_line} -+{$ifdef GDB_USES_BP_OPS} -+ frame_id : tframe_id; -+ pspace : pprogram_space; -+{$else not GDB_USES_BP_OPS} - frame : CORE_ADDR; - cond : pointer; {^expression} -- addr_string : ^char; -+{$endif GDB_USES_BP_OPS} -+ addr_string : pchar; -+{$ifdef GDB_USES_BP_OPS} -+ filter : pchar; -+ addr_string_range_end : pchar; -+ gdbarch : pgdbarch; -+{$endif GDB_USES_BP_OPS} - language : tlanguage; - input_radix : longint; - cond_string : ^char; -@@ -941,6 +1043,9 @@ - bp_target_info = record - placed_address_space : pointer;{paddress_space;} - placed_address : CORE_ADDR; -+{$ifdef GDB_BP_TI_HAS_LENGTH} -+ length : longint; -+{$endif GDB_BP_TI_HAS_LENGTH} - shadow_contents : array[0..15] of char; - shadow_len : longint; - placed_size : longint; -@@ -948,9 +1053,17 @@ - - bp_location = record - next : pbp_location; -+{$ifdef GDB_BP_LOCATION_HAS_OPS} -+ ops : pbp_location_ops; -+{$endif GDB_BP_LOCATION_HAS_OPS} -+ -+{$ifdef GDB_BP_LOCATION_HAS_REFCOUNT} -+ refc : longint; -+{$else} - {$ifdef GDB_BP_LOCATION_HAS_GLOBAL_NEXT} - global_next : pbp_location; - {$endif GDB_BP_LOCATION_HAS_GLOBAL_NEXT} -+{$endif} - loc_type : bp_loc_type; - owner : pbreakpoint; - {$ifdef GDB_BP_LOCATION_HAS_GLOBAL_NEXT} -@@ -961,10 +1074,10 @@ - inserted : byte; - duplicate : byte; - {$ifdef GDB_BP_LOCATION_HAS_GDBARCH} -- gdbarch : pointer;{pgdbarch;} -+ gdbarch : pgdbarch; - {$endif GDB_BP_LOCATION_HAS_GDBARCH} - {$ifdef GDB_HAS_PROGRAM_SPACE} -- pspace : pointer;{pprogram_space;} -+ pspace : pprogram_space; - {$endif GDB_HAS_PROGRAM_SPACE} - address : CORE_ADDR; - {$ifdef GDB_BP_LOCATION_HAS_GLOBAL_NEXT} -@@ -979,6 +1092,11 @@ - target_info : bp_target_info; - overlay_target_info : bp_target_info; - events_till_retirement : longint; -+{$ifdef GDB_USES_BP_OPS} -+ { line and source file are in location } -+ line_number : longint; -+ source_file : pchar; -+{$endif not GDB_USES_BP_OPS} - end; - - tfreecode=(free_nothing,free_contents,free_linetable); -@@ -1488,7 +1606,9 @@ - {$endif ndef GDB_HAS_OBSERVER_NOTIFY_BREAKPOINT_CREATED} - current_target : target_ops;cvar;external; - stop_pc : CORE_ADDR;cvar;external; -- { Only used from GDB 5.01 but doesn't hurst otherwise } -+ { Only used from GDB 5.0 but doesn't hurst otherwise } -+ { This global variable is declared in defs.h as external -+ and instanciated in main.c since version 5.0. } - interpreter_p : pchar;cvar;public; - - { we need also to declare some vars } -@@ -1502,13 +1622,22 @@ - - { Whether xdb commands will be handled } - {$ifdef GDB_HAS_DB_COMMANDS} -+ { These two global variables are declared in defs.h -+ since version 4.18 } - xdb_commands : longint;cvar;public; - - { Whether dbx commands will be handled } - dbx_commands : longint;cvar;public; - {$endif GDB_HAS_DB_COMMANDS} - -+{$ifdef GDB_NEEDS_SET_INSTREAM} - var -+ instream : P_C_FILE;cvar;external; -+ function gdb_fopen (filename : pchar; mode : pchar) : pui_file;cdecl;external; -+{$endif GDB_NEEDS_SET_INSTREAM} -+var -+ { 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; - gdb_stdlog : pui_file;cvar;public; -@@ -1516,6 +1645,9 @@ - event_loop_p : longint;cvar;public; - {$ifdef GDB_V6} - (* target IO streams *) -+ { The three following variables are declared in defs.h -+ and instanciated in main.c since version 6.0 } -+ gdb_stdin : pui_file;cvar;public; - gdb_stdtargin : pui_file;cvar;public; - gdb_stdtargerr : pui_file;cvar;public; - {$endif} -@@ -1523,7 +1655,10 @@ - { used for gdb_stdout and gdb_stderr } - function xmalloc(size : longint) : pointer;cdecl;external; - { used for QueryHook } --function xstrvprintf(msg : pchar) : pchar; varargs; cdecl; external; -+{ xvasprintf is present at least from GDB 5.3 -+ while xstrvprintf only appears in version 6.2, -+ so only use xvasprintf function } -+function xvasprintf(ret : ppchar; msg : pchar) : pchar; varargs; cdecl; external; - 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; -@@ -2406,11 +2541,15 @@ - QueryHook:=0 - else - begin -- if curr_gdb^.reset_command and (pos('Kill',question)>0) then -+ if curr_gdb^.reset_command and ((pos('Kill',question)>0) or -+ (pos('Discard symbol table',question)>0)) then - QueryHook:=1 - else if pos('%',question)>0 then - begin -- local:=xstrvprintf(question,arg); -+ xvasprintf(@local,question,arg); -+ { xvasprintf can failed, in that case local is set to nil } -+ if not assigned(local) then -+ local:=question; - QueryHook:=curr_gdb^.Query(local, nil); - xfree(local); - end -@@ -2451,7 +2590,12 @@ - last_breakpoint_number:=b.number; - { function breakpoints have zero as file and as line !! - but they are valid !! } -+{$ifndef GDB_USES_BP_OPS} - invalid_breakpoint_line:=(b.line_number<>sym.line) and (b.line_number<>0); -+{$else GDB_USES_BP_OPS} -+ invalid_breakpoint_line:=(b.loc=nil) or -+ ((b.loc^.line_number<>sym.line) and (b.loc^.line_number<>0)); -+{$endif GDB_USES_BP_OPS} - {$ifdef GDB_USES_BP_LOCATION} - if assigned (b.loc) then - last_breakpoint_address:=b.loc^.address -@@ -2471,7 +2615,11 @@ - {$ifdef GDB_HAS_OBSERVER_NOTIFY_BREAKPOINT_CREATED} - - type -+{$ifdef GDB_NOTIFY_BREAKPOINT_ARG_IS_BREAKPOINT_PTR} -+ breakpoint_created_function_type = procedure (bpp : pbreakpoint); cdecl; -+{$else not GDB_NOTIFY_BREAKPOINT_ARG_IS_BREAKPOINT_PTR} - breakpoint_created_function_type = procedure (bpnum : longint); cdecl; -+{$endif not GDB_NOTIFY_BREAKPOINT_ARG_IS_BREAKPOINT_PTR} - pobserver = pointer; - var - breakpoint_created_observer : pobserver = nil; -@@ -2479,8 +2627,14 @@ - function observer_attach_breakpoint_created(create_func : breakpoint_created_function_type) : pobserver;cdecl;external; - procedure observer_detach_breakpoint_created(pob : pobserver);cdecl;external; - --var breakpoint_chain : pbreakpoint ;cvar;external; - -+{$ifdef GDB_NOTIFY_BREAKPOINT_ARG_IS_BREAKPOINT_PTR} -+procedure notify_breakpoint_created(bpp : pbreakpoint); cdecl; -+begin -+ CreateBreakpointHook(bpp^); -+end; -+{$else not GDB_NOTIFY_BREAKPOINT_ARG_IS_BREAKPOINT_PTR} -+var breakpoint_chain : pbreakpoint ;cvar;external; - - procedure notify_breakpoint_created(bpnum : longint);cdecl; - var -@@ -2498,8 +2652,16 @@ - pb:=pb^.next; - end; - end; -+{$endif not GDB_NOTIFY_BREAKPOINT_ARG_IS_BREAKPOINT_PTR} - {$endif def GDB_HAS_OBSERVER_NOTIFY_BREAKPOINT_CREATED} - -+{ Avoid loading of main.o object by providing a -+ stripped down version of relocate_gdb_directory function } -+function relocate_gdb_directory(path : pchar) : pchar; cdecl; public; -+begin -+ relocate_gdb_directory:=path; -+end; -+ - {***************************************************************************** - tgdbinterface - *****************************************************************************} -@@ -2528,7 +2690,7 @@ - gdb_command('set print object on'); - gdb_command('set print null-stop'); - {$ifdef USE_MINGW_GDB} // maybe this also should be done for newer cygwin gdbs. -- gdb_command('set confirm off'); -+ //gdb_command('set confirm off'); - {$endif} - end; - -@@ -2609,9 +2771,9 @@ - var - top_level_val : longint; - --function catch_errors(func : pointer; command : pchar; from_tty,mask : longint) : longint;cdecl;external; -+function catch_command_errors(func : pointer; command : pchar; from_tty,mask : longint) : longint;cdecl;external; - --function gdbint_execute_command(command : pchar; from_tty,mask : longint) : longint;cdecl; -+function gdbint_execute_command(command : pchar; from_tty : longint) : longint;cdecl; - begin - gdbint_execute_command:=1; - execute_command(command,from_tty); -@@ -2658,6 +2820,8 @@ - begin - {$ifdef cpui386} - MaskAllFPUExceptions := control or MaskAllExceptions; -+{$else} -+ MaskAllFPUExceptions:=0; - {$endif} - end; - -@@ -2716,7 +2880,8 @@ - begin - quit_return:=error_return; - mask:=longint($ffffffff); -- catch_errors(@gdbint_execute_command,@command,0,mask); -+ catch_command_errors(@gdbint_execute_command,@command, -+ 1,mask); - {$ifdef go32v2} - reload_fs; - {$endif go32v2} -@@ -2973,11 +3138,43 @@ - c_environ : ppchar;external name '_environ'; - c_argc : longint;external name '___crt0_argc'; - c_argv : ppchar;external name '___crt0_argv'; -+ -+ procedure ReallocateEnvironUsingCMalloc; -+ -+ var -+ neededsize , count : longint; -+ penv : pchar; -+ newenv : ppchar; -+ begin -+ if not assigned(c_environ) then -+ neededsize:=0 -+ else -+ begin -+ count:=0; -+ penv:=c_environ^; -+ while assigned(penv) do -+ begin -+ inc(count); -+ inc(penv,sizeof(pchar)); -+ end; -+ neededsize:=count*sizeof(pchar); -+ end; -+ newenv:=malloc(neededsize); -+ system.move(c_environ,newenv,neededsize); -+ c_environ:=newenv; -+ end; -+ - {$endif def go32v2} - var - current_directory : pchar; cvar; external; - gdb_dirbuf : array[0..0] of char; cvar; external; - CurrentDir : AnsiString; -+{$ifdef GDB_NEEDS_INTERPRETER_SETUP} -+ type -+ interpreter_struct_p = pointer; { to opaque type } -+ function interp_lookup (name : pchar) : interpreter_struct_p;cdecl; external; -+ function interp_set (interp : interpreter_struct_p) : longbool;cdecl; external; -+{$endif GDB_NEEDS_INTERPRETER_SETUP} - const - DIRBUF_SIZE = 1024; - -@@ -2986,13 +3183,28 @@ - var - OldSigInt : SignalHandler; - {$endif supportexceptions} -+{$ifdef GDB_NEEDS_SET_INSTREAM} -+var -+ dummy_file : pui_file; -+{$endif GDB_NEEDS_SET_INSTREAM} -+ - {$ifdef GDB_INIT_HAS_ARGV0} - var - argv0 : pchar; - {$endif not GDB_INIT_HAS_ARGV0} -+{$ifdef GDB_NEEDS_INTERPRETER_SETUP} -+var -+ interp : interpreter_struct_p; -+{$endif GDB_NEEDS_INTERPRETER_SETUP} -+var -+ save_gdb_stdin, -+ save_gdb_stdout, -+ save_gdb_stderr : pui_file; - begin - {$ifdef go32v2} -- c_environ:=system.envp; -+ { c_environ:=system.envp; } -+ { DJGPP libC presupposes the c_enivron was malloc'ated } -+ ReallocateEnvironUsingCMalloc; - c_argc:=system.argc; - c_argv:=system.argv; - {$endif def go32v2} -@@ -3012,8 +3224,25 @@ - ui_file_delete(gdb_stderr); - if assigned(gdb_stdout) then - ui_file_delete(gdb_stdout); -+{$ifdef GDB_NEEDS_SET_INSTREAM} -+ if assigned(gdb_stdin) then -+ ui_file_delete(gdb_stdin); -+ gdb_stdin:=mem_fileopen; -+ save_gdb_stdin:=gdb_stdin; -+ dummy_file :=gdb_fopen('dummy.$$$','a'); -+ {in captured_main code, this is simply -+ instream:=stdin; but stdin is a highly system dependent macro -+ so that we try to avoid it here } -+ if assigned(dummy_file) then -+ instream:=pstdio_file(dummy_file^.to_data)^._file -+ else -+ instream:=nil; -+{$endif GDB_NEEDS_SET_INSTREAM} -+ - gdb_stderr:=mem_fileopen; - gdb_stdout:=mem_fileopen; -+ save_gdb_stderr:=gdb_stderr; -+ save_gdb_stdout:=gdb_stdout; - gdb_stdlog:=gdb_stderr; - gdb_stdtarg:=gdb_stderr; - set_ui_file_write(gdb_stdout,@gdbint_ui_file_write); -@@ -3022,7 +3251,9 @@ - error_init; - {$endif GDB_NEEDS_NO_ERROR_INIT} - {$ifdef GDB_V6} --// gdb_stdtargin := gdb_stdin; -+{$ifdef GDB_NEEDS_SET_INSTREAM} -+ gdb_stdtargin := gdb_stdin; -+{$endif GDB_NEEDS_SET_INSTREAM} - gdb_stdtargerr := gdb_stderr; - {$endif} - GetDir(0, CurrentDir); -@@ -3034,8 +3265,10 @@ - next_exit:=exitproc; - exitproc:=@DoneLibGDB; - {$ifdef GDB_V6} -+{$ifndef GDB_NO_UIOUT} - uiout := cli_out_new (gdb_stdout); --{$endif} -+{$endif not GDB_NO_UIOUT} -+{$endif GDB_V6} - {$ifdef GDB_INIT_HAS_ARGV0} - getmem(argv0,length(paramstr(0))+1); - strpcopy(argv0,paramstr(0)); -@@ -3044,6 +3277,31 @@ - {$else not GDB_INIT_HAS_ARGV0} - gdb_init; - {$endif not GDB_INIT_HAS_ARGV0} -+{$ifdef GDB_NEEDS_INTERPRETER_SETUP} -+ { interpreter can only be set after all files are -+ initialized, which is done in gdb_init function. } -+ interp := interp_lookup ('console'); -+ interp_set (interp); -+ -+ { We need to re-set gdb_stdXX ui_files } -+ if assigned(gdb_stderr) then -+ ui_file_delete(gdb_stderr); -+ if assigned(gdb_stdout) then -+ ui_file_delete(gdb_stdout); -+ if assigned(gdb_stdin) then -+ ui_file_delete(gdb_stdin); -+ gdb_stdin:=save_gdb_stdin; -+ gdb_stderr:=save_gdb_stderr; -+ gdb_stdout:=save_gdb_stdout; -+ gdb_stdlog:=gdb_stderr; -+ gdb_stdtarg:=gdb_stderr; -+ set_ui_file_write(gdb_stdout,@gdbint_ui_file_write); -+ set_ui_file_write(gdb_stderr,@gdbint_ui_file_write); -+{$ifdef GDB_NO_UIOUT} -+ cli_uiout := cli_out_new (gdb_stdout); -+ current_uiout:=cli_uiout; -+{$endif GDB_NO_UIOUT} -+{$endif GDB_NEEDS_INTERPRETER_SETUP} - {$ifdef supportexceptions} - {$ifdef unix} - fpsignal(SIGINT,OldSigInt); -@@ -3069,14 +3327,34 @@ - end; - - {$ifdef GDB_HAS_SYSROOT} --var gdb_sysroot : pchar; cvar;public; -+ { Here we declare as cvar;public; a bunch of global -+ variables that are defined in main.c source. -+ We must not load main.o otherwise, we will get -+ into multiply defined symbols troubles. } -+var -+ gdb_sysrootc : char; -+ { used locally only to provide a pchar pointing to '\0' } -+ 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; -+ { gdb_datadir global variable is declared in defs.h and -+ instanciated in main.c since version 7.0 } - python_libdir : pchar;cvar;public; -- gdb_sysrootc : char; -+ { python_libdir global variable is declared in defs.h and instanciated -+ in main.c since version 7.2 } - return_child_result : longbool;cvar;public; -+ { return_chlid_result global variable is declared in main.h and -+ instanciated in main.c since version 6.4 } - return_child_result_value : longint;cvar;public; -+ { return_child_result_value global variable is declared in main.h and -+ instanciated in main.c since version 6.4 with a startup value of -1 } - batch_silent : longbool;cvar;public; -+ { batch_silent global variable is declared in main.h since 7.0, but -+ instanciated in main.c since version 6.4 } - batch_flag : longbool;cvar;public; -+ { batch_flag global variable is declared in main.h and -+ instanciated in main.c since version 7.2 } - {$endif} - {$ifdef GDB_HAS_DEBUG_FILE_DIRECTORY} - var -@@ -3086,6 +3364,7 @@ - begin - {$ifdef GDB_HAS_SYSROOT} - gdb_sysrootc := #0; -+ return_child_result_value := -1; - gdb_sysroot := @gdb_sysrootc; - gdb_datadir := @gdb_sysrootc; - python_libdir := @gdb_sysrootc; Copied: fpc/repos/community-x86_64/fpc-gdb.patch (from rev 212569, fpc/trunk/fpc-gdb.patch) =================================================================== --- community-x86_64/fpc-gdb.patch (rev 0) +++ community-x86_64/fpc-gdb.patch 2017-02-16 12:01:36 UTC (rev 212570) @@ -0,0 +1,737 @@ +diff -wbBur fpcbuild-2.6.0/fpcsrc/ide/fp.pas fpcbuild-2.6.0.my/fpcsrc/ide/fp.pas +--- fpcbuild-2.6.0/fpcsrc/ide/fp.pas 2010-08-20 15:04:44.000000000 +0400 ++++ fpcbuild-2.6.0.my/fpcsrc/ide/fp.pas 2013-01-14 20:55:58.472376421 +0400 +@@ -14,6 +14,9 @@ + **********************************************************************} + program FP; + ++{$LINKLIB libz.so} ++ ++ + {$ifdef Windows} + { some windows versions, namely at least XP x64 don't like if the IDE stack + is too big } +diff -wbBur fpcbuild-2.6.0/fpcsrc/packages/gdbint/Makefile fpcbuild-2.6.0.my/fpcsrc/packages/gdbint/Makefile +--- fpcbuild-2.6.0/fpcsrc/packages/gdbint/Makefile 2011-12-11 00:19:00.000000000 +0400 ++++ fpcbuild-2.6.0.my/fpcsrc/packages/gdbint/Makefile 2013-01-14 20:32:15.545303270 +0400 +@@ -2337,10 +2337,12 @@ + endif + ifeq ($(OS_SOURCE),openbsd) + override FPCOPT+=-FD$(NEW_BINUTILS_PATH) ++override FPCMAKEOPT+=-FD$(NEW_BINUTILS_PATH) + endif + ifndef CROSSBOOTSTRAP + ifneq ($(BINUTILSPREFIX),) + override FPCOPT+=-XP$(BINUTILSPREFIX) ++override FPCMAKEOPT+=-XP$(BINUTILSPREFIX) + endif + ifneq ($(BINUTILSPREFIX),) + override FPCOPT+=-Xr$(RLINKPATH) +diff -wbBur fpcbuild-2.6.0/fpcsrc/packages/gdbint/src/gdbint.pp fpcbuild-2.6.0.my/fpcsrc/packages/gdbint/src/gdbint.pp +--- fpcbuild-2.6.0/fpcsrc/packages/gdbint/src/gdbint.pp 2011-12-10 20:50:23.000000000 +0400 ++++ fpcbuild-2.6.0.my/fpcsrc/packages/gdbint/src/gdbint.pp 2013-01-14 20:53:27.332331458 +0400 +@@ -17,6 +17,7 @@ + + {$define NotImplemented} + ++{$define GDB_DISABLE_PYTHON} + {$define COMPILING_GDBINT_UNIT} + {$ifdef USE_GDBLIBINC} + {$i gdblib.inc} +@@ -50,7 +51,6 @@ + {$ifdef GDB_V601} + {$info using gdb 6.1.x} + {$define GDB_V6} +- {$define GDB_HAS_DB_COMMANDS} + {$undef GDB_HAS_DEPRECATED_CBPH} + {$endif def GDB_V601} + +@@ -58,14 +58,12 @@ + {$ifdef GDB_V602} + {$info using gdb 6.2.x} + {$define GDB_V6} +- {$define GDB_HAS_DB_COMMANDS} + {$endif def GDB_V602} + + { 6.3.x } + {$ifdef GDB_V603} + {$info using gdb 6.3.x} + {$define GDB_V6} +- {$define GDB_HAS_DB_COMMANDS} + {$endif def GDB_V603} + + { 6.4.x } +@@ -73,7 +71,6 @@ + {$info using gdb 6.4.x} + {$define GDB_V6} + {$define GDB_NEEDS_NO_ERROR_INIT} +- {$define GDB_HAS_DB_COMMANDS} + {$endif def GDB_V604} + + { 6.5.x } +@@ -87,7 +84,6 @@ + {$ifdef GDB_V606} + {$info using gdb 6.6.x} + {$define GDB_V6} +- {$define GDB_HAS_DB_COMMANDS} + {$define GDB_USES_BP_LOCATION} + {$define GDB_NEEDS_NO_ERROR_INIT} + {$define GDB_USES_EXPAT_LIB} +@@ -98,7 +94,6 @@ + {$ifdef GDB_V607} + {$info using gdb 6.7.x} + {$define GDB_V6} +- {$define GDB_HAS_DB_COMMANDS} + {$define GDB_USES_BP_LOCATION} + {$define GDB_NEEDS_NO_ERROR_INIT} + {$define GDB_USES_EXPAT_LIB} +@@ -109,7 +104,6 @@ + {$ifdef GDB_V608} + {$info using gdb 6.8.x} + {$define GDB_V6} +- {$define GDB_HAS_DB_COMMANDS} + {$define GDB_USES_BP_LOCATION} + {$define GDB_BP_LOCATION_HAS_GLOBAL_NEXT} + {$define GDB_NEEDS_NO_ERROR_INIT} +@@ -120,13 +114,64 @@ + {$define GDB_HAS_BP_NONE} + {$endif def GDB_V608} + ++{ 7.5.x } ++{$ifdef GDB_V705} ++ {$info using gdb 7.5.x} ++ {$define GDB_V7} ++ {$define GDB_BP_LOCATION_HAS_GDBARCH} ++ {$define GDB_HAS_PROGRAM_SPACE} ++ {$define GDB_NO_UIOUT} ++ {$define GDB_NEEDS_INTERPRETER_SETUP} ++ {$define GDB_NEEDS_SET_INSTREAM} ++ {$define GDB_NOTIFY_BREAKPOINT_ARG_IS_BREAKPOINT_PTR} ++ {$define GDB_USES_BP_OPS} ++ {$define GDB_BP_TI_HAS_LENGTH} ++ {$define GDB_BP_LOCATION_HAS_REFCOUNT} ++ {$define GDB_BP_LOCATION_HAS_OPS} ++ {$define GDB_UI_FILE_HAS_WRITE_ASYNC} ++ {$ifdef win32} ++ {$define GDB_USES_LIBADVAPI32} ++ {$endif win32} ++{$endif def GDB_V705} ++ ++{ 7.4.x } ++{$ifdef GDB_V704} ++ {$info using gdb 7.4.x} ++ {$define GDB_V7} ++ {$define GDB_BP_LOCATION_HAS_GDBARCH} ++ {$define GDB_HAS_PROGRAM_SPACE} ++ {$define GDB_NO_UIOUT} ++ {$define GDB_NEEDS_INTERPRETER_SETUP} ++ {$define GDB_NEEDS_SET_INSTREAM} ++ {$define GDB_NOTIFY_BREAKPOINT_ARG_IS_BREAKPOINT_PTR} ++ {$define GDB_USES_BP_OPS} ++ {$define GDB_BP_TI_HAS_LENGTH} ++ {$define GDB_BP_LOCATION_HAS_REFCOUNT} ++ {$define GDB_BP_LOCATION_HAS_OPS} ++ {$define GDB_UI_FILE_HAS_WRITE_ASYNC} ++ {$ifdef win32} ++ {$define GDB_USES_LIBADVAPI32} ++ {$endif win32} ++{$endif def GDB_V704} ++ + { 7.3.x } + {$ifdef GDB_V703} + {$info using gdb 7.3.x} + {$define GDB_V7} + {$define GDB_BP_LOCATION_HAS_GDBARCH} + {$define GDB_HAS_PROGRAM_SPACE} +-{$endif def GDB_V702} ++ {$define GDB_BP_TI_HAS_LENGTH} ++ {$define GDB_BP_LOCATION_HAS_REFCOUNT} ++ {$ifdef GDB_CVS} ++ {$define GDB_NO_UIOUT} ++ {$define GDB_NEEDS_INTERPRETER_SETUP} ++ {$define GDB_NEEDS_SET_INSTREAM} ++ {$define GDB_NOTIFY_BREAKPOINT_ARG_IS_BREAKPOINT_PTR} ++ {$define GDB_USES_BP_OPS} ++ {$define GDB_BP_LOCATION_HAS_OPS} ++ {$define GDB_UI_FILE_HAS_WRITE_ASYNC} ++ {$endif GDB_CVS} ++{$endif def GDB_V703} + + { 7.2.x } + {$ifdef GDB_V702} +@@ -448,8 +493,11 @@ + {$LINKLIB libintl.a} + {$LINKLIB imagehlp} + {$endif not USE_MINGW_GDB} +- {$LINKLIB kernel32} ++ {$ifdef GDB_USES_LIBADVAPI32} ++ {$LINKLIB advapi32} ++ {$endif GDB_USES_LIBADVAPI32} + {$LINKLIB user32} ++ {$LINKLIB kernel32} + {$endif win32} + + {$ifdef win64} +@@ -588,9 +636,11 @@ + type + + pui_file = ^ui_file; ++ pstdio_file = ^stdio_file; + + ui_file_flush_ftype = procedure(stream : pui_file);cdecl; + ui_file_write_ftype = procedure(stream : pui_file;buf : pchar;len : longint);cdecl; ++ ui_file_write_async_save_ftype = procedure(stream : pui_file;buf : pchar;len : longint);cdecl; + ui_file_fputs_ftype = procedure(buf : pchar; stream : pui_file);cdecl; + ui_file_delete_ftype = procedure(stream : pui_file);cdecl; + ui_file_isatty_ftype = function(stream : pui_file) : longbool;cdecl; +@@ -605,6 +655,9 @@ + magic : plongint; + to_flush : ui_file_flush_ftype; + to_write : ui_file_write_ftype; ++ {$ifdef GDB_UI_FILE_HAS_WRITE_ASYNC} ++ to_write_async_safe : ui_file_write_async_save_ftype; ++ {$endif} + to_fputs : ui_file_fputs_ftype; + {$ifdef GDB_V6} + to_read : ui_file_read_ftype; +@@ -616,6 +669,13 @@ + to_data : pointer; + end; + ++ stdio_file = record ++ magic : plongint; ++ _file : P_C_FILE; ++ df : longint; ++ close_p : longint; ++ end; ++ + { used to delete stdio_ui_file gdb_stdout and gdb_stderr } + procedure ui_file_delete(stream : pui_file);cdecl;external; + +@@ -774,10 +834,16 @@ + {$ifdef GDB_V6} + type + ui_out = pointer; ++{$ifndef GDB_NO_UIOUT} + var + uiout : ui_out;cvar;external; ++{$else GDB_NO_UIOUT} ++var ++ cli_uiout : ui_out;cvar;external; ++ current_uiout : ui_out;cvar;external; ++{$endif GDB_NO_UIOUT} + function cli_out_new (stream : pui_file):ui_out;cdecl;external; +-{$endif} ++{$endif GDB_V6} + + {$ifdef go32v2} + { needed to be sure %fs contains the DOS memory selector +@@ -815,8 +881,11 @@ + jmp_buf = dpmi_jmp_buf; + pjmp_buf = pdpmi_jmp_buf; + ++ + function setjmp(var rec : jmp_buf) : longint;cdecl;external; + ++ function malloc(size : longint) : pointer;cdecl;external; ++ + procedure longjmp(var rec : jmp_buf;return_value : longint);cdecl;external; + + procedure reload_fs;assembler; +@@ -869,6 +938,13 @@ + pCORE_ADDR = ^CORE_ADDR; + pblock = ^block; + ++ tframe_id = record ++ stack_addr, code_addr, special_addr : CORE_ADDR; ++ addr_p_flags : byte;{ for three 1 bit flags ++ stack_addr_p, code_addr_p, special_addr_p : cint : 1; } ++ inline_depth : longint; ++ end; ++ + tlanguage = (language_unknown,language_auto,language_c, + language_cplus,language_java,language_chill, + language_fortran,language_m2,language_asm, +@@ -897,9 +973,18 @@ + + target_hw_bp_type = (hw_write, hw_read, hw_access, hw_execute); + ++ { pointer to structures that we don't need } ++ pbp_ops = pointer; ++ pbp_location_ops = pointer; ++ pprogram_space = pointer; ++ pgdbarch = pointer; ++ + {$PACKRECORDS 4} + pbreakpoint = ^breakpoint; + breakpoint = record ++{$ifdef GDB_USES_BP_OPS} ++ ops : pbp_ops; ++{$endif GDB_USES_BP_OPS} + next : pbreakpoint; + typ : bptype; + enable : tenable; +@@ -910,9 +995,15 @@ + {$else not GDB_USES_BP_LOCATION} + address : CORE_ADDR; + {$endif not GDB_USES_BP_LOCATION} ++{$ifndef GDB_USES_BP_OPS} + line_number : longint; + source_file : pchar; ++{$endif not GDB_USES_BP_OPS} + silent : byte; ++{$ifdef GDB_USES_BP_OPS} ++ display_canonical: byte; ++{$endif GDB_USES_BP_OPS} ++ + ignore_count : longint; + {$ifndef GDB_USES_BP_LOCATION} + shadow_contents : array[0..15] of char; +@@ -919,10 +1010,21 @@ + inserted : char; + duplicate : char; + {$endif not GDB_USES_BP_LOCATION} ++ + commands : pointer; {^command_line} ++{$ifdef GDB_USES_BP_OPS} ++ frame_id : tframe_id; ++ pspace : pprogram_space; ++{$else not GDB_USES_BP_OPS} + frame : CORE_ADDR; + cond : pointer; {^expression} +- addr_string : ^char; ++{$endif GDB_USES_BP_OPS} ++ addr_string : pchar; ++{$ifdef GDB_USES_BP_OPS} ++ filter : pchar; ++ addr_string_range_end : pchar; ++ gdbarch : pgdbarch; ++{$endif GDB_USES_BP_OPS} + language : tlanguage; + input_radix : longint; + cond_string : ^char; +@@ -941,6 +1043,9 @@ + bp_target_info = record + placed_address_space : pointer;{paddress_space;} + placed_address : CORE_ADDR; ++{$ifdef GDB_BP_TI_HAS_LENGTH} ++ length : longint; ++{$endif GDB_BP_TI_HAS_LENGTH} + shadow_contents : array[0..15] of char; + shadow_len : longint; + placed_size : longint; +@@ -948,9 +1053,17 @@ + + bp_location = record + next : pbp_location; ++{$ifdef GDB_BP_LOCATION_HAS_OPS} ++ ops : pbp_location_ops; ++{$endif GDB_BP_LOCATION_HAS_OPS} ++ ++{$ifdef GDB_BP_LOCATION_HAS_REFCOUNT} ++ refc : longint; ++{$else} + {$ifdef GDB_BP_LOCATION_HAS_GLOBAL_NEXT} + global_next : pbp_location; + {$endif GDB_BP_LOCATION_HAS_GLOBAL_NEXT} ++{$endif} + loc_type : bp_loc_type; + owner : pbreakpoint; + {$ifdef GDB_BP_LOCATION_HAS_GLOBAL_NEXT} +@@ -961,10 +1074,10 @@ + inserted : byte; + duplicate : byte; + {$ifdef GDB_BP_LOCATION_HAS_GDBARCH} +- gdbarch : pointer;{pgdbarch;} ++ gdbarch : pgdbarch; + {$endif GDB_BP_LOCATION_HAS_GDBARCH} + {$ifdef GDB_HAS_PROGRAM_SPACE} +- pspace : pointer;{pprogram_space;} ++ pspace : pprogram_space; + {$endif GDB_HAS_PROGRAM_SPACE} + address : CORE_ADDR; + {$ifdef GDB_BP_LOCATION_HAS_GLOBAL_NEXT} +@@ -979,6 +1092,11 @@ + target_info : bp_target_info; + overlay_target_info : bp_target_info; + events_till_retirement : longint; ++{$ifdef GDB_USES_BP_OPS} ++ { line and source file are in location } ++ line_number : longint; ++ source_file : pchar; ++{$endif not GDB_USES_BP_OPS} + end; + + tfreecode=(free_nothing,free_contents,free_linetable); +@@ -1488,7 +1606,9 @@ + {$endif ndef GDB_HAS_OBSERVER_NOTIFY_BREAKPOINT_CREATED} + current_target : target_ops;cvar;external; + stop_pc : CORE_ADDR;cvar;external; +- { Only used from GDB 5.01 but doesn't hurst otherwise } ++ { Only used from GDB 5.0 but doesn't hurst otherwise } ++ { This global variable is declared in defs.h as external ++ and instanciated in main.c since version 5.0. } + interpreter_p : pchar;cvar;public; + + { we need also to declare some vars } +@@ -1502,13 +1622,22 @@ + + { Whether xdb commands will be handled } + {$ifdef GDB_HAS_DB_COMMANDS} ++ { These two global variables are declared in defs.h ++ since version 4.18 } + xdb_commands : longint;cvar;public; + + { Whether dbx commands will be handled } + dbx_commands : longint;cvar;public; + {$endif GDB_HAS_DB_COMMANDS} + ++{$ifdef GDB_NEEDS_SET_INSTREAM} + var ++ instream : P_C_FILE;cvar;external; ++ function gdb_fopen (filename : pchar; mode : pchar) : pui_file;cdecl;external; ++{$endif GDB_NEEDS_SET_INSTREAM} ++var ++ { 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; + gdb_stdlog : pui_file;cvar;public; +@@ -1516,6 +1645,9 @@ + event_loop_p : longint;cvar;public; + {$ifdef GDB_V6} + (* target IO streams *) ++ { The three following variables are declared in defs.h ++ and instanciated in main.c since version 6.0 } ++ gdb_stdin : pui_file;cvar;public; + gdb_stdtargin : pui_file;cvar;public; + gdb_stdtargerr : pui_file;cvar;public; + {$endif} +@@ -1523,7 +1655,10 @@ + { used for gdb_stdout and gdb_stderr } + function xmalloc(size : longint) : pointer;cdecl;external; + { used for QueryHook } +-function xstrvprintf(msg : pchar) : pchar; varargs; cdecl; external; ++{ xvasprintf is present at least from GDB 5.3 ++ while xstrvprintf only appears in version 6.2, ++ so only use xvasprintf function } ++function xvasprintf(ret : ppchar; msg : pchar) : pchar; varargs; cdecl; external; + 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; +@@ -2406,11 +2541,15 @@ + QueryHook:=0 + else + begin +- if curr_gdb^.reset_command and (pos('Kill',question)>0) then ++ if curr_gdb^.reset_command and ((pos('Kill',question)>0) or ++ (pos('Discard symbol table',question)>0)) then + QueryHook:=1 + else if pos('%',question)>0 then + begin +- local:=xstrvprintf(question,arg); ++ xvasprintf(@local,question,arg); ++ { xvasprintf can failed, in that case local is set to nil } ++ if not assigned(local) then ++ local:=question; + QueryHook:=curr_gdb^.Query(local, nil); + xfree(local); + end +@@ -2451,7 +2590,12 @@ + last_breakpoint_number:=b.number; + { function breakpoints have zero as file and as line !! + but they are valid !! } ++{$ifndef GDB_USES_BP_OPS} + invalid_breakpoint_line:=(b.line_number<>sym.line) and (b.line_number<>0); ++{$else GDB_USES_BP_OPS} ++ invalid_breakpoint_line:=(b.loc=nil) or ++ ((b.loc^.line_number<>sym.line) and (b.loc^.line_number<>0)); ++{$endif GDB_USES_BP_OPS} + {$ifdef GDB_USES_BP_LOCATION} + if assigned (b.loc) then + last_breakpoint_address:=b.loc^.address +@@ -2471,7 +2615,11 @@ + {$ifdef GDB_HAS_OBSERVER_NOTIFY_BREAKPOINT_CREATED} + + type ++{$ifdef GDB_NOTIFY_BREAKPOINT_ARG_IS_BREAKPOINT_PTR} ++ breakpoint_created_function_type = procedure (bpp : pbreakpoint); cdecl; ++{$else not GDB_NOTIFY_BREAKPOINT_ARG_IS_BREAKPOINT_PTR} + breakpoint_created_function_type = procedure (bpnum : longint); cdecl; ++{$endif not GDB_NOTIFY_BREAKPOINT_ARG_IS_BREAKPOINT_PTR} + pobserver = pointer; + var + breakpoint_created_observer : pobserver = nil; +@@ -2479,8 +2627,14 @@ + function observer_attach_breakpoint_created(create_func : breakpoint_created_function_type) : pobserver;cdecl;external; + procedure observer_detach_breakpoint_created(pob : pobserver);cdecl;external; + +-var breakpoint_chain : pbreakpoint ;cvar;external; + ++{$ifdef GDB_NOTIFY_BREAKPOINT_ARG_IS_BREAKPOINT_PTR} ++procedure notify_breakpoint_created(bpp : pbreakpoint); cdecl; ++begin ++ CreateBreakpointHook(bpp^); ++end; ++{$else not GDB_NOTIFY_BREAKPOINT_ARG_IS_BREAKPOINT_PTR} ++var breakpoint_chain : pbreakpoint ;cvar;external; + + procedure notify_breakpoint_created(bpnum : longint);cdecl; + var +@@ -2498,8 +2652,16 @@ + pb:=pb^.next; + end; + end; ++{$endif not GDB_NOTIFY_BREAKPOINT_ARG_IS_BREAKPOINT_PTR} + {$endif def GDB_HAS_OBSERVER_NOTIFY_BREAKPOINT_CREATED} + ++{ Avoid loading of main.o object by providing a ++ stripped down version of relocate_gdb_directory function } ++function relocate_gdb_directory(path : pchar) : pchar; cdecl; public; ++begin ++ relocate_gdb_directory:=path; ++end; ++ + {***************************************************************************** + tgdbinterface + *****************************************************************************} +@@ -2528,7 +2690,7 @@ + gdb_command('set print object on'); + gdb_command('set print null-stop'); + {$ifdef USE_MINGW_GDB} // maybe this also should be done for newer cygwin gdbs. +- gdb_command('set confirm off'); ++ //gdb_command('set confirm off'); + {$endif} + end; + +@@ -2609,9 +2771,9 @@ + var + top_level_val : longint; + +-function catch_errors(func : pointer; command : pchar; from_tty,mask : longint) : longint;cdecl;external; ++function catch_command_errors(func : pointer; command : pchar; from_tty,mask : longint) : longint;cdecl;external; + +-function gdbint_execute_command(command : pchar; from_tty,mask : longint) : longint;cdecl; ++function gdbint_execute_command(command : pchar; from_tty : longint) : longint;cdecl; + begin + gdbint_execute_command:=1; + execute_command(command,from_tty); +@@ -2658,6 +2820,8 @@ + begin + {$ifdef cpui386} + MaskAllFPUExceptions := control or MaskAllExceptions; ++{$else} ++ MaskAllFPUExceptions:=0; + {$endif} + end; + +@@ -2716,7 +2880,8 @@ + begin + quit_return:=error_return; + mask:=longint($ffffffff); +- catch_errors(@gdbint_execute_command,@command,0,mask); ++ catch_command_errors(@gdbint_execute_command,@command, ++ 1,mask); + {$ifdef go32v2} + reload_fs; + {$endif go32v2} +@@ -2973,11 +3138,43 @@ + c_environ : ppchar;external name '_environ'; + c_argc : longint;external name '___crt0_argc'; + c_argv : ppchar;external name '___crt0_argv'; ++ ++ procedure ReallocateEnvironUsingCMalloc; ++ ++ var ++ neededsize , count : longint; ++ penv : pchar; ++ newenv : ppchar; ++ begin ++ if not assigned(c_environ) then ++ neededsize:=0 ++ else ++ begin ++ count:=0; ++ penv:=c_environ^; ++ while assigned(penv) do ++ begin ++ inc(count); ++ inc(penv,sizeof(pchar)); ++ end; ++ neededsize:=count*sizeof(pchar); ++ end; ++ newenv:=malloc(neededsize); ++ system.move(c_environ,newenv,neededsize); ++ c_environ:=newenv; ++ end; ++ + {$endif def go32v2} + var + current_directory : pchar; cvar; external; + gdb_dirbuf : array[0..0] of char; cvar; external; + CurrentDir : AnsiString; ++{$ifdef GDB_NEEDS_INTERPRETER_SETUP} ++ type ++ interpreter_struct_p = pointer; { to opaque type } ++ function interp_lookup (name : pchar) : interpreter_struct_p;cdecl; external; ++ function interp_set (interp : interpreter_struct_p) : longbool;cdecl; external; ++{$endif GDB_NEEDS_INTERPRETER_SETUP} + const + DIRBUF_SIZE = 1024; + +@@ -2986,13 +3183,28 @@ + var + OldSigInt : SignalHandler; + {$endif supportexceptions} ++{$ifdef GDB_NEEDS_SET_INSTREAM} ++var ++ dummy_file : pui_file; ++{$endif GDB_NEEDS_SET_INSTREAM} ++ + {$ifdef GDB_INIT_HAS_ARGV0} + var + argv0 : pchar; + {$endif not GDB_INIT_HAS_ARGV0} ++{$ifdef GDB_NEEDS_INTERPRETER_SETUP} ++var ++ interp : interpreter_struct_p; ++{$endif GDB_NEEDS_INTERPRETER_SETUP} ++var ++ save_gdb_stdin, ++ save_gdb_stdout, ++ save_gdb_stderr : pui_file; + begin + {$ifdef go32v2} +- c_environ:=system.envp; ++ { c_environ:=system.envp; } ++ { DJGPP libC presupposes the c_enivron was malloc'ated } ++ ReallocateEnvironUsingCMalloc; + c_argc:=system.argc; + c_argv:=system.argv; + {$endif def go32v2} +@@ -3012,8 +3224,25 @@ + ui_file_delete(gdb_stderr); + if assigned(gdb_stdout) then + ui_file_delete(gdb_stdout); ++{$ifdef GDB_NEEDS_SET_INSTREAM} ++ if assigned(gdb_stdin) then ++ ui_file_delete(gdb_stdin); ++ gdb_stdin:=mem_fileopen; ++ save_gdb_stdin:=gdb_stdin; ++ dummy_file :=gdb_fopen('dummy.$$$','a'); ++ {in captured_main code, this is simply ++ instream:=stdin; but stdin is a highly system dependent macro ++ so that we try to avoid it here } ++ if assigned(dummy_file) then ++ instream:=pstdio_file(dummy_file^.to_data)^._file ++ else ++ instream:=nil; ++{$endif GDB_NEEDS_SET_INSTREAM} ++ + gdb_stderr:=mem_fileopen; + gdb_stdout:=mem_fileopen; ++ save_gdb_stderr:=gdb_stderr; ++ save_gdb_stdout:=gdb_stdout; + gdb_stdlog:=gdb_stderr; + gdb_stdtarg:=gdb_stderr; + set_ui_file_write(gdb_stdout,@gdbint_ui_file_write); +@@ -3022,7 +3251,9 @@ + error_init; + {$endif GDB_NEEDS_NO_ERROR_INIT} + {$ifdef GDB_V6} +-// gdb_stdtargin := gdb_stdin; ++{$ifdef GDB_NEEDS_SET_INSTREAM} ++ gdb_stdtargin := gdb_stdin; ++{$endif GDB_NEEDS_SET_INSTREAM} + gdb_stdtargerr := gdb_stderr; + {$endif} + GetDir(0, CurrentDir); +@@ -3034,8 +3265,10 @@ + next_exit:=exitproc; + exitproc:=@DoneLibGDB; + {$ifdef GDB_V6} ++{$ifndef GDB_NO_UIOUT} + uiout := cli_out_new (gdb_stdout); +-{$endif} ++{$endif not GDB_NO_UIOUT} ++{$endif GDB_V6} + {$ifdef GDB_INIT_HAS_ARGV0} + getmem(argv0,length(paramstr(0))+1); + strpcopy(argv0,paramstr(0)); +@@ -3044,6 +3277,31 @@ + {$else not GDB_INIT_HAS_ARGV0} + gdb_init; + {$endif not GDB_INIT_HAS_ARGV0} ++{$ifdef GDB_NEEDS_INTERPRETER_SETUP} ++ { interpreter can only be set after all files are ++ initialized, which is done in gdb_init function. } ++ interp := interp_lookup ('console'); ++ interp_set (interp); ++ ++ { We need to re-set gdb_stdXX ui_files } ++ if assigned(gdb_stderr) then ++ ui_file_delete(gdb_stderr); ++ if assigned(gdb_stdout) then ++ ui_file_delete(gdb_stdout); ++ if assigned(gdb_stdin) then ++ ui_file_delete(gdb_stdin); ++ gdb_stdin:=save_gdb_stdin; ++ gdb_stderr:=save_gdb_stderr; ++ gdb_stdout:=save_gdb_stdout; ++ gdb_stdlog:=gdb_stderr; ++ gdb_stdtarg:=gdb_stderr; ++ set_ui_file_write(gdb_stdout,@gdbint_ui_file_write); ++ set_ui_file_write(gdb_stderr,@gdbint_ui_file_write); ++{$ifdef GDB_NO_UIOUT} ++ cli_uiout := cli_out_new (gdb_stdout); ++ current_uiout:=cli_uiout; ++{$endif GDB_NO_UIOUT} ++{$endif GDB_NEEDS_INTERPRETER_SETUP} + {$ifdef supportexceptions} + {$ifdef unix} + fpsignal(SIGINT,OldSigInt); +@@ -3069,14 +3327,34 @@ + end; + + {$ifdef GDB_HAS_SYSROOT} +-var gdb_sysroot : pchar; cvar;public; ++ { Here we declare as cvar;public; a bunch of global ++ variables that are defined in main.c source. ++ We must not load main.o otherwise, we will get ++ into multiply defined symbols troubles. } ++var ++ gdb_sysrootc : char; ++ { used locally only to provide a pchar pointing to '\0' } ++ 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; ++ { gdb_datadir global variable is declared in defs.h and ++ instanciated in main.c since version 7.0 } + python_libdir : pchar;cvar;public; +- gdb_sysrootc : char; ++ { python_libdir global variable is declared in defs.h and instanciated ++ in main.c since version 7.2 } + return_child_result : longbool;cvar;public; ++ { return_chlid_result global variable is declared in main.h and ++ instanciated in main.c since version 6.4 } + return_child_result_value : longint;cvar;public; ++ { return_child_result_value global variable is declared in main.h and ++ instanciated in main.c since version 6.4 with a startup value of -1 } + batch_silent : longbool;cvar;public; ++ { batch_silent global variable is declared in main.h since 7.0, but ++ instanciated in main.c since version 6.4 } + batch_flag : longbool;cvar;public; ++ { batch_flag global variable is declared in main.h and ++ instanciated in main.c since version 7.2 } + {$endif} + {$ifdef GDB_HAS_DEBUG_FILE_DIRECTORY} + var +@@ -3086,6 +3364,7 @@ + begin + {$ifdef GDB_HAS_SYSROOT} + gdb_sysrootc := #0; ++ return_child_result_value := -1; + gdb_sysroot := @gdb_sysrootc; + gdb_datadir := @gdb_sysrootc; + python_libdir := @gdb_sysrootc;