1 1.1 christos 2 1.1 christos How to build and install the DJGPP native version of GDB 3 1.1 christos ******************************************************** 4 1.1 christos 5 1.1 christos General 6 1.1 christos ======= 7 1.1 christos 8 1.1 christos GDB built with DJGPP supports native DJGPP debugging, whereby you run 9 1.1 christos gdb.exe and the program being debugged on the same machine. In 10 1.1 christos addition, this version supports remote debugging via a serial port, 11 1.1 christos provided that the target machine has a GDB-compatible debugging stub 12 1.1 christos which can be linked with the target program (see the section "Remote 13 1.1 christos Serial" in the GDB manual for more details). 14 1.1 christos 15 1.1 christos 16 1.1 christos Installation of the binary distribution 17 1.1 christos ======================================= 18 1.1 christos 19 1.1 christos Simply unzip the gdbNNNb.zip file (where NNN is the version number) 20 1.1 christos from the top DJGPP installation directory. Be sure to preserve the 21 1.1 christos directory structure while you unzip (use -d switch if you do this with 22 1.1 christos PKUNZIP). On Windows 9X and Windows 2000, use an unzip program which 23 1.1 christos supports long file names; one such program is unzip32.exe, available 24 1.1 christos from the DJGPP sites. 25 1.1 christos 26 1.1 christos If you need the libraries which are built as part of GDB, install the 27 1.1 christos companion file gdbNNNa.zip. This allows to develop applications which 28 1.1 christos use the same functions as GDB. For example, you can build your own 29 1.1 christos front end to the debugger. 30 1.1 christos 31 1.1 christos 32 1.1 christos Rebuilding GDB from sources 33 1.1 christos =========================== 34 1.1 christos 35 1.1 christos 1. Prerequisites 36 1.1 christos ------------- 37 1.1 christos To build the package, you will need the DJGPP development environment 38 1.1 christos (GCC, header files, and the libraries), and also DJGPP ports of the 39 1.1 christos following tools: 40 1.1 christos 41 1.1 christos - GNU Make 3.79.1 or later 42 1.1 christos - Bash 2.03 or later 43 1.1 christos - GNU Sed 44 1.1 christos - GNU Fileutils 45 1.1 christos - GNU Textutils 2.0 or later 46 1.1 christos - GNU Sh-utils 47 1.1 christos - GNU Grep 2.4 or later 48 1.1 christos - GNU Findutils 49 1.1 christos - GNU Awk 3.04 or later 50 1.1 christos - GNU Bison (only if you change one of the gdb/*.y files) 51 1.1 christos - Groff (only if you need to format the man pages) 52 1.1 christos - GNU Diffutils (only if you run the test suite) 53 1.1 christos 54 1.1 christos These programs should be available from the DJGPP sites, in the v2gnu 55 1.1 christos directory. In addition, the configuration script invokes the `update' 56 1.1 christos and `utod' utilities which are part of the basic DJGPP development kit 57 1.1 christos (djdevNNN.zip). 58 1.1 christos 59 1.1 christos 60 1.1 christos 2. Unpacking the sources 61 1.1 christos --------------------- 62 1.1 christos If you download the source distribution from one of the DJGPP sites, 63 1.1 christos just unzip it while preserving the directory structure (I suggest to 64 1.1 christos use unzip32.exe available with the rest of DJGPP), and proceed to the 65 1.1 christos section "How to build", below. 66 1.1 christos 67 1.1 christos Source distributions downloaded from one of the GNU FTP sites need 68 1.1 christos some more work to unpack. First, you MUST use the `djunpack' batch 69 1.1 christos file to unzip the package. That's because some file names in the 70 1.1 christos official distributions need to be changed to avoid problems on the 71 1.1 christos various platforms supported by DJGPP. `djunpack' invokes the `djtar' 72 1.1 christos program (that is part of the basic DJGPP development kit) to rename 73 1.1 christos these files on the fly given a file with name mappings; the 74 1.1 christos distribution includes a file `gdb/config/djgpp/fnchange.lst' with the 75 1.1 christos necessary mappings. So you need first to retrieve that batch file, 76 1.1 christos and then invoke it to unpack the distribution. Here's how: 77 1.1 christos 78 1.1 christos djtar -x -p -o gdb-5.2/djunpack.bat gdb-5.2.tar.gz > djunpack.bat 79 1.1 christos djunpack gdb-5.2.tar.gz 80 1.1 christos 81 1.1 christos (The name of the distribution archive and the leading directory of the 82 1.1 christos path to `djunpack.bat' in the distribution will be different for 83 1.1 christos versions of GDB other than 5.2.) 84 1.1 christos 85 1.1 christos If the argument to `djunpack.bat' include leading directories, it MUST 86 1.1 christos be given with the DOS-style backslashes; Unix-style forward slashes 87 1.1 christos will NOT work. 88 1.1 christos 89 1.1 christos If the distribution comes as a .tar.bz2 archive, and your version of 90 1.1 christos `djtar' doesn't support bzip2 decompression, you need to unpack it as 91 1.1 christos follows: 92 1.1 christos 93 1.1 christos bunzip2 gdb-6.4.tar.bz2 94 1.1 christos djtar -x -p -o gdb-6.4/djunpack.bat gdb-6.4.tar > djunpack.bat 95 1.1 christos djunpack gdb-6.4.tar 96 1.1 christos 97 1.1 christos 98 1.1 christos 3. How to build 99 1.1 christos ------------ 100 1.1 christos 101 1.1 christos If the source distribution available from DJGPP archives is already 102 1.1 christos configured for DJGPP v2.x (if it is, you will find files named 103 1.1 christos `Makefile' in each subdirectory), then just invoke Make: 104 1.1 christos 105 1.1 christos make 106 1.1 christos 107 1.1 christos To build a package that is not yet configured, or if you downloaded 108 1.1 christos GDB from a GNU FTP site, you will need to configure it first. You 109 1.1 christos will also need to configure it if you want to change the configuration 110 1.1 christos options (e.g., compile without support for the GDBMI interface). To 111 1.1 christos configure GDB, type this command: 112 1.1 christos 113 1.1 christos sh ./gdb/config/djgpp/djconfig.sh 114 1.1 christos 115 1.1 christos This script checks the unpacked distribution, then edits the configure 116 1.1 christos scripts in the various subdirectories, to make them suitable for 117 1.1 christos DJGPP, and finally invokes the top-level configure script, which 118 1.1 christos recursively configures all the subdirectories. 119 1.1 christos 120 1.1 christos You may pass optional switches to djconfig.sh. It accepts all the 121 1.1 christos switches accepted by the original GDB configure script. These 122 1.1 christos switches are described in the file gdb/README, and their full list can 123 1.1 christos be displayed by running the following command: 124 1.1 christos 125 1.1 christos sh ./gdb/configure --help 126 1.1 christos 127 1.1 christos NOTE: if you *do* use optional command-line switches, you MUST pass 128 1.1 christos to the script the name of the directory where GDB sources are 129 1.1 christos unpacked--even if you are building GDB in-place! For example: 130 1.1 christos 131 1.1 christos sh ./gdb/config/djgpp/djconfig.sh . --disable-gdbmi 132 1.1 christos 133 1.1 christos It is also possible to build GDB in a directory that is different from 134 1.1 christos the one where the sources were unpacked. In that case, you have to 135 1.1 christos pass the source directory as the first argument to the script: 136 1.1 christos 137 1.1 christos sh ./gdb/config/djgpp/djconfig.sh d:/gnu/gdb-6.4 138 1.1 christos 139 1.1 christos You MUST use forward slashes in the first argument. 140 1.1 christos 141 1.1 christos After the configure script finishes, run Make: 142 1.1 christos 143 1.1 christos make 144 1.1 christos 145 1.1 christos If you want to produce the documentation (for example, if you changed 146 1.1 christos some of the Texinfo sources), type this: 147 1.1 christos 148 1.1 christos make info 149 1.1 christos 150 1.1 christos When Make finishes, you can install the package: 151 1.1 christos 152 1.1 christos make install prefix='${DJDIR}' INSTALL='ginstall -c' 153 1.1 christos 154 1.1 christos The above doesn't install the docs; for that you will need to say 155 1.1 christos this: 156 1.1 christos 157 1.1 christos make install-info prefix='${DJDIR}' INSTALL='ginstall -c' 158 1.1 christos 159 1.1 christos The test suite has been made to work with DJGPP. If you make a change 160 1.1 christos in some of the programs, or want to be sure you have a fully 161 1.1 christos functional GDB executable, it is a good idea to run the test suite. 162 1.1 christos You cannot use "make check" for that, since it will want to run the 163 1.1 christos `dejagnu' utility which DJGPP doesn't support. Instead, use the special 164 1.1 christos script gdb/config/djgpp/djcheck.sh, like this: 165 1.1 christos 166 1.1 christos cd gdb/testsuite 167 1.1 christos sh ../config/djgpp/djcheck.sh 168 1.1 christos 169 1.1 christos This will run for a while and should not print anything, except the 170 1.1 christos messages "Running tests in DIR", where DIR is one of the 171 1.1 christos subdirectories of the testsuite. Any test that fails to produce the 172 1.1 christos expected output will cause the diffs between the expected and the 173 1.1 christos actual output be printed, and in addition will leave behind a file 174 1.1 christos SOMETHING.tst (where SOMETHING is the name of the failed test). You 175 1.1 christos should compare each of the *.tst files with the corresponding *.out 176 1.1 christos file and convince yourself that the differences do not indicate a real 177 1.1 christos problem. Examples of differences you can disregard are changes in the 178 1.1 christos copyright blurb printed by GDB, values of unitialized variables, 179 1.1 christos addresses of global variables like argv[] and envp[] (which depend on 180 1.1 christos the size of your environment), etc. 181 1.1 christos 182 1.1 christos Note that djcheck.sh only recurses into those of the subdirectories of 183 1.1 christos the test suite which test features supported by the DJGPP port of GDB. 184 1.5 christos For example, the tests in the gdb.gdbtk, and gdb.threads directories 185 1.5 christos are not run. 186 1.1 christos 187 1.1 christos 188 1.1 christos Enjoy, 189 1.1 christos Eli Zaretskii <eliz (a] gnu.org> 190