Skip to content
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

[Feature] get where "exit" was called/shutdown started #17505

Open
kkmuffme opened this issue Jan 18, 2025 · 3 comments
Open

[Feature] get where "exit" was called/shutdown started #17505

kkmuffme opened this issue Jan 18, 2025 · 3 comments

Comments

@kkmuffme
Copy link

Description

There currently is no simple way to figure out what/where exit was called.

Since PHP 8.4 PHP is a proper function, however it seems it's xdebug won't break on it, even if set (besides the fact, there's tons of bugs with IDEs/xdebug when breaking on built-in functions, e.g. defined()

Stepping through the code until exit; is reached isn't feasible in all cases (it happens in a long running process, this might take a day...)

It would be great if there were a magic constant similar to __COMPILER_HALT_OFFSET__ that is available in shutdown function callbacks, which includes the last executed file + line in the main thread before shutdown started. But that's just a simple first suggestion, I'm open to everything that makes identifying/debugging this easier.

@iluuu1994
Copy link
Member

Why not propose this as an xdebug feature instead? I don't think there's a technical reason why xdebug cannot intercept exit calls.

@kkmuffme
Copy link
Author

I don't think there's a technical reason why xdebug cannot intercept exit calls.

Afaik bc in < PHP 8.4 exit wasn't an actual function. Not sure if it's possible in PHP 8.4, as I couldn't test that yet.

However this is a common-ish scenario for cases where xdebug isn't easily available.

@iluuu1994
Copy link
Member

Afaik bc in < PHP 8.4 exit wasn't an actual function.

Yes, but it had an ZEND_EXIT opcode that could have been hooked into. With 8.4 being a dedicated function, xdebug may require a different trigger. It's possible this already works, but I don't know xdebug that well. /cc @derickr

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

No branches or pull requests

2 participants