zend_vm_trace_lines.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. +----------------------------------------------------------------------+
  3. | Zend Engine |
  4. +----------------------------------------------------------------------+
  5. | Copyright (c) Zend Technologies Ltd. (http://www.zend.com) |
  6. +----------------------------------------------------------------------+
  7. | This source file is subject to version 2.00 of the Zend license, |
  8. | that is bundled with this package in the file LICENSE, and is |
  9. | available through the world-wide-web at the following url: |
  10. | http://www.zend.com/license/2_00.txt. |
  11. | If you did not receive a copy of the Zend license and are unable to |
  12. | obtain it through the world-wide-web, please send a note to |
  13. | license@zend.com so we can mail you a copy immediately. |
  14. +----------------------------------------------------------------------+
  15. | Authors: Dmitry Stogov <dmitry@php.net> |
  16. +----------------------------------------------------------------------+
  17. */
  18. #include "zend_sort.h"
  19. #define VM_TRACE(op) zend_vm_trace(execute_data, opline);
  20. #define VM_TRACE_START() zend_vm_trace_init();
  21. #define VM_TRACE_END() zend_vm_trace_finish();
  22. static FILE *vm_trace_file;
  23. static void zend_vm_trace(const zend_execute_data *execute_data, const zend_op *opline)
  24. {
  25. if (EX(func) && EX(func)->op_array.filename) {
  26. fprintf(vm_trace_file, "%s:%d\n", ZSTR_VAL(EX(func)->op_array.filename), opline->lineno);
  27. }
  28. }
  29. static void zend_vm_trace_finish(void)
  30. {
  31. fclose(vm_trace_file);
  32. }
  33. static void zend_vm_trace_init(void)
  34. {
  35. vm_trace_file = fopen("zend_vm_trace.log", "w+");
  36. }