#### 17.22.5 Macros for SDB and DWARF Output

Here are macros for SDB and DWARF output.

— Macro: SDB_DEBUGGING_INFO

> Define this macro if GCC should produce COFF-style debugging output for SDB in response to the `-g` option.

— Macro: DWARF2_DEBUGGING_INFO

> Define this macro if GCC should produce dwarf version 2 format debugging output in response to the `-g` option.

> — Target Hook: int TARGET_DWARF_CALLING_CONVENTION (const_tree function)

> > Define this to enable the dwarf attribute `DW_AT_calling_convention` to be emitted for each function. Instead of an integer return the enum value for the `DW_CC_` tag.

> To support optional call frame debugging information, you must also define `INCOMING_RETURN_ADDR_RTX` and either set `RTX_FRAME_RELATED_P` on the prologue insns if you use RTL for the prologue, or call `dwarf2out_def_cfa` and `dwarf2out_reg_save` as appropriate from `TARGET_ASM_FUNCTION_PROLOGUE` if you don't.

— Macro: DWARF2_FRAME_INFO

> Define this macro to a nonzero value if GCC should always output Dwarf 2 frame information. If `TARGET_EXCEPT_UNWIND_INFO` (see Exception Region Output) returns `UI_DWARF2`, and exceptions are enabled, GCC will output this information not matter how you define `DWARF2_FRAME_INFO`.

— Target Hook: enum unwind_info_type TARGET_DEBUG_UNWIND_INFO (void)

> This hook defines the mechanism that will be used for describing frame unwind information to the debugger. Normally the hook will return `UI_DWARF2` if DWARF 2 debug information is enabled, and return `UI_NONE` otherwise.

> A target may return `UI_DWARF2` even when DWARF 2 debug information is disabled in order to always output DWARF 2 frame information.

> A target may return `UI_TARGET` if it has ABI specified unwind tables. This will suppress generation of the normal debug frame unwind information.

— Macro: DWARF2_ASM_LINE_DEBUG_INFO

> Define this macro to be a nonzero value if the assembler can generate Dwarf 2 line debug info sections. This will result in much more compact line number tables, and hence is desirable if it works.

— Target Hook: bool TARGET_WANT_DEBUG_PUB_SECTIONS

> True if the `.debug_pubtypes` and `.debug_pubnames` sections should be emitted. These sections are not used on most platforms, and in particular GDB does not use them.

— Target Hook: bool TARGET_FORCE_AT_COMP_DIR

> True if the `DW_AT_comp_dir` attribute should be emitted for each compilation unit. This attribute is required for the darwin linker to emit debug information.

— Target Hook: bool TARGET_DELAY_SCHED2

> True if sched2 is not to be run at its normal place. This usually means it will be run as part of machine-specific reorg.

— Target Hook: bool TARGET_DELAY_VARTRACK

> True if vartrack is not to be run at its normal place. This usually means it will be run as part of machine-specific reorg.

— Macro: ASM_OUTPUT_DWARF_DELTA (stream, size, label1, label2)

> A C statement to issue assembly directives that create a difference lab1 minus lab2, using an integer of the given size.

— Macro: ASM_OUTPUT_DWARF_VMS_DELTA (stream, size, label1, label2)

> A C statement to issue assembly directives that create a difference between the two given labels in system defined units, e.g. instruction slots on IA64 VMS, using an integer of the given size.

— Macro: ASM_OUTPUT_DWARF_OFFSET (stream, size, label, section)

> A C statement to issue assembly directives that create a section-relative reference to the given label, using an integer of the given size. The label is known to be defined in the given section.

— Macro: ASM_OUTPUT_DWARF_PCREL (stream, size, label)

> A C statement to issue assembly directives that create a self-relative reference to the given label, using an integer of the given size.

— Macro: ASM_OUTPUT_DWARF_TABLE_REF (label)

> A C statement to issue assembly directives that create a reference to the DWARF table identifier label from the current section. This is used on some systems to avoid garbage collecting a DWARF table which is referenced by a function.

— Target Hook: void TARGET_ASM_OUTPUT_DWARF_DTPREL (FILE *file, int size, rtx x)

> If defined, this target hook is a function which outputs a DTP-relative reference to the given TLS symbol of the specified size.

— Macro: PUT_SDB_...

> Define these macros to override the assembler syntax for the special SDB assembler directives. See `sdbout.c` for a list of these macros and their arguments. If the standard syntax is used, you need not define them yourself.

— Macro: SDB_DELIM

> Some assemblers do not support a semicolon as a delimiter, even between SDB assembler directives. In that case, define this macro to be the delimiter to use (usually ‘`\n`’). It is not necessary to define a new set of `PUT_SDB_`op macros if this is the only change required.

— Macro: SDB_ALLOW_UNKNOWN_REFERENCES

> Define this macro to allow references to unknown structure, union, or enumeration tags to be emitted. Standard COFF does not allow handling of unknown references, MIPS ECOFF has support for it.

— Macro: SDB_ALLOW_FORWARD_REFERENCES

> Define this macro to allow references to structure, union, or enumeration tags that have not yet been seen to be handled. Some assemblers choke if forward tags are used, while some require it.

— Macro: SDB_OUTPUT_SOURCE_LINE (stream, line)

> A C statement to output SDB debugging information before code for line number line of the current source file to the stdio stream stream. The default is to emit an `.ln` directive.