How to create debug symbols for gdb for my compiled binary?

255 views
Skip to first unread message

Marvin

unread,
Jun 24, 2011, 11:37:53 AM6/24/11
to HipHop for PHP Dev
Hi,

When i'm gdb'ing the binary hphp has generated for me (that is:
"program"; the compiled php), there are no debug symbols available.

So it seems to me the generated C++ was not compiled with the "-g"
flag. (offtopic: Why not?)

I'm no "make" expert, and certainly no "CMake" expert, but it seems
logical to me that there is a variable somewhere in the pile of
generated CMake files where I can specify/add compilerflags, right?

Can someone tell me where and how I set this variable?

BTW: Maybe my assumptions are all wrong here, and do I have to find
the solution in a whole different place. Please, tell me! My main goal
is to get debug symbols, so that I can step through the generated
binary via gdb, and see the lines of code / variable values while
stepping.

Thanks in advance!

PS: For clarity: I need the symbols for the binary generated by hphp,
not the symbols for the hphp binary itself

Lorenzo Castelli

unread,
Jun 30, 2011, 5:32:43 AM6/30/11
to HipHop for PHP Dev
On Jun 24, 5:37 pm, Marvin <mjaco...@gmail.com> wrote:
> When i'm gdb'ing the binary hphp has generated for me (that is:
> "program"; the compiled php), there are no debug symbols available.

At the top of CMake/Options.cmake there is a commented line:

#set(CMAKE_BUILD_TYPE Debug)

Just uncomment it and rebuild your binary.

You might want to rebuild Hiphop also (before your program), so that
you get full debug symbols and no optimizations for the runtime as
well.

Lorenzo

Marvin

unread,
Jun 30, 2011, 10:31:46 AM6/30/11
to HipHop for PHP Dev
Hi Lorenzo,

Good to hear from you again! And thanks for the input; appreciate it!

If I rebuild hiphop, as you suggest, then should uncomment the
specified CMake line for hiphop as well, right?

Cheers,

Marvin
Reply all
Reply to author
Forward
0 new messages