Program and DLL Both Built with GCC/GNAT (GNAT User’s Guide for Native Platforms)

#### 7.4.8.26 Program and DLL Both Built with GCC/GNAT ¶

This is the simplest case. Both the DLL and the program have `GDB` compatible debugging information. You can then break anywhere in the process. Let’s suppose the main procedure is named `ada_main` and in the DLL there’s an entry point named `ada_dll`.

The DLL (Introduction to Dynamic Link Libraries (DLLs)) and program must have been built with the debugging information (see the GNAT `-g` switch). Here are the step-by-step instructions for debugging it:

- Launch `GDB` on the main program.

      $ gdb -nw ada_main

- Start the program and stop at the beginning of the main procedure

      (gdb) start

  This step is required to be able to set a breakpoint inside the DLL. Until the program is run, the DLL is not loaded. This has the consequence that the DLL debugging information is also not loaded, so it is not possible to set a breakpoint in the DLL.

- Set a breakpoint inside the DLL

      (gdb) break ada_dll
      (gdb) cont

At this stage, a breakpoint is set inside the DLL. From there on you can use standard `GDB` commands to debug the whole program (Running and Debugging Ada Programs).