Posted to tcl by thommey at Fri Nov 05 23:46:02 GMT 2010view raw

  1. /*
  2. test.c:
  3.  
  4. #include <tcl.h>
  5. #include <stdio.h>
  6.  
  7. int main(int argc, char **argv)
  8. {
  9. const char * name;
  10. /* Tcl_FindExecutable((char*) argv[0]); */
  11. name = Tcl_GetNameOfExecutable();
  12. fprintf(stdout, "Hello World\n");
  13. if (name != NULL) {
  14. fprintf(stdout, "The tcl executable is %s\n", name);
  15. } else {
  16. fprintf(stdout, "The tcl executable is null\n");
  17. }
  18. return 0;
  19. }
  20. compiled with gcc -W -Wall -ggdb -o test test.c -ltcl8.5
  21. */
  22.  
  23. (gdb) bt full
  24. #0 0x00000000 in ?? ()
  25. No symbol table info available.
  26. #1 0xb7f83f84 in ThreadStorageGetHashTable (id=0xb7d178d0) at /usr/src/tcl8.5.8/unix/../generic/tclThreadStorage.c:212
  27. index = 38
  28. hPtr = 0xbffff698
  29. isNew = -1209838851
  30. hashTablePtr = 0x0
  31. #2 0xb7f840d4 in TclpThreadDataKeyGet (keyPtr=0xb7fc4e18) at /usr/src/tcl8.5.8/unix/../generic/tclThreadStorage.c:336
  32. hashTablePtr = 0x1
  33. hPtr = 0x0
  34. #3 0xb7f824f1 in Tcl_GetThreadData (keyPtr=0xb7fc4e18, size=4) at /usr/src/tcl8.5.8/unix/../generic/tclThread.c:87
  35. result = 0xb7f824d4
  36. #4 0xb7f8e544 in GetThreadHash (keyPtr=0xb7fc4e18) at /usr/src/tcl8.5.8/unix/../generic/tclUtil.c:2888
  37. tablePtrPtr = 0x0
  38. #5 0xb7f8e902 in TclGetProcessGlobalValue (pgvPtr=0xb7fc4e00) at /usr/src/tcl8.5.8/unix/../generic/tclUtil.c:3065
  39. value = 0x0
  40. cacheMap = 0x1
  41. hPtr = 0xb7ea9fb0
  42. epoch = 0
  43. #6 0xb7f8ea77 in TclGetObjNameOfExecutable () at /usr/src/tcl8.5.8/unix/../generic/tclUtil.c:3156
  44. No locals.
  45. #7 0xb7f8ea94 in Tcl_GetNameOfExecutable () at /usr/src/tcl8.5.8/unix/../generic/tclUtil.c:3185
  46. numBytes = 1
  47. bytes = 0xb7f8ea7d "U\211\345S\203\354$\350.\237\362\377\201\303s\335\002"
  48. #8 0x08048562 in main (argc=1, argv=0xbffffa34) at test.c:8
  49. name = 0xb7e9eff4 "|-\024"
  50.