tcc -g1 : small debug info (lines/functions only)
This commit is contained in:
parent
452045422b
commit
8c5fe87665
4 changed files with 24 additions and 15 deletions
|
@ -84,7 +84,7 @@ $(X)%.o : %.S
|
||||||
$(TOP)/%.o : %.c
|
$(TOP)/%.o : %.c
|
||||||
$S$(XCC) -c $< -o $@ $(XFLAGS)
|
$S$(XCC) -c $< -o $@ $(XFLAGS)
|
||||||
|
|
||||||
$(TOP)/bcheck.o : XFLAGS += -g $(if $(CONFIG_musl),-DTCC_MUSL)
|
$(TOP)/bcheck.o : XFLAGS += -bt $(if $(CONFIG_musl),-DTCC_MUSL)
|
||||||
$(TOP)/bt-exe.o : $(TOP)/tccrun.c
|
$(TOP)/bt-exe.o : $(TOP)/tccrun.c
|
||||||
|
|
||||||
$(X)crt1w.o : crt1.c
|
$(X)crt1w.o : crt1.c
|
||||||
|
|
22
libtcc.c
22
libtcc.c
|
@ -1959,29 +1959,33 @@ dorun:
|
||||||
break;
|
break;
|
||||||
#ifdef CONFIG_TCC_BACKTRACE
|
#ifdef CONFIG_TCC_BACKTRACE
|
||||||
case TCC_OPTION_bt:
|
case TCC_OPTION_bt:
|
||||||
s->rt_num_callers = atoi(optarg);
|
s->rt_num_callers = atoi(optarg); /* zero = default (6) */
|
||||||
|
enable_backtrace:
|
||||||
s->do_backtrace = 1;
|
s->do_backtrace = 1;
|
||||||
s->do_debug = 1;
|
s->do_debug = 1;
|
||||||
s->dwarf = DWARF_VERSION;
|
s->dwarf = DWARF_VERSION;
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
#ifdef CONFIG_TCC_BCHECK
|
#ifdef CONFIG_TCC_BCHECK
|
||||||
case TCC_OPTION_b:
|
case TCC_OPTION_b:
|
||||||
s->do_bounds_check = 1;
|
s->do_bounds_check = 1;
|
||||||
s->do_backtrace = 1;
|
goto enable_backtrace;
|
||||||
s->do_debug = 1;
|
#endif
|
||||||
s->dwarf = DWARF_VERSION;
|
|
||||||
break;
|
|
||||||
#endif
|
#endif
|
||||||
case TCC_OPTION_g:
|
case TCC_OPTION_g:
|
||||||
s->do_debug = 1;
|
s->do_debug = 2;
|
||||||
s->dwarf = DWARF_VERSION;
|
s->dwarf = DWARF_VERSION;
|
||||||
if (strstart("dwarf", &optarg))
|
if (strstart("dwarf", &optarg)) {
|
||||||
s->dwarf = (*optarg) ? (0 - atoi(optarg)) : DEFAULT_DWARF_VERSION;
|
s->dwarf = (*optarg) ? (0 - atoi(optarg)) : DEFAULT_DWARF_VERSION;
|
||||||
|
} else if (isnum(*optarg)) {
|
||||||
|
x = *optarg - '0';
|
||||||
|
/* -g0 = no info, -g1 = lines/functions only, -g2 = full info */
|
||||||
|
if (x <= 2)
|
||||||
|
s->do_debug = x;
|
||||||
#ifdef TCC_TARGET_PE
|
#ifdef TCC_TARGET_PE
|
||||||
else if (0 == strcmp(".pdb", optarg))
|
} else if (0 == strcmp(".pdb", optarg)) {
|
||||||
s->dwarf = 5, s->do_debug |= 16;
|
s->dwarf = 5, s->do_debug |= 16;
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case TCC_OPTION_c:
|
case TCC_OPTION_c:
|
||||||
x = TCC_OUTPUT_OBJ;
|
x = TCC_OUTPUT_OBJ;
|
||||||
|
|
13
tccdbg.c
13
tccdbg.c
|
@ -1245,8 +1245,9 @@ ST_FUNC void tcc_debug_fix_anon(TCCState *s1, CType *t)
|
||||||
{
|
{
|
||||||
int i, j, debug_type;
|
int i, j, debug_type;
|
||||||
|
|
||||||
if (!s1->do_debug || !s1->dwarf || debug_info)
|
if (!(s1->do_debug & 2) || !s1->dwarf || debug_info)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ((t->t & VT_BTYPE) == VT_STRUCT && t->ref->c != -1)
|
if ((t->t & VT_BTYPE) == VT_STRUCT && t->ref->c != -1)
|
||||||
for (i = 0; i < n_debug_anon_hash; i++)
|
for (i = 0; i < n_debug_anon_hash; i++)
|
||||||
if (t->ref == debug_anon_hash[i].type) {
|
if (t->ref == debug_anon_hash[i].type) {
|
||||||
|
@ -1789,8 +1790,10 @@ static void tcc_debug_finish (TCCState *s1, struct _debug_info *cur)
|
||||||
ST_FUNC void tcc_add_debug_info(TCCState *s1, int param, Sym *s, Sym *e)
|
ST_FUNC void tcc_add_debug_info(TCCState *s1, int param, Sym *s, Sym *e)
|
||||||
{
|
{
|
||||||
CString debug_str;
|
CString debug_str;
|
||||||
if (!s1->do_debug)
|
|
||||||
|
if (!(s1->do_debug & 2))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
cstr_new (&debug_str);
|
cstr_new (&debug_str);
|
||||||
for (; s != e; s = s->prev) {
|
for (; s != e; s = s->prev) {
|
||||||
if (!s->v || (s->r & VT_VALMASK) != VT_LOCAL)
|
if (!s->v || (s->r & VT_VALMASK) != VT_LOCAL)
|
||||||
|
@ -1931,8 +1934,9 @@ ST_FUNC void tcc_debug_funcend(TCCState *s1, int size)
|
||||||
|
|
||||||
ST_FUNC void tcc_debug_extern_sym(TCCState *s1, Sym *sym, int sh_num, int sym_bind, int sym_type)
|
ST_FUNC void tcc_debug_extern_sym(TCCState *s1, Sym *sym, int sh_num, int sym_bind, int sym_type)
|
||||||
{
|
{
|
||||||
if (!s1->do_debug)
|
if (!(s1->do_debug & 2))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (sym_type == STT_FUNC || sym->v >= SYM_FIRST_ANOM)
|
if (sym_type == STT_FUNC || sym->v >= SYM_FIRST_ANOM)
|
||||||
return;
|
return;
|
||||||
if (s1->dwarf) {
|
if (s1->dwarf) {
|
||||||
|
@ -1984,8 +1988,9 @@ ST_FUNC void tcc_debug_extern_sym(TCCState *s1, Sym *sym, int sh_num, int sym_bi
|
||||||
|
|
||||||
ST_FUNC void tcc_debug_typedef(TCCState *s1, Sym *sym)
|
ST_FUNC void tcc_debug_typedef(TCCState *s1, Sym *sym)
|
||||||
{
|
{
|
||||||
if (!s1->do_debug)
|
if (!(s1->do_debug & 2))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (s1->dwarf) {
|
if (s1->dwarf) {
|
||||||
int debug_type;
|
int debug_type;
|
||||||
|
|
||||||
|
|
|
@ -156,7 +156,7 @@ call :makelib %T%
|
||||||
@if errorlevel 1 goto :the_end
|
@if errorlevel 1 goto :the_end
|
||||||
@if exist %PX%-tcc.exe call :makelib %TX%
|
@if exist %PX%-tcc.exe call :makelib %TX%
|
||||||
@if errorlevel 1 goto :the_end
|
@if errorlevel 1 goto :the_end
|
||||||
.\tcc -m%T% -c ../lib/bcheck.c -o lib/bcheck.o -g
|
.\tcc -m%T% -c ../lib/bcheck.c -o lib/bcheck.o -bt
|
||||||
.\tcc -m%T% -c ../lib/bt-exe.c -o lib/bt-exe.o
|
.\tcc -m%T% -c ../lib/bt-exe.c -o lib/bt-exe.o
|
||||||
.\tcc -m%T% -c ../lib/bt-log.c -o lib/bt-log.o
|
.\tcc -m%T% -c ../lib/bt-log.c -o lib/bt-log.o
|
||||||
.\tcc -m%T% -c ../lib/bt-dll.c -o lib/bt-dll.o
|
.\tcc -m%T% -c ../lib/bt-dll.c -o lib/bt-dll.o
|
||||||
|
|
Loading…
Add table
Reference in a new issue