History

libtcc: Activate DWARF debug infos with tcc -gdwarf ...

This fixes the bug that "tcc -gdwarf ..." still creates the stab debug infos, when tcc was build without using DWARF debug infos by default (configure option: --dwarf=x) -- Regards ... Detlef

Detlef Riekenberg committed 4 years ago

Commit c51236e1 parent 2acf65f2 files · +12 −3Browse files

Unified · Split

2 files
  1. libtcc.c +4 −3
  2. tcc.h +8 −0
libtcc.c+4−3
@@ -1867,9 +1867,10 @@ reparse: · 1866 unmodified lines
18671867 #endif
18681868 case TCC_OPTION_g:
18691869 s->do_debug = 1;
1870− s->dwarf = DWARF_VERSION;
1871− if (strstart("dwarf-", &optarg))
1872− s->dwarf = atoi(optarg);
1870+ s->dwarf = DWARF_VERSION;
1871+
1872+ if (strstart("dwarf", &optarg))
1873+ s->dwarf = (*optarg) ? (0 - atoi(optarg)) : DEFAULT_DWARF_VERSION;
18731874 break;
18741875 case TCC_OPTION_c:
18751876 x = TCC_OUTPUT_OBJ;
tcc.h+8−0
@@ -1815,10 +1815,18 @@ ST_FUNC void tcc_tcov_reset_ind(TCCState *s1); · 1814 unmodified lines
18151815 #define dwarf_str_section s1->dwarf_str_section
18161816 #define dwarf_line_str_section s1->dwarf_line_str_section
18171817
1818+/* default dwarf version for "-g". use 0 to emit stab debug infos */
18181819 #ifndef DWARF_VERSION
18191820 # define DWARF_VERSION 0
18201821 #endif
18211822
1823+/* default dwarf version for "-gdwarf" */
1824+#ifdef TCC_TARGET_MACHO
1825+# define DEFAULT_DWARF_VERSION 2
1826+#else
1827+# define DEFAULT_DWARF_VERSION 5
1828+#endif
1829+
18221830 #if defined TCC_TARGET_PE
18231831 # define R_DATA_32DW 'Z' /* fake code to avoid DLL relocs */
18241832 #elif defined TCC_TARGET_X86_64

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t