Make options '-g -b' and '-b -g' set -g2 in both cases.
Unified · Split
| @@ -1972,7 +1972,7 @@ dorun: · 1971 unmodified lines | ||
| 1972 | 1972 | s->rt_num_callers = atoi(optarg); /* zero = default (6) */ |
| 1973 | 1973 | enable_backtrace: |
| 1974 | 1974 | s->do_backtrace = 1; |
| 1975 | − s->do_debug = 1; | |
| 1975 | + s->do_debug = s->do_debug ? s->do_debug : 1; | |
| 1976 | 1976 | s->dwarf = DWARF_VERSION; |
| 1977 | 1977 | break; |
| 1978 | 1978 | #ifdef CONFIG_TCC_BCHECK |
| @@ -1989,8 +1989,7 @@ dorun: · 10 unmodified lines | ||
| 1989 | 1989 | } else if (isnum(*optarg)) { |
| 1990 | 1990 | x = *optarg - '0'; |
| 1991 | 1991 | /* -g0 = no info, -g1 = lines/functions only, -g2 = full info */ |
| 1992 | − if (x <= 2) | |
| 1993 | − s->do_debug = x; | |
| 1992 | + s->do_debug = x > 2 ? 2 : x == 0 && s->do_backtrace ? 1 : x; | |
| 1994 | 1993 | #ifdef TCC_TARGET_PE |
| 1995 | 1994 | } else if (0 == strcmp(".pdb", optarg)) { |
| 1996 | 1995 | s->dwarf = 5, s->do_debug |= 16; |