Skip to content

Commit

Permalink
Update do_debug handling
Browse files Browse the repository at this point in the history
Make options '-g -b' and '-b -g' set -g2 in both cases.
  • Loading branch information
hermantb committed Nov 8, 2023
1 parent bf928f3 commit 0f29dbc
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions libtcc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1972,7 +1972,7 @@ PUB_FUNC int tcc_parse_args(TCCState *s, int *pargc, char ***pargv, int optind)
s->rt_num_callers = atoi(optarg); /* zero = default (6) */
enable_backtrace:
s->do_backtrace = 1;
s->do_debug = 1;
s->do_debug = s->do_debug ? s->do_debug : 1;
s->dwarf = DWARF_VERSION;
break;
#ifdef CONFIG_TCC_BCHECK
Expand All @@ -1989,8 +1989,7 @@ PUB_FUNC int tcc_parse_args(TCCState *s, int *pargc, char ***pargv, int optind)
} else if (isnum(*optarg)) {
x = *optarg - '0';
/* -g0 = no info, -g1 = lines/functions only, -g2 = full info */
if (x <= 2)
s->do_debug = x;
s->do_debug = x > 2 ? 2 : x == 0 && s->do_backtrace ? 1 : x;
#ifdef TCC_TARGET_PE
} else if (0 == strcmp(".pdb", optarg)) {
s->dwarf = 5, s->do_debug |= 16;
Expand Down

0 comments on commit 0f29dbc

Please sign in to comment.