|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #63188 Display class name when debugging with gdb macro zbacktrace
Submitted: 2012-09-29 19:17 UTC Modified: 2012-10-01 03:32 UTC
From: Assigned: stas (profile)
Status: Closed Package: Unknown/Other Function
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
 [2012-09-29 19:17 UTC]
For example, an uncatched exception backtrace and debug_backtrace()
 have class name if it's an method. but when debugging with gdb,
the macro zbacktrace and dump_bt didn't display it.

it would be easier to debug if the class name displayed

just like:
Fatal error: Uncaught exception 'Exception' with message 'NO' in 
Stack trace:
#0 /Users/reeze/Opensource/php-test/php-src-5.4/b.php(9): A::bar()
#1 /Users/reeze/Opensource/php-test/php-src-5.4/b.php(15): A->foo(1)
#2 /Users/reeze/Opensource/php-test/php-src-5.4/b.php(20): B->foo(1)
#3 {main}
  thrown in /Users/reeze/Opensource/php-test/php-src-5.4/b.php on line 5

Test script:

class A {
    static function bar() {
        core_me(''); // it will core
    function foo($param) {

class B extends A {
    function foo($param) {

$b = new B();

Expected result:
[0x100ca4490] core_me("") /Users/reeze/Opensource/php-test/php-src-
[0x100ca43a8] A::bar() /Users/reeze/Opensource/php-test/php-src-5.4/b.php:8 
[0x100ca42b8] A->foo(1) /Users/reeze/Opensource/php-test/php-src-5.4/b.php:14 
[0x100ca40e8] B->foo(1) /Users/reeze/Opensource/php-test/php-src-5.4/b.php:19 

Actual result:
[0x100ca4490] core_me("") /Users/reeze/Opensource/php-test/php-src-
[0x100ca43a8] bar() /Users/reeze/Opensource/php-test/php-src-5.4/b.php:8 
[0x100ca42b8] foo(1) /Users/reeze/Opensource/php-test/php-src-5.4/b.php:14 
[0x100ca40e8] foo(1) /Users/reeze/Opensource/php-test/php-src-5.4/b.php:19 


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2012-09-29 19:22 UTC]
A patch was sent here:
 [2012-09-30 15:51 UTC]
1. it's not a good idea to make 'zbacktrace' require a running process.
2. and why need this? there are file/line/method already
 [2012-09-30 17:54 UTC]
Hi Laruence,

1. Hmm, it is, if build with zts zbacktrace need running process,
   I know it's another problem:) dump_bt didn't before, that could be fixed
   I will update that to not require running process.

2. It would be easier to debug, such as test script, if there are inherent
   or the same function/method name, method's backtrace are the same as normal
   function. if there are class name, we will not need to check them one by one:)
 [2012-10-01 03:32 UTC]
The fix for this bug has been committed.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at

 For Windows:
Thank you for the report, and for helping us make PHP better.

 [2012-10-01 03:32 UTC]
-Status: Open +Status: Closed -Assigned To: +Assigned To: stas
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Wed Sep 23 04:01:25 2020 UTC