I don't know if it's the correct fix but the static int clearly introduces an issue with threads and multiple instances of tcc.
-----Original Message----- From: Tinycc-devel [mailto:[email protected]] On Behalf Of Herman ten Brugge via Tinycc-devel Sent: Friday, December 13, 2019 09:30 To: Herman ten Brugge via Tinycc-devel Cc: Herman ten Brugge Subject: [Tinycc-devel] gdb problems [make tcc reentrant] When I try to start gdb on a program called with tcc I get: ../../gdb/buildsym.c:660: internal-error: const char* buildsym_compunit::pop_subfile(): Assertion `!m_subfile_stack.empty ()' failed. I find that the stab section contains an extra entry at start (objdump -G): -1 HdrSym 0 0 0000000000000000 1 0 SO 0 0 0000000000400355 2 1 SO 0 0 0000000000400355 35 2 SLINE 0 1 0000000000000000 0 3 EINCL 0 0 0000000000000000 0 4 SLINE 0 2 0000000000000000 0 5 FUN 0 3 0000000000400355 39 main:F1 The entry 3 is not present before the tcc reentrant commit. I fixed it by the patch below. This makes debugging work again. There is probably a better solution. Regards, Herman diff --git a/tccpp.c b/tccpp.c index 3eb5213..029fd1b 100644 --- a/tccpp.c +++ b/tccpp.c @@ -2631,7 +2631,11 @@ static inline void next_nomacro1(void) /* add end of include file debug info */ if (tcc_state->do_debug) { +static int first = 1; +if (first == 0) { put_stabd(tcc_state, N_EINCL, 0, 0); +} +first = 0; } /* pop include stack */ tcc_close(); _______________________________________________ Tinycc-devel mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/tinycc-devel _______________________________________________ Tinycc-devel mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/tinycc-devel
