[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] standalone backtraces

From: Herman ten Brugge
Subject: Re: [Tinycc-devel] standalone backtraces
Date: Sat, 18 Jan 2020 18:11:51 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1

Thanks for doing this. This was indeed needed.

There are 2 problems I see.

The first one is that you removed the alloca/vla code for bounds checking.
The following program:

extern void *alloca(int size);
void tst1(void) { void *a = alloca(16); }
void tst2(void) { int i; int a[10]; for (i=0;i<10;i++)a[i]=0; }

int main(void) { tst1(); tst2(); }

When compiled with bounds checking it fails. The alloca
is not deleted because no __bound_local_delete is generated.
The original code in tccgen.c created a dummy lbounds section
so that __bound_local_new(not needed) and __bound_local_delete
were generated.
For the same reason the tests/tests2/79_vla_continue.c fails when
compiled with bounds checking.

The other problem is that testcase 112 produces on linux:
# ./tcc -b -dt 112_backtrace.c -o 112_backtrace -Dtest_bcheck_100
# ./112_backtrace
112_backtrace.c:107: at main: BCHECK: 0x7ffed562f6e4 is outside of the region 112_backtrace.c:107: at main: BCHECK: invalid pointer 0x7ffed562f6da, size 0xa in memcpy dest

This looks correct.

But on windows (and wine) I get:
# ./tcc.exe -b -dt 112_backtrace.c -o 112_backtrace.exe -Dtest_bcheck_100
# ./112_backtrace.exe
00401535 : at ???: BCHECK: 000000000022FA84 is outside of the region
00404447 : by ???
00404666 : by ???
112_backtrace.c:107: by main
0040447a : at ???: BCHECK: invalid pointer 000000000022FA7A, size 0xa in memcpy dest
00404666 : by ???
112_backtrace.c:107: by main

All other tests in 112_backtrace.c have simular problems.

Perhaps I did something wrong with windows/wine. I only use windows
to update my tomtom.

The makefile for wine I used is at: https://svn.code.sf.net/p/wintcc/svn



On 2020-01-17 23:21, grischka wrote:
Hi folks,

Thought the entire bcheck stuff is pretty much completely useless
if it doesn't give you any hint where in the your code the problem
actually happens.  So I added some patch of mine that allows tcc to
include the backtrace features for -run into standalone executables.

It should work with DLLs/SOs too (i.e. multiple instances of stab
debug infos).  See


--- grischka

reply via email to

[Prev in Thread] Current Thread [Next in Thread]