https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117696

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Macro info is supposed to be emitted into the early debug, and I can clearly
see .debug_macro in a -g3 -flto built test program.

The issue seems to be that the consumer (gdb) doesn't pick up that macro info.

#define FOO 1
int main() {}

produces the abstract unit with macro info:

 <0><31d>: Abbrev Number: 1 (DW_TAG_compile_unit)
    <31e>   DW_AT_producer    : (indirect string, offset: 0x18d5): GNU C23
15.0.0 20241120 (experimental) -mtune=generic -march=x86-64 -g3 -flto
    <322>   DW_AT_language    : 29      (C11)
    <323>   DW_AT_name        : (indirect line string, offset: 0x2b): t.c
    <327>   DW_AT_comp_dir    : (indirect line string, offset: 0):
/home/rguenther/obj-gcc-g/gcc
    <32b>   DW_AT_stmt_list   : 0x221
    <32f>   DW_AT_macros      : 0
 <1><333>: Abbrev Number: 2 (DW_TAG_subprogram)
    <334>   DW_AT_external    : 1
    <334>   DW_AT_name        : (indirect string, offset: 0x2a7f): main
    <338>   DW_AT_decl_file   : 1
    <339>   DW_AT_decl_line   : 2
    <33a>   DW_AT_decl_column : 5
    <33b>   DW_AT_prototyped  : 1
    <33b>   DW_AT_type        : <0x33f>
 <1><33f>: Abbrev Number: 3 (DW_TAG_base_type)
    <340>   DW_AT_byte_size   : 4
    <341>   DW_AT_encoding    : 5       (signed)
    <342>   DW_AT_name        : int

and the concrete instance unit

 <0><2d7>: Abbrev Number: 1 (DW_TAG_compile_unit)
    <2d8>   DW_AT_producer    : (indirect string, offset: 0x417): GNU GIMPLE
15.
0.0 20241120 (experimental) -mtune=generic -march=x86-64 -g -g3 -fno-openmp
-fno
-openacc -fno-pie -fcf-protection=none -fltrans
    <2dc>   DW_AT_language    : 29      (C11)
    <2dd>   DW_AT_name        : (indirect line string, offset: 0x1e):
<artificia
l>
    <2e1>   DW_AT_comp_dir    : (indirect line string, offset: 0):
/home/rguenth
er/obj-gcc-g/gcc
    <2e5>   DW_AT_low_pc      : 0x400526
    <2ed>   DW_AT_high_pc     : 0xb
    <2f5>   DW_AT_stmt_list   : 0x1d5
 <1><2f9>: Abbrev Number: 2 (DW_TAG_subprogram)
    <2fa>   DW_AT_abstract_origin: <0x333>
    <2fe>   DW_AT_low_pc      : 0x400526
    <306>   DW_AT_high_pc     : 0xb
    <30e>   DW_AT_frame_base  : 1 byte block: 9c        (DW_OP_call_frame_cfa)
    <310>   DW_AT_call_all_calls: 1

but when in context main() in gdb, gdb doesn't look up the macro info
associated with the containing CU.

So the info is there, it's just not picked up ...

Reply via email to