Next: , Up: Program Built with Foreign Tools and DLL Built with GCC/GNAT


G.13.2.1 Debugging the DLL Directly
  1. Find out the executable starting address
              $ objdump --file-header main.exe
    

    The starting address is reported on the last line. For example:

              main.exe:     file format pei-i386
              architecture: i386, flags 0x0000010a:
              EXEC_P, HAS_DEBUG, D_PAGED
              start address 0x00401010
    
  2. Launch the debugger on the executable.
              $ gdb main.exe
    
  3. Set a breakpoint at the starting address, and launch the program.
              $ (gdb) break *0x00401010
              $ (gdb) run
    

    The program will stop at the given address.

  4. Set a breakpoint on a DLL subroutine.
              (gdb) break ada_dll.adb:45
    

    Or if you want to break using a symbol on the DLL, you need first to select the Ada language (language used by the DLL).

              (gdb) set language ada
              (gdb) break ada_dll
    
  5. Continue the program.
              (gdb) cont
    

    This will run the program until it reaches the breakpoint that has been set. From that point you can use the standard way to debug a program as described in (see Running and Debugging Ada Programs).

It is also possible to debug the DLL by attaching to a running process.