Skip to content

Commit 46b6ad6

Browse files
authored
Inline GDB scripts in the PHP binary (php#13600)
This inlines .gdbinit and php_gdb.py in the .debug_gdb_scripts section of the PHP binary so that GDB can auto-load them regardless of the current directory or the availability of the PHP source code (albeit some functionalities of php_gdb.py currently rely on the source being available).
1 parent af5db45 commit 46b6ad6

File tree

6 files changed

+1091
-2
lines changed

6 files changed

+1091
-2
lines changed

.gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
# Collapse generated files within git and pull request diff.
2323
**/*_arginfo.h linguist-generated -diff
24+
/main/gdb_inlined_script.c linguist-generated -diff
2425
/Zend/zend_vm_execute.h linguist-generated -diff
2526
/Zend/zend_vm_handlers.h linguist-generated -diff
2627
/Zend/zend_vm_opcodes.[ch] linguist-generated -diff

.github/actions/verify-generated-files/action.yml

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ runs:
88
[[ "$OSTYPE" == "darwin"* ]] && export PATH="$(brew --prefix)/opt/bison/bin:$PATH"
99
scripts/dev/credits
1010
scripts/dev/genfiles
11+
scripts/gdb/debug_gdb_scripts_gen.php
1112
Zend/zend_vm_gen.php
1213
ext/tokenizer/tokenizer_data_gen.php
1314
build/gen_stub.php -f --generate-optimizer-info --verify

configure.ac

+11
Original file line numberDiff line numberDiff line change
@@ -1700,6 +1700,17 @@ PHP_ADD_SOURCES(main, main.c snprintf.c spprintf.c \
17001700
network.c php_open_temporary_file.c php_odbc_utils.c safe_bcmp.c \
17011701
output.c getopt.c php_syslog.c, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
17021702

1703+
if printf "#if __ELF__\nelf\n#endif\n" | $CC -E - | grep elf > /dev/null; then
1704+
PHP_ADD_SOURCES(main, debug_gdb_scripts.c)
1705+
1706+
cat >> Makefile.objects <<EOF
1707+
$abs_srcdir/main/debug_gdb_scripts.c: $abs_srcdir/scripts/gdb/debug_gdb_scripts_gen.php $abs_srcdir/scripts/gdb/php_gdb.py $abs_srcdir/.gdbinit
1708+
@if test ! -z "\$(PHP)"; then \\
1709+
\$(PHP) $abs_srcdir/scripts/gdb/debug_gdb_scripts_gen.php; \\
1710+
fi;
1711+
EOF
1712+
fi
1713+
17031714
PHP_ADD_SOURCES_X(main, fastcgi.c, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1, PHP_FASTCGI_OBJS, no)
17041715

17051716
PHP_ADD_SOURCES(main/streams, streams.c cast.c memory.c filter.c \

0 commit comments

Comments
 (0)