[Issue 22590] importC: static functions have no debug information generated for them

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Dec 17 17:48:51 UTC 2021


https://issues.dlang.org/show_bug.cgi?id=22590

Iain Buclaw <ibuclaw at gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |NEW

--- Comment #4 from Iain Buclaw <ibuclaw at gdcproject.org> ---
(In reply to Walter Bright from comment #3)
> Example, please?

*All* static functions.  Just add static to any function and when you step into
it with gdb, all debugging is gone.

Looking at an objdump of a program:
---
 <1><91>: Abbrev Number: 6 (DW_TAG_subprogram)
    <92>   DW_AT_sibling     : <0xde>
    <96>   DW_AT_name        : test.test_static
    <a7>   DW_AT_MIPS_linkage_name: test_static
    <b3>   DW_AT_decl_file   : 1
    <b4>   DW_AT_decl_line   : 2
    <b6>   DW_AT_type        : <0x7c>
    <ba>   DW_AT_pure        : 1
    <bb>   DW_AT_low_pc      : 0x0
    <c3>   DW_AT_high_pc     : 0x17
    <cb>   DW_AT_frame_base  : 0x0 (location list)
---

I only see that DW_AT_MIPS_linkage_name is pointlessly set, as static functions
don't have any linkage.  However removing this tag does not alter the outcome,
so there's something else that's broken here.

This is objdump of gcc compiled program of the same function:
---
 <1><52>: Abbrev Number: 4 (DW_TAG_subprogram)
    <53>   DW_AT_name        : (indirect string, offset: 0x1f): test_static
    <57>   DW_AT_decl_file   : 1
    <58>   DW_AT_decl_line   : 1
    <59>   DW_AT_decl_column : 12
    <5a>   DW_AT_type        : <0x4b>
    <5e>   DW_AT_low_pc      : 0x0
    <66>   DW_AT_high_pc     : 0x1a
    <6e>   DW_AT_frame_base  : 1 byte block: 9c         (DW_OP_call_frame_cfa)
    <70>   DW_AT_sibling     : <0x84>
---

On the surface though, it doesn't look like dmd is doing anything fundamentally
wrong, and yet gdb fails to find any debug information for the function.

--


More information about the Digitalmars-d-bugs mailing list