debug_tools.qsrc 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. # debug_tools
  2. if $ARGS[0] = 'trace':
  3. if $ARGS[1] = 'loc_change':
  4. if debug['trace_loc_change'] = 0: exit
  5. $debug['trace_line'] = "'<<$curloc>>'"
  6. elseif $ARGS[1] = 'direct':
  7. if arrsize('$trace_locations') = 0: exit
  8. if arrpos("$trace_locations", $ARGS[2]) = -1: exit
  9. $debug['trace_line'] = "'<<$ARGS[2]>>'"
  10. else
  11. exit
  12. end
  13. debug['trace_index'] = 0
  14. :trace_loc_change_loop
  15. if debug['trace_index'] < arrsize("$trace_args"):
  16. if $trace_args[debug['trace_index']] ! '':
  17. $debug['trace_line'] += ", '<<$trace_args[debug['trace_index']]>>'"
  18. elseif trace_args[debug['trace_index']] ! 0:
  19. $debug['trace_line'] += ", <<trace_args[debug['trace_index']]>>"
  20. else
  21. $debug['trace_line'] += ", /DEF"
  22. end
  23. debug['trace_index'] += 1
  24. jump 'trace_loc_change_loop'
  25. end
  26. ! killvar 'call_trace_index'
  27. killvar '$trace_args' & killvar 'trace_args'
  28. $debug['<<$ARGS[1]>>_trace'] += $debug['trace_line'] + '<br>'
  29. ! killvar '$call_trace_line'
  30. if debug['trace_shown'] ! 0: gs 'stat_display'
  31. !?end
  32. elseif $ARGS[0] = 'trace_list_locs':
  33. tmp_i = 0
  34. :list_locs_loop
  35. if tmp_i < arrsize('$trace_locations'):
  36. $tmp_msg += $trace_locations[tmp_i] + '<br>'
  37. tmp_i += 1
  38. jump 'list_locs_loop'
  39. end
  40. msg $tmp_msg
  41. killvar 'tmp_i' & killvar '$tmp_msg'
  42. !?end
  43. elseif $ARGS[0] = 'reset':
  44. $debug['loc_change_trace'] = ''
  45. $debug['direct_trace'] = ''
  46. end
  47. --- debug_tools ---------------------------------