tinycc-devel
[Top][All Lists]
Advanced

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

[Tinycc-devel] gdb problems [make tcc reentrant]


From: Herman ten Brugge
Subject: [Tinycc-devel] gdb problems [make tcc reentrant]
Date: Fri, 13 Dec 2019 09:29:48 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2

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();




reply via email to

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