tinycc/tests/tests2/112_backtrace.expect
gr ef42295fe8 tccrun.c: standalone backtraces with -bt[N] or -b
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
2020-01-17 22:58:39 +01:00

165 lines
5.4 KiB
Plaintext

[test_backtrace_1]
* main
* f1()
* f2()
* f3()
112_backtrace.c:9: at f3: RUNTIME ERROR: invalid memory access
112_backtrace.c:14: by f2
112_backtrace.c:19: by f1
112_backtrace.c:24: by main
[returns 255]
[test_bcheck_1]
* main
* f1()
112_backtrace.c:38: at f1: BCHECK: ........ is outside of the region
112_backtrace.c:43: by main
112_backtrace.c:38: at f1: BCHECK: invalid pointer ........, size 0x14 in memmove dest
112_backtrace.c:43: by main
[returns 255]
[test_tcc_backtrace_2]
* main
* f1()
112_backtrace.c:64: at f1: Hello from f1!
112_backtrace.c:70: by main
* f2()
* exit f2
[returns 34]
[test_tcc_backtrace_3]
* main
[returns 1]
[test_bcheck_100]
112_backtrace.c:107: at main: BCHECK: ........ is outside of the region
112_backtrace.c:107: at main: BCHECK: invalid pointer ........, size 0xa in memcpy dest
[returns 255]
[test_bcheck_101]
112_backtrace.c:109: at main: BCHECK: ........ is outside of the region
112_backtrace.c:109: at main: BCHECK: invalid pointer ........, size 0xa in memcpy src
[returns 255]
[test_bcheck_102]
112_backtrace.c:111: at main: BCHECK: overlapping regions ........(0x4), ........(0x4) in memcpy
[returns 255]
[test_bcheck_103]
112_backtrace.c:113: at main: BCHECK: overlapping regions ........(0x4), ........(0x4) in memcpy
[returns 255]
[test_bcheck_104]
112_backtrace.c:115: at main: BCHECK: ........ is outside of the region
112_backtrace.c:115: at main: BCHECK: invalid pointer ........, size 0xa in memcmp s1
[returns 255]
[test_bcheck_105]
112_backtrace.c:117: at main: BCHECK: ........ is outside of the region
112_backtrace.c:117: at main: BCHECK: invalid pointer ........, size 0xa in memcmp s2
[returns 255]
[test_bcheck_106]
112_backtrace.c:119: at main: BCHECK: ........ is outside of the region
112_backtrace.c:119: at main: BCHECK: invalid pointer ........, size 0xa in memmove dest
[returns 255]
[test_bcheck_107]
112_backtrace.c:121: at main: BCHECK: ........ is outside of the region
112_backtrace.c:121: at main: BCHECK: invalid pointer ........, size 0xa in memmove src
[returns 255]
[test_bcheck_108]
112_backtrace.c:123: at main: BCHECK: ........ is outside of the region
112_backtrace.c:123: at main: BCHECK: invalid pointer ........, size 0xa in memset
[returns 255]
[test_bcheck_109]
112_backtrace.c:125: at main: BCHECK: ........ is outside of the region
112_backtrace.c:125: at main: BCHECK: invalid pointer ........, size 0xb in strlen
[returns 255]
[test_bcheck_110]
112_backtrace.c:127: at main: BCHECK: ........ is outside of the region
112_backtrace.c:127: at main: BCHECK: invalid pointer ........, size 0x4 in strcpy dest
[returns 255]
[test_bcheck_111]
112_backtrace.c:129: at main: BCHECK: ........ is outside of the region
112_backtrace.c:129: at main: BCHECK: invalid pointer ........, size 0x4 in strcpy src
[returns 255]
[test_bcheck_112]
112_backtrace.c:131: at main: BCHECK: overlapping regions ........(0x3), ........(0x3) in strcpy
[returns 255]
[test_bcheck_113]
112_backtrace.c:133: at main: BCHECK: overlapping regions ........(0x4), ........(0x4) in strcpy
[returns 255]
[test_bcheck_114]
112_backtrace.c:135: at main: BCHECK: ........ is outside of the region
112_backtrace.c:135: at main: BCHECK: invalid pointer ........, size 0x4 in strncpy dest
[returns 255]
[test_bcheck_115]
112_backtrace.c:137: at main: BCHECK: ........ is outside of the region
112_backtrace.c:137: at main: BCHECK: invalid pointer ........, size 0x4 in strncpy src
[returns 255]
[test_bcheck_116]
112_backtrace.c:139: at main: BCHECK: overlapping regions ........(0x3), ........(0x3) in strncpy
[returns 255]
[test_bcheck_117]
112_backtrace.c:141: at main: BCHECK: overlapping regions ........(0x4), ........(0x4) in strncpy
[returns 255]
[test_bcheck_118]
112_backtrace.c:143: at main: BCHECK: ........ is outside of the region
112_backtrace.c:143: at main: BCHECK: invalid pointer ........, size 0x9 in strcmp s1
[returns 255]
[test_bcheck_119]
112_backtrace.c:145: at main: BCHECK: ........ is outside of the region
112_backtrace.c:145: at main: BCHECK: invalid pointer ........, size 0x9 in strcmp s2
[returns 255]
[test_bcheck_120]
112_backtrace.c:147: at main: BCHECK: ........ is outside of the region
112_backtrace.c:147: at main: BCHECK: invalid pointer ........, size 0x6 in strncmp s1
[returns 255]
[test_bcheck_121]
112_backtrace.c:149: at main: BCHECK: ........ is outside of the region
112_backtrace.c:149: at main: BCHECK: invalid pointer ........, size 0x6 in strncmp s2
[returns 255]
[test_bcheck_122]
112_backtrace.c:151: at main: BCHECK: ........ is outside of the region
112_backtrace.c:151: at main: BCHECK: invalid pointer ........, size 0x6 in strcat dest
[returns 255]
[test_bcheck_123]
112_backtrace.c:153: at main: BCHECK: ........ is outside of the region
112_backtrace.c:153: at main: BCHECK: invalid pointer ........, size 0x6 in strcat src
[returns 255]
[test_bcheck_124]
112_backtrace.c:155: at main: BCHECK: overlapping regions ........(0x9), ........(0x6) in strcat
[returns 255]
[test_bcheck_125]
112_backtrace.c:157: at main: BCHECK: overlapping regions ........(0x4), ........(0x4) in strcat
[returns 255]
[test_bcheck_126]
112_backtrace.c:159: at main: BCHECK: ........ is outside of the region
112_backtrace.c:159: at main: BCHECK: invalid pointer ........, size 0xb in strchr
[returns 255]
[test_bcheck_127]
112_backtrace.c:161: at main: BCHECK: ........ is outside of the region
112_backtrace.c:161: at main: BCHECK: invalid pointer ........, size 0xb in strdup
[returns 255]