Here is what tcc gives me: $ tcc -g -rdynamic tcc-bt.c -o tcc-bt && ./tcc-bt ./tcc-bt(show_bt+0x22) [0x40079c]
Here is the output of gcc compiled binary: $ gcc -g -rdynamic tcc-bt.c -o gcc-bt && ./gcc-bt ./gcc-bt(_start+0x29) [0x400849] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0) [0x7fe80c15c830] ./gcc-bt(main+0xe) [0x400a03] ./gvc-bt(a+0xe) [0x4009f2] ./gcc-bt(b+0xe) [0x4009e1] ./gcc-bt(c+0xe) [0x4009d0] ./gcc-bt(show_bt+0x2e) [0x400944] 2018-03-09 17:24 GMT+05:45 Yakov <[email protected]>: > Just installed 0.27, issue stands. > > > 2018-03-09 15:25 GMT+05:45 Yakov <[email protected]>: > >> I had to write this code to be able to get the stack trace under TinyC: >> >> >> #ifdef __TINYC__int backtrace(void **buffer, int size) { >> extern uint64_t *__libc_stack_end; >> uint64_t **p, *bp, *frame; >> asm ("mov %%rbp, %0;" : "=r" (bp)); >> p = (uint64_t**) bp; >> int i = 0; >> while (i < size) { >> frame = p[0]; >> if (frame < bp || frame > __libc_stack_end) { >> return i; >> } >> buffer[i++] = p[1]; >> p = (uint64_t**) frame; >> } >> return i;}#endif >> >> >> >> 2018-03-09 15:24 GMT+05:45 Yakov <[email protected]>: >> >>> >>> >>> *#include* <execinfo.h> >>> *#include* <stdio.h> >>> >>> *void* show_bt*() {* >>> *int* n; >>> *void* *buffer*[**111];* >>> *char* **strings*;* >>> n *=* backtrace*(*buffer*,* *111);* >>> strings *=* backtrace_symbols*(*buffer*,* n*);* >>> *while* *(*strings *&&* n*)* printf("%s\n"*,* strings*[*n*---*1*]);* >>> *}* >>> >>> *void* c*()* *{* show_bt*(); }* >>> *void* b*()* *{* c*(); }* >>> *void* a*()* *{* b*(); }* >>> *int* main*()* *{* a*(); }* >>> >>> >>> >>> The above code does not work on Tiny. Although works on GCC/Clang for me. >>> >>> >>> >>> *$ tcc -versiontcc version 0.9.26 (x86-64 Linux)* >>> >>> >>> I have tried to no avail:* "-bt 100", "-g", "-rdynamic"*, also tried to >>> link with gcc and ld. >>> >>> >> >
_______________________________________________ Tinycc-devel mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/tinycc-devel
