Package GDB version 14.1

This software has been compiled with the m68k-atari-mintelf cross-tools.

Original links

Homepage: https://sourceware.org/gdb/
Original download: https://ftp.gnu.org/gnu/gdb/
Patch repository: https://github.com/vinriviere/m68k-atari-mint-binutils-gdb/tree/gdb-14-mintelf

Sources

Original sources: gdb-14.1.tar.xz (22 MB)
MiNT ELF patch: gdb-14.1-mintelf-20240206.patch.xz (18 KB)

68000 binaries for MiNT

68000 binary: gdb-14.1-mintelf-20240206-bin-mintelf-20240206.tar.xz (3 MB)
68000 build script: gdb-14.1-mintelf-20240206-bin-mintelf-howto.txt (1.6 KB)

ColdFire binaries for MiNT

ColdFire binary: gdb-14.1-mintelf-20240206-bin-mintelfv4e-20240206.tar.xz (3 MB)
ColdFire build script: gdb-14.1-mintelf-20240206-bin-mintelfv4e-howto.txt (1.6 KB)

Bugs

This GDB binary has been carefully tested, and works well.
However, there are serious bugs in the following environments, which cause GDB to be unusable:

Note: gdbserver is not yet available. But it may come some day.

Quickstart

  1. Install gdb on your MiNT machine.
    You don't need to extract the whole binary archive. Just extract gdb from /usr/bin, and put it anywhere. It is a standalone program.
  2. First you must cross-compile your software using the m68k-atari-mintelf cross-tools and the -g option (both for compilation and linking). This will embed very precise DWARF debugging information into your executable, suitable for GDB.
    m68k-atari-mintelf-gcc hello.c -o hello.tos -g
    
  3. Make the executable available on your MiNT machine.
    Easiest solution is simply to copy the sources and the resulting executable to the MiNT machine.
    A more convenient solution would be a shared folder between the build and MiNT machine. This could be an ARAnyM hostfs folder, or an NFS/Samba share.
  4. On the MiNT machine, cd to the folder of your executable, then run gdb followed by the name of your executable. Do not add any command-line argument.
    gdb hello.tos
    
    If everything is OK, the last line should be:
    Reading symbols from hello.tos...
    
  5. Add a breakpoint somewhere in your code.
    A good choice is simply the main function.
    The breakpoint can be set like this:
    b main
    
  6. Start the program, and run until the breakpoint is hit. This is done using the run command. You may add extra command-line arguments after run.
    run
    
  7. As the program is stopped at a breakpoint, you can examine your program's variables. There are many commands available, here are a few ones.
    # Display a single variable
    print argc
    p argc
    
    # Display all function arguments
    info args
    
    # Display all local variables
    info locals
    
    # Display all the information about the current frame
    bt full
    
    # Trick to display all the command-line arguments
    p *argv@argc
    
    # Clear the screen
    ^L
    
  8. Display the current C source:
    list
    
  9. Display the disassembly interleaved with C source:
    disas /s
    
  10. To go forward, you have several options:
    # Step into the next instruction. This enters functions.
    # Note: Debugging information is required in order to allow stepping into a function.
    # For example, if your libc hasn't been compiled with -g, you won't be able to step into printf().
    step
    s
    
    # Step over the next instruction. This executes functions, and automatically breaks just after.
    next
    n
    
    # Manually put a breakpoint somewhere else. And continue.
    b myfunction
    cont
    
    # Continue until the end of the current function
    finish
    
  11. When your program terminates, you can run it again:
    run
    
  12. Finally, you can leave GDB:
    exit
    ^D
    
  13. GDB features a nice full-screen interface named TUI (Text User Interface).
    You can enable it at any time by pressing Ctrl+X then A while already inside GDB,
    or immediately at startup using the --tui command-line option.
    Then you can use the s, n and cont commands as usual.
    This is highly convenient.
  14. As soon as your program uses printf(), the TUI screen will be trashed.
    When this happens, type ^L to redraw the screen.

Documentation

Full GDB documentation.


Back to the MiNT ELF software list