[php-src] Issue #13115: make abortable zend_error when --enable-debug
| From: | SVGAnimate | Date: | Wed, 10 Jan 2024 13:36:26 +0000 |
| Subject: | [php-src] Issue #13115: make abortable zend_error when --enable-debug | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-246213@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/13115
Author: SVGAnimate
### Description
when zend throws an error. it uses a bailout system to catch the exception.
Example : [zend_alloc.c near line
385](https://github.com/php/php-src/blob/16c1c49f1b9153fab8fb15935ffce1c764a398ae/Zend/zend_alloc.c#L385)
Sometimes the error is caught at a higher level. and we lose the call stack in gdb
Example :
[ext/intl](https://github.com/php/php-src/blob/16c1c49f1b9153fab8fb15935ffce1c764a398ae/ext/intl/collator/collator_class.c#L84)
The abort() function stops the debugger at the point where it was called.
But [abort is never
reached](https://github.com/php/php-src/blob/16c1c49f1b9153fab8fb15935ffce1c764a398ae/Zend/zend.c#L1650)
Do you see any contraindication to doing this kind of thing in zend.c:zend_error_noreturn ?
```C
#if ZEND_DEBUG
char *level = getenv("Z_DEBUG");// $ export Z_DEBUG=fatal-errors
if (level && 0==strcmp(level, "fatal-warnings")) {
abort();//gdb stop
}
#endif
[...]
va_end(args);
/* Should never reach this. */
abort();
```
Perhaps there is an existing solution so that the debugger stops where the error occurs?