php-spx icon indicating copy to clipboard operation
php-spx copied to clipboard

GDB support / debug build

Open ilnytskyi opened this issue 2 years ago • 2 comments

Is there a way to configure and install this extension with gdb support? I prepared dev env for php-source, however GDB does not hit breakpoints.

I tried both VScode UI and GDB. Both say that module is not loaded.

No source file named /home/www/spx-src/src/spx_php.c.
Make breakpoint pending on future shared library load?

Selection_211

In case of VScode it shows message below and never hits breakpoints.

Module containing this breakpoint has not yet loaded or the breakpoint address could not be obtained.

But some mentions of spx.so are seen in stack trace with unknown source.

So only those that were set on core php are hit Selection_212

As a workaround I tried __asm__("int3"); but it's not that convenient

Selection_213

ilnytskyi avatar Nov 30 '22 17:11 ilnytskyi

Adding --enable-debug to ./configure should be enough to build it with debug symbols.

I'm a bit curious, what are you trying to achieve ?

NoiseByNorthwest avatar Nov 30 '22 19:11 NoiseByNorthwest

I wanted to set up dev environment to dig into source code of spx and php, and nothing worked :(

--enable-debug did not work.

Thanks for suggestion, I look through the source a bit more and I think it's because in config.m4 https://github.com/NoiseByNorthwest/php-spx/blob/master/config.m4#L17 the -g flag is missing in CFLAGS

I managed to compile with debug symbols by adding -g there and now it's working. Selection_214

ilnytskyi avatar Dec 01 '22 08:12 ilnytskyi