-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Add GDB pretty-printers for zend_string, zend_type #13463
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Thank you! One small question, does this work to print DNF types? |
Yes it does. Here is what it looks like for
|
Thank you! Would be nice to add support for ASTs and op_arrays at some point. |
That would be super useful indeed. I've added one for |
Probably redundant to print the string twice for zend_string (once at start and once for val) Also question: Can this sourcing be added directly to .gdbinit, so that sourcing the .gdbinit also loads this python file? (I don't know anything about the details of this) |
I've updated the string pretty printer to not print the string twice.
We can add Python autoloading searches in the same way. The only reliable way to load |
Embedding .gdbinit / .gdb.py sounds very interesting to me. The files are relatively small ... and it saves me to always either manually load it (to the point that it annoys me) or set it up in the env ... which is annoying if these are various production envs sometimes. |
It will look into this, then :) (in a separate PR) |
I'm going to merge this in a few days unless there are objections |
This adds GDB pretty-printers for
zend_string
,zend_type
.This can be used by loading
.gdb.py
withand then printing any
zend_string
orzend_type
.Note that this activates when printing values, and not pointers, so we need to dereference pointers (e.g.
p *str
).I initially tried to implement a GDB macro for printing types in
.gdbinit
, but the lack of variable scope makes it difficult.Printing
zend_string
was already possible with theprint_zstr
macro.Borrowed some ideas from https://github.com/chromium/chromium/blob/8cd1e07328b9f30fb369f40d754ce3c4e7eeeb0c/tools/gdb/gdb_chrome.py.