summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorherman ten brugge <hermantenbrugge@home.nl>2023-11-08 19:52:13 +0100
committerherman ten brugge <hermantenbrugge@home.nl>2023-11-08 19:52:13 +0100
commit0f29dbcfd5925f49501e8fb90509fd95a1bddb8c (patch)
treeb32e6218121bd8fbb401bdd8fb9b60957d606366
parentbf928f3f4f831297900143b2bd1a833d48ae3744 (diff)
Update do_debug handling
Make options '-g -b' and '-b -g' set -g2 in both cases.
-rw-r--r--libtcc.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/libtcc.c b/libtcc.c
index 164f140..71b8d36 100644
--- a/libtcc.c
+++ b/libtcc.c
@@ -1972,7 +1972,7 @@ dorun:
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
@@ -1989,8 +1989,7 @@ dorun:
} 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;