10

I'm having trouble walking through emacs source code in gdb. I think I'm missing debug symbols.

Following a suggestion from https://stackoverflow.com/a/4298982/2752242, I tried:

./configure CFLAGS="-ggdb3 -O0" CXXFLAGS="-ggdb3 -O0" LDFLAGS="-ggdb3" --with-gif=no --prefix=$HOME/local/apps/emacs-24.4/

But, that didn't work.

Are there instructions on compiling with debug symbols? Thanks!

Job Evers
  • 300
  • 1
  • 8
  • This is how I'm building it, if I need to debug: `CFLAGS='-O0 -ggdb -g3' ./configure --enable-checking --enable-asserts`. I'm not a pro, but I'm not sure you can give arguments to `configure` the way you did it. Usually, those come before calling the program, and configure takes those from environment it's called with, but maybe it's something new... – wvxvw Dec 08 '14 at 17:32
  • 1
    Passing via arguments is recommended in the manual: https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.69/html_node/Defining-Variables.html – npostavs Mar 18 '15 at 21:10

1 Answers1

5

I was able to get line numbers in gdb if I run the emacsclient binary that is produced by make that lives in emacs/lib-src. If I do make install and try to attach a debugger to the installed binary, no line numbers.

This is what worked for me:

$ CFLAGS="-ggdb3 -O0" CXXFLAGS="-ggdb3 -O0" LDFLAGS="-ggdb3" ./configure --enable-checking --with-gif=no --prefix=$HOME/local/apps/emacs-24.4/
$ make
$ gdb lib-src/emacsclient

This doesn't work:

$ CFLAGS="-ggdb3 -O0" CXXFLAGS="-ggdb3 -O0" LDFLAGS="-ggdb3" ./configure --enable-checking --with-gif=no --prefix=$HOME/local/apps/emacs-24.4/
$ make
$ make install
$ gdb $HOME/local/apps/emacs-24.4/bin/emacsclient
Job Evers
  • 300
  • 1
  • 8