I want to debug & reverse engineer open source code such as this project. I usually use CLion to write and debug C code on Linux. I've also used GDB. What steps do I need to take to download a library like this example, and be able to get source-code-level debugging working? I've tried for example cloning that repo and opening it in CLion, but it seems that the build system that is used is not fully understood by CLion. If I do a make && make install, the project gets built and I have the binaries, but then I cannot get source-level debugging if I say, open the binary with gdb. Are there any techniques to get into an open source repo and get the code building in an IDE or debugging system?

1 Answer 1


You don't need to make install the binary, this often strips the binary removing all the debug information.

In the HACKING file these is a section on how to debug this tool, they advise the following settings, personally I would add -ggdb to enable gdb specific bindings. (This advice also applies to other projects, although this project has explicitly added it to help new developers to the project.)

  $ ./configure CFLAGS='-g -O0 -Wall -Wextra'
  $ make

It also explains how to use libtool to run the binaries.

  $ libtool --mode=execute gdb ./tools/lou_checktable
  (gdb) run tables/wiskunde.ctb
  • 1
    So what you're really saying as an answer is more or less "Each project is more or less case-by-case and you need to do a more thorough job of reading the provided docs if they exist. If they don't exist, it may be more difficult." Is that a fair summation?
    – the_endian
    Apr 2, 2020 at 3:02
  • Also, generally speaking, the binary can be "instrumented"/prepared for debugging at the MAKE step?
    – the_endian
    Apr 2, 2020 at 3:08
  • 1
    No, these flags are fairly general: you need to make sure that the compile and link steps both have -g or something more specific like -ggdb for better information if you're using GDB; -O0 means don't optimise which might make things easier to follow, -Wall and -Wextra are for extra warnings you'd want to see when changing the code. You only really need -g. Barring quirks in the build system these are universal when compiling with GCC, and generally you want to edit / override CCFLAGS and LDFLAGS to set these, and check they aren't stripped (strip) after linking.
    – Rup
    Apr 2, 2020 at 7:29
  • 2
    Realistically yes you need to generate debug symbols at build time. If you're using someone else's binary e.g. a library from your linux distro then they will have often built the debug symbols but not put them in the main package; check for specific debuginfo packages you can download an install too to debug into their binaries.
    – Rup
    Apr 2, 2020 at 7:31
  • I updated the answer for clarity Apr 2, 2020 at 11:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.