How can I get PHP to produce a backtrace upon errors?

My script for installing an error handler that produces a backtrace: <?php function process_error_backtrace($errno, $errstr, $errfile, $errline, $errcontext) { if(!(error_reporting() & $errno)) return; switch($errno) { case E_WARNING : case E_USER_WARNING : case E_STRICT : case E_NOTICE : case E_USER_NOTICE : $type=”warning”; $fatal = false; break; default : $type=”fatal error”; $fatal = true; break; } $trace … Read more

Print PHP Call Stack

More readable than debug_backtrace(): $e = new \Exception; var_dump($e->getTraceAsString()); #2 /usr/share/php/PHPUnit/Framework/TestCase.php(626): SeriesHelperTest->setUp() #3 /usr/share/php/PHPUnit/Framework/TestResult.php(666): PHPUnit_Framework_TestCase->runBare() #4 /usr/share/php/PHPUnit/Framework/TestCase.php(576): PHPUnit_Framework_TestResult->run(Object(SeriesHelperTest)) #5 /usr/share/php/PHPUnit/Framework/TestSuite.php(757): PHPUnit_Framework_TestCase->run(Object(PHPUnit_Framework_TestResult)) #6 /usr/share/php/PHPUnit/Framework/TestSuite.php(733): PHPUnit_Framework_TestSuite->runTest(Object(SeriesHelperTest), Object(PHPUnit_Framework_TestResult)) #7 /usr/share/php/PHPUnit/TextUI/TestRunner.php(305): PHPUnit_Framework_TestSuite->run(Object(PHPUnit_Framework_TestResult), false, Array, Array, false) #8 /usr/share/php/PHPUnit/TextUI/Command.php(188): PHPUnit_TextUI_TestRunner->doRun(Object(PHPUnit_Framework_TestSuite), Array) #9 /usr/share/php/PHPUnit/TextUI/Command.php(129): PHPUnit_TextUI_Command->run(Array, true) #10 /usr/bin/phpunit(53): PHPUnit_TextUI_Command::main() #11 {main}”

Activate Stacks only for some specific ETW Tasks in a provider?

Yes, this is possible since Windows 8.1 with the type entry in _EVENT_FILTER_DESCRIPTOR when it is set to EVENT_FILTER_TYPE_STACKWALK when you call EnableTraceEx2. On Windows 8.1,Windows Server 2012 R2, and later, event payload, scope, and stack walk filters can be used by the EnableTraceEx2 function and the ENABLE_TRACE_PARAMETERS and EVENT_FILTER_DESCRIPTOR structures to filter on specific … Read more

Java / Android – How to print out a full stack trace?

The following should do the trick: Log.d(“myapp”, Log.getStackTraceString(new Exception())); Note that …x more at the end does not cut off any information from the stack trace: (This indicates) that the remainder of the stack trace for this exception matches the indicated number of frames from the bottom of the stack trace of the exception that … Read more

(Unknown Source) in Exception stack trace

Note that if you are using Ant build and if the debug attribute set to false in javac command this could happen. ex : if you need proper location in trace set debug = true in Ant build, <javac verbose=”false” srcdir=”${src}” destdir=”${classdir}” debug=”true” includes=”**/*.java”> <classpath refid=”compile.classpath” /> </javac>