Skip to content

Add print zend string function to gdbinit - #2293

Closed
mhagstrand wants to merge 1 commit into
php:PHP-7.0from
mhagstrand:print_zstr_gdbinit
Closed

mhagstrand wants to merge 1 commit into
php:PHP-7.0from
mhagstrand:print_zstr_gdbinit

Conversation

@mhagstrand

Copy link
Copy Markdown
Contributor

I have been digging around in a core dump and I found having a function to print zend_strings useful.

Usage example:

(gdb) print_zstr 0x7ff967402a50
length (9): "microtime"

@krakjoe

krakjoe commented Jan 9, 2017 via email

Copy link
Copy Markdown
Member

@mhagstrand

Copy link
Copy Markdown
Contributor Author

Yeah, I screwed up and put the PR against the wrong branch.

@mhagstrand

Copy link
Copy Markdown
Contributor Author

It is fixed now.

@mhagstrand mhagstrand changed the title Print zstr gdbinit Add print zend string function to gdbinit Jan 9, 2017
@krakjoe

krakjoe commented Jan 9, 2017

Copy link
Copy Markdown
Member

Can I suggest that it may be better to print as ZE would var_dump it (if it were a zval):

string (%d) "%s"

In that format ?

On a side note, .gdbinit is in very poor shape, having not been updated for ZE3 properly ... not your problem, but if you were looking for something else to do :)

@mhagstrand

Copy link
Copy Markdown
Contributor Author

I think that is a good suggestion, I'll make the update.

When I get a chance I'll dig into cleaning up .gdbinit a bit.

@krakjoe

krakjoe commented Jan 9, 2017

Copy link
Copy Markdown
Member

Don't forget to rebase and squash ;)

@mhagstrand

Copy link
Copy Markdown
Contributor Author

I didn't forget this time =)

Output:

(gdb) print_zstr 0x7ff967402a50
string(9) "microtime"

@nikic

nikic commented Jan 9, 2017

Copy link
Copy Markdown
Member

Merged via 9ad3413, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants