This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Using stabs rather than dwarf2 (with Ada)
- From: Duncan Sands <duncan dot sands at math dot u-psud dot fr>
- To: gcc-help at gcc dot gnu dot org
- Date: Mon, 23 Feb 2004 22:36:29 +0100
- Subject: Using stabs rather than dwarf2 (with Ada)
I am playing with gcc from CVS, in particular the Ada frontend,
on an x86 linux box. Question: how to have -g use stabs by default?
The default debugging format is dwarf2. However with some
programs I get the following kind of error in gdb:
Die: DW_TAG_subrange_type (abbrev = 5, offset = 11562)
has children: FALSE
attributes:
DW_AT_name (DW_FORM_string) string: "system__tasking__task_entry_index___XDLU_0__2147483647"
DW_AT_lower_bound (DW_FORM_data1) constant: 0
DW_AT_upper_bound (DW_FORM_data4) constant: 2147483647
DW_AT_type (DW_FORM_ref4) constant: 1046
Dwarf Error: Cannot find type of die [in module /home/duncan/tmp/dbg2]
I thought I would try stabs instead, but this is not so easy: if I build gcc
with --with-stabs, still dwarf2 is produced when -g is used (the logic in gcc.c
is:
# define ASM_DEBUG_SPEC \
(PREFERRED_DEBUGGING_TYPE == DBX_DEBUG \
? "%{gdwarf-2*:--gdwarf2}%{!gdwarf-2*:%{g*:--gstabs}}" \
: "%{gstabs*:--gstabs}%{!gstabs*:%{g*:--gdwarf2}}")
which seems to be backwards: if you prefer stabs (dbx_debug) then use
dwarf2! But maybe I am reading it wrong). I can compile using -gstabs
instead of -g of course, but it is a pain. In any case, I still get dwarf2
problems because some of the Ada library seems to be compiled using -g
(I changed most of the uses of -g into -gstabs but there still seem to be
some left). So I would like -g to mean -gstabs, so as to have no dwarf2
at all. Does anyone know how to do this?
Thanks,
Duncan.