After commit  "local scope for types of function parameters" debugging does not work any more.

If I compile:
#include <stdio.h>

int main(void)
{
  printf("Hello World\n");
  return 0;
}

And start gdb and try to set break on main I get:
invalid dwarf2 offset 0xffffffff

If I revert the tccdbg.c change (See attachment) debugging works again.

    Herman
diff --git a/tccdbg.c b/tccdbg.c
index 4fd0150..3e8d582 100644
--- a/tccdbg.c
+++ b/tccdbg.c
@@ -1625,7 +1625,7 @@ static void tcc_get_debug_info(TCCState *s1, Sym *s, 
CString *result)
 
         t = t->type.ref;
        debug_type = tcc_debug_find(s1, t, 0);
-        if (debug_type == -1 && t->c >= 0) {
+        if (debug_type == -1) {
             debug_type = tcc_debug_add(s1, t, 0);
             cstr_new (&str);
             cstr_printf (&str, "%s:T%d=%c%d",
@@ -1664,7 +1664,7 @@ static void tcc_get_debug_info(TCCState *s1, Sym *s, 
CString *result)
         Sym *e = t = t->type.ref;
 
        debug_type = tcc_debug_find(s1, t, 0);
-       if (debug_type == -1 && t->c >= 0) {
+       if (debug_type == -1) {
            debug_type = tcc_debug_add(s1, t, 0);
             cstr_new (&str);
             cstr_printf (&str, "%s:T%d=e",
@@ -1741,7 +1741,7 @@ static int tcc_get_dwarf_info(TCCState *s1, Sym *s)
     if ((type & VT_BTYPE) == VT_STRUCT) {
         t = t->type.ref;
        debug_type = tcc_debug_find(s1, t, 1);
-       if (debug_type == -1 && t->c >= 0) {
+       if (debug_type == -1) {
            int pos_sib = 0, i, *pos_type;
 
            debug_type = tcc_debug_add(s1, t, 1);
@@ -1819,7 +1819,7 @@ static int tcc_get_dwarf_info(TCCState *s1, Sym *s)
     else if (IS_ENUM(type)) {
         t = t->type.ref;
        debug_type = tcc_debug_find(s1, t, 1);
-       if (debug_type == -1 && t->c >= 0) {
+       if (debug_type == -1) {
            int pos_sib, pos_type;
            Sym sym = {0}; sym.type.t = VT_INT | (type & VT_UNSIGNED);
 
_______________________________________________
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to