Posted to tcl by auriocus at Wed Jun 18 20:08:21 GMT 2014view raw

  1. The code is:
  2.  
  3. source tcc4tcl.tcl
  4. tcc4tcl::cproc triple {int i} int { return i*3; }
  5. puts "after compilation"
  6. triple 42
  7.  
  8. After compilation is never reached
  9.  
  10. Apfelkiste:tcc4tcl-0.17 chris$ gdb --args wish86 crash.tcl
  11. GNU gdb 6.3.50-20050815 (Apple version gdb-1824) (Wed Feb 6 22:51:23 UTC 2013)
  12. Copyright 2004 Free Software Foundation, Inc.
  13. GDB is free software, covered by the GNU General Public License, and you are
  14. welcome to change it and/or distribute copies of it under certain conditions.
  15. Type "show copying" to see the conditions.
  16. There is absolutely no warranty for GDB. Type "show warranty" for details.
  17. This GDB was configured as "x86_64-apple-darwin"...Reading symbols for shared libraries ............ done
  18.  
  19. (gdb) r
  20. Starting program: /Users/chris/bin/wish86 crash.tcl
  21. Reading symbols for shared libraries +++++++++++........................................................................................................................................... done
  22. Reading symbols for shared libraries . done
  23.  
  24. Program received signal EXC_BAD_ACCESS, Could not access memory.
  25. Reason: KERN_PROTECTION_FAILURE at address: 0x00007fff815689f9
  26. tcc_compile (s1=0x105008600) at libtcc.c:795
  27. 795 parse_flags = PARSE_FLAG_PREPROCESS | PARSE_FLAG_TOK_NUM;
  28. (gdb) bt
  29. #0 tcc_compile (s1=0x105008600) at libtcc.c:795
  30. #1 0x0000000100786ca2 in tcc_compile_string (s=0x105008600, str=0x103879610 "\n#include <tcl.h>\nstatic int\nc_triple(int i) {\n return i*3; }\n\n\nint Cmd_N4__triple (ClientData dummy,Tcl_Interp *ip,int objc,Tcl_Obj *CONST objv[]) {\n int _i;\n int rv;\n if (objc != 2) {\n Tcl_Wro"...) at libtcc.c:832
  31. #2 0x0000000100784e69 in Tcc4tclHandleCmd (cdata=0x103823190, interp=0x102824610, objc=3, objv=0x1028325a0) at tcc4tcl.c:164
  32. #3 0x00000001000d50b6 in TclNRRunCallbacks ()
  33. #4 0x00000001000d5978 in TclEvalEx ()
  34. #5 0x00000001001711e4 in Tcl_FSEvalFileEx ()
  35. #6 0x0000000100176916 in Tcl_MainEx ()
  36. #7 0x0000000100002b78 in main ()
  37. Current language: auto; currently minimal
  38. (gdb) bt full
  39. #0 tcc_compile (s1=0x105008600) at libtcc.c:795
  40. define_start = (Sym *) 0x10500dd50
  41. pvtop = (SValue *) 0x10500e400
  42. buf = "\000p.\000\001\000\000\000p??\004\001\000\000\000\000?.\000\001\000\000\000\000?.\000\001\000\000\000p?_?\000\000???\004\001\000\000\000????????r??\004\001\000\000\000\000p.\000\001\000\000\000\020??\004\001\000\000\000\000?.\000\001\000\000\000\000?.\000\001\000\000\000??_?\000\000p??\004\001\000\000\000??_?\000\000\001\000\000\000\000\000\000\000P?_?\000\000~e???\000\000????????\024??\004\001\000\000\000\003\020\000\000\000\000????\000\000\000\000\000\000\000?_?\000\000?t???\000\000\020?_?\000\000"...
  43. section_sym = 0
  44. #1 0x0000000100786ca2 in tcc_compile_string (s=0x105008600, str=0x103879610 "\n#include <tcl.h>\nstatic int\nc_triple(int i) {\n return i*3; }\n\n\nint Cmd_N4__triple (ClientData dummy,Tcl_Interp *ip,int objc,Tcl_Obj *CONST objv[]) {\n int _i;\n int rv;\n if (objc != 2) {\n Tcl_Wro"...) at libtcc.c:832
  45. len = 414
  46. ret = 0
  47. #2 0x0000000100784e69 in Tcc4tclHandleCmd (cdata=0x103823190, interp=0x102824610, objc=3, objv=0x1028325a0) at tcc4tcl.c:164
  48. i = 0
  49. options = {0x1007b3f97 "add_include_path", 0x1007b3fa8 "add_file", 0x1007b3fb1 "add_library", 0x1007b3fbd "add_library_path", 0x1007b3fce "add_symbol", 0x1007b3fd9 "command", 0x1007b3fe1 "compile", 0x1007b3fe9 "define", 0x1007b3ff0 "get_symbol", 0x1007b3ffb "output_file", 0x1007b4007 "undefine", 0x0}
  50. val = 4354027776
  51. val_p = (void *) 0x1028325c0
  52. index = 6
  53. res = 42149280
  54. ts = (struct TclTCCState *) 0x103823190
  55. s = (TCCState *) 0x105008600
  56. sym_addr = (Tcl_Obj *) 0x3
  57. #3 0x00000001000d50b6 in TclNRRunCallbacks ()
  58. No symbol table info available.
  59. #4 0x00000001000d5978 in TclEvalEx ()
  60. No symbol table info available.
  61. #5 0x00000001001711e4 in Tcl_FSEvalFileEx ()
  62. No symbol table info available.
  63. #6 0x0000000100176916 in Tcl_MainEx ()
  64. No symbol table info available.
  65. #7 0x0000000100002b78 in main ()
  66. No symbol table info available.
  67. (gdb)
  68.