Posted to tcl by auriocus at Wed Jun 18 20:08:21 GMT 2014view pretty
The code is: source tcc4tcl.tcl tcc4tcl::cproc triple {int i} int { return i*3; } puts "after compilation" triple 42 After compilation is never reached Apfelkiste:tcc4tcl-0.17 chris$ gdb --args wish86 crash.tcl GNU gdb 6.3.50-20050815 (Apple version gdb-1824) (Wed Feb 6 22:51:23 UTC 2013) Copyright 2004 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "x86_64-apple-darwin"...Reading symbols for shared libraries ............ done (gdb) r Starting program: /Users/chris/bin/wish86 crash.tcl Reading symbols for shared libraries +++++++++++........................................................................................................................................... done Reading symbols for shared libraries . done Program received signal EXC_BAD_ACCESS, Could not access memory. Reason: KERN_PROTECTION_FAILURE at address: 0x00007fff815689f9 tcc_compile (s1=0x105008600) at libtcc.c:795 795 parse_flags = PARSE_FLAG_PREPROCESS | PARSE_FLAG_TOK_NUM; (gdb) bt #0 tcc_compile (s1=0x105008600) at libtcc.c:795 #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 #2 0x0000000100784e69 in Tcc4tclHandleCmd (cdata=0x103823190, interp=0x102824610, objc=3, objv=0x1028325a0) at tcc4tcl.c:164 #3 0x00000001000d50b6 in TclNRRunCallbacks () #4 0x00000001000d5978 in TclEvalEx () #5 0x00000001001711e4 in Tcl_FSEvalFileEx () #6 0x0000000100176916 in Tcl_MainEx () #7 0x0000000100002b78 in main () Current language: auto; currently minimal (gdb) bt full #0 tcc_compile (s1=0x105008600) at libtcc.c:795 define_start = (Sym *) 0x10500dd50 pvtop = (SValue *) 0x10500e400 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"... section_sym = 0 #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 len = 414 ret = 0 #2 0x0000000100784e69 in Tcc4tclHandleCmd (cdata=0x103823190, interp=0x102824610, objc=3, objv=0x1028325a0) at tcc4tcl.c:164 i = 0 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} val = 4354027776 val_p = (void *) 0x1028325c0 index = 6 res = 42149280 ts = (struct TclTCCState *) 0x103823190 s = (TCCState *) 0x105008600 sym_addr = (Tcl_Obj *) 0x3 #3 0x00000001000d50b6 in TclNRRunCallbacks () No symbol table info available. #4 0x00000001000d5978 in TclEvalEx () No symbol table info available. #5 0x00000001001711e4 in Tcl_FSEvalFileEx () No symbol table info available. #6 0x0000000100176916 in Tcl_MainEx () No symbol table info available. #7 0x0000000100002b78 in main () No symbol table info available. (gdb)