Skip to content
  • gr's avatar
    tccrun.c: standalone backtraces with -bt[N] or -b · ef42295f
    gr authored
    This makes it possible to get backtraces with executables
    (including DLLs/SOs) like we had it already with -g -run.
    Option -b includes -bt, and -bt includes -g.
    - new file lib/bt-exe.c: used to link rt_printline and the
      exception handler from tccrun.c into executables/DLLs.
    - new file lib/bt-log.c: provides a function that may be
      called from user code to print out a backtrace with a
      message (currently for i386/x86_64 only):
         int (*tcc_backtrace)(const char *fmt, ...);
      As an extra hack, if 'fmt' is prefixed like "^file.c^..."
      then the backtrace will skip calls from within 'file.c'.
    - new file lib/bt-dll.c:  used on win32 to link the backtrace
      and bcheck functions with the main module at runtime
    - bcheck.c: now uses the tcc_backtrace function from above
    - tccgen.c: minor cleanups
    - tccelf.c: stab sections get SHF_ALLOC for easy access.
      Also in relocate_section(): 64bit relocations for stabs
      in DLLs cannot work.  To find DLL addresses, the DLL base
      is added manually in tccrun.c via rc.prog_base instead.
    - tccpe.c: there are some changes to allow merging sections,
      used to merge .finit_array into .data in the first place.
    - tccpp.c: tcc -run now #defines __TCC_RUN__
      also: refactor a line in tal_realloc that was incompatible
      with bcheck
    - tcctest.c: fixed a problem with r12 which tcc cannot preserve
      as well as gcc does.
    - tests2/112_backtrace.c: test the feature and the bcheck test18
      that previously was in boundtest.c