tccgen.c: - In tcc_get_debug_info mask VT_STORAGE instead of VT_EXTERN | VT_STATIC - New function tcc_debug_typedef - Call tcc_debug_typedef in decl0
Unified · Split
| @@ -496,7 +496,7 @@ static void tcc_get_debug_info(TCCState *s1, Sym *s, CString *result) · 495 unmodified lines | ||
| 496 | 496 | CString str; |
| 497 | 497 | |
| 498 | 498 | for (;;) { |
| 499 | − type = t->type.t & ~(VT_EXTERN | VT_STATIC | VT_CONSTANT | VT_VOLATILE); | |
| 499 | + type = t->type.t & ~(VT_STORAGE | VT_CONSTANT | VT_VOLATILE); | |
| 500 | 500 | if ((type & VT_BTYPE) != VT_BYTE) |
| 501 | 501 | type &= ~VT_DEFSIGN; |
| 502 | 502 | if (type == VT_PTR || type == (VT_PTR | VT_ARRAY)) |
| @@ -586,7 +586,7 @@ static void tcc_get_debug_info(TCCState *s1, Sym *s, CString *result) · 83 unmodified lines | ||
| 586 | 586 | cstr_printf (result, "%d=", ++debug_next_type); |
| 587 | 587 | t = s; |
| 588 | 588 | for (;;) { |
| 589 | − type = t->type.t & ~(VT_EXTERN | VT_STATIC | VT_CONSTANT | VT_VOLATILE); | |
| 589 | + type = t->type.t & ~(VT_STORAGE | VT_CONSTANT | VT_VOLATILE); | |
| 590 | 590 | if ((type & VT_BTYPE) != VT_BYTE) |
| 591 | 591 | type &= ~VT_DEFSIGN; |
| 592 | 592 | if (type == VT_PTR) |
| @@ -666,6 +666,19 @@ static void tcc_debug_extern_sym(TCCState *s1, Sym *sym, int sh_num, int sym_bin · 73 unmodified lines | ||
| 666 | 666 | cstr_free (&str); |
| 667 | 667 | } |
| 668 | 668 | |
| 669 | +static void tcc_debug_typedef(TCCState *s1, Sym *sym) | |
| 670 | +{ | |
| 671 | + CString str; | |
| 672 | + | |
| 673 | + cstr_new (&str); | |
| 674 | + cstr_printf (&str, "%s:t", | |
| 675 | + (sym->v & ~SYM_FIELD) >= SYM_FIRST_ANOM | |
| 676 | + ? "" : get_tok_str(sym->v & ~SYM_FIELD, NULL)); | |
| 677 | + tcc_get_debug_info(s1, sym, &str); | |
| 678 | + tcc_debug_stabs(s1, str.data, N_LSYM, 0, NULL, 0); | |
| 679 | + cstr_free (&str); | |
| 680 | +} | |
| 681 | + | |
| 669 | 682 | /* put end of translation unit info */ |
| 670 | 683 | ST_FUNC void tcc_debug_end(TCCState *s1) |
| 671 | 684 | { |
| @@ -8418,6 +8431,8 @@ found: · 7746 unmodified lines | ||
| 8418 | 8431 | } |
| 8419 | 8432 | sym->a = ad.a; |
| 8420 | 8433 | sym->f = ad.f; |
| 8434 | + if (tcc_state->do_debug) | |
| 8435 | + tcc_debug_typedef (tcc_state, sym); | |
| 8421 | 8436 | } else if ((type.t & VT_BTYPE) == VT_VOID |
| 8422 | 8437 | && !(type.t & VT_EXTERN)) { |
| 8423 | 8438 | tcc_error("declaration of void object"); |