Search code examples
c++linuxqt-creatorlibtool

How to debug libtool executable in Qt Creator?


I have an Autotools + libtool project and I am trying to setup Qt Creator for it.

I created project via Import project --> Import Existing Project. Building (make) and running the specified executable works fine, but when I try to debug I get error

not in executable format: File format not recognized

Solution

  • You need to use libtool --mode=execute gdb your_program for debugging, see http://www.gnu.org/software/libtool/manual/html_node/Debugging-executables.html

    For Qt Creator you can create a script

    #!/bin/bash
    exec libtool --mode=execute /usr/bin/gdb "$@"
    

    to specify it in Options --> Build & Run --> Debuggers (and select the debugger on the Kits page after that)

    enter image description here

    Also check Run In Terminal in the project run settings

    enter image description here