1

I want to debug c source code by using ddd debugger. instruction say when compile it should compiled with -g tag. here is how I compile this project. aclocal , automake --add-missing, autoreconf, ./configure, make. so where should I put -g tag, then how can I invoke ddd to debugging?

usually after compile, I run it by

./slim.exe filename

could anyone has experience in this? Thanks in advance

Robi Kumar Tomar
  • 3,418
  • 3
  • 20
  • 27
arslan
  • 2,034
  • 7
  • 34
  • 61

1 Answers1

1

If you invoke ./configure --help, you'll see following options at the end of the help:

Some influential environment variables:
CC          C compiler command
CFLAGS      C compiler flags

Just specify CFLAGS=-g3 and gcc will be called with the flags you specify here.

yegorich
  • 4,653
  • 3
  • 31
  • 37
  • ./configure CFLAGS=-G3 . I run this. so next step to invoke ddd is , ddd ./slim.exe . it reports error: Error: Can't open display:. what should I do next? – arslan Sep 30 '13 at 06:58
  • Where are you calling DDD from? It should be run from your Desktop environment. Just start xterm and run ddd from there. It won't work, if you try to run it from a SSH session. – yegorich Sep 30 '13 at 07:37
  • As you're using cygwin, please read this [post](http://cygwin.com/ml/cygwin-xfree/2005-02/msg00028.html) for instructions on how to run DDD from cygwin environment. – yegorich Sep 30 '13 at 08:12
  • I started ddd , and opened program (.../slim.exe) as it said. but it say no debugging symbols are found. I think ./configure CFLAGS=-G3 is not correct. to generate dubugging symbols for ddd , during compiling , what should I do? – arslan Sep 30 '13 at 09:16
  • Btw. it is not **G3** but **g3**. – yegorich Sep 30 '13 at 09:35
  • I am doing like this. "aclocal, automake --add-missing, autoreconf, ./configure CFLAGS=-g3, make". then "startx &", then "ddd /../../../src/slim.exe" . and it still saying "no debugging symbols are found". I am looking for answer, but still can't fix it – arslan Sep 30 '13 at 09:40
  • Have you made **make clean**, before invoking **make**? By the way, you don't need to invoke the whole automake stuff, you just need to invoke make clean, ./configure CFLAGS=-g3 and make. That's all. – yegorich Sep 30 '13 at 13:12
  • I did as you said, make clean, ./configure CFLAGS=-g3, and make. after than I invoked, ddd ../slim.exe . it still saying "no debugging symbols are found". I think problem is in configuration, somewhere it is set to disable debug, Linux makes me crazy, wow – arslan Oct 01 '13 at 04:12