
This directory contains config files and patches for the
GNU source level debgugger gdb to run under MINIX 1.5 386.

This port was done by Richard Tobin, AIAI, University of Edinburgh
(richard@aiai.ed.ac.uk)

You will need

   MINIX 1.5 (Prentice Hall or 1.5.10 from the net)
   Bruce Evans' 386 patches from plains.nodak.edu (134.129.111.64
     in pub/Minix/oz) or sirius.ucs.adelaide (129.127.40.3 in
     pub/minix/local)
   At least 4Meg of memory, and 5 Meg of disk space
   An implementation of gcc as in ours from plains.nodak.edu
     (134.129.111.64 in pub/Minix/uk)
   Patches to MINIX 1.5 386 to allow GNU a.out files to be
     run directly in MINIX.  Posted to comp.os.minix, soon
     to be on plain.nodak.edu (gnutoo.tar.Z)
   gdb-3.5.tar.Z  from prep.ai.mit.edu (18.71.0.38 in u2/emacs)

This directory contains:

   README           this file
   gdb.cdiff        patches to Makefile.dist and config.gdb
   infrun.cdiff     patch to infrun.c
   readline.cdiff   patches to readline/readline.c
   m-minix386.h     Minix dependant header files
   minix386-dep.c   Minix dependant C code
   sys/user.h       a dummy header file, to avoid changes a number of files
   signal.cdiff     Patch to Minix kernel mm/signal.c to ensure the 
                    stack pointer is dealt with properly when core dumping

To compile gdb under minix:

0)  Install the gnutoo files to allow GNU a.out format in the
    Minix kernel.  Also apply the mm/signal.c patch to allow the
    stack pointer to be dealt with properly during core dumping.

1)  Unpack gdb-3.5.tar.Z

2)  copy gdb.cdiff readline.cdiff m-minix386.h minix386-dep.c into
    dist-gdb.  Apply patches 
         patch <gdb.cdiff
         patch <infrun.cdiff
         cd readline
         patch <../readline.cdiff
    mkdir sys (in dist-gdb) and copy sys/user.h into it.

3)  config.gdb minix386 
    This seems to fail unless you have chmem'd sh to be very large.
    I use 'bash config.gdb minix386' with bash chmem'd to 500000.
    If you can't get it to work you can do it by hand with the following
    commands

    ln m-minix386.h param.h
    ln i386-pinsn.c pinsn.c
    ln m-i386.h opcode.h    # not necessary ??
    ln minix386-dep.c dep.c
    cp Makefile.dist tmp.c
    gcc -E >Makefile tmp.c -DM_REGEX=regex.o -DM_MAKEDEFINE=-DM_REGEX=regex.o
    rm -f tmp.c

4)  make

    dep.c (linked to minix386-dep.c) expects the Minix kernel src
    in /usr/src/kernel, as it includes so .h files from there. You
    may have to change that if this is not the case on you system.
    [ Also dep.c requires page_size to be defined as 1024.  It appears
      we have this in an include file.  You should add -Dpage_size=1024
      to the makefile from dep.c (or do it by hand) - awb]

    make often fails when it tries to make the things in the subdirectory
    readline due to make (or sh ?) running out of space.  I usually
    type that command myself
    
    (cd readline; make "DEBUG_FLAGS= -DMINIX" \
                  "CC=gcc -traditional -O" libreadline.a)

5)  If you had to make readline explicitly type make at the top 
    level again to continue the make (that seems to work).
    You should then have a gdb executable

6)  You can test it with a hello world program

      gcc -g -c hw.c
      gcc hw.o         (i.e. don't link with libg.a unless you've built it)
      gdb a.out
      [ various messages ]
      b main           (break at first line -- you should be in the same
                        dir as hw.c)
      run              (will break at main)
      n                (single step)

7)  We use gdb mode in GNU emacs but requires quite a lot of space
    but is probably worth it.  You should read the gdb manual for 
    more details -- it is convienent to install the gdb info files
    and use emacs to read them.  You can create the info files
    by using emacs.  emacs gdb.texinfo and use the command 
    M-x texinfo-format-buffer

8)  The original emacs distributed by us on plains.nodak.edu has the annoying
    bug of killing *all* your processes when you exit an emacs with 
    subprocesses.  This has been fixed and there should be new version
    on plains.nodak.edu or mail me (awb.ed.ac.uk).


BUGS:

If you find bugs you should mail them to richard@aiai.ed.ac.uk rather
than GNU as they are likely to be bugs in the Minix version rather
than gdb itself.

Have fun.

Alan W Black
Dept of AI,
University of Edinburgh
(awb@ed.ac.uk)
