This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH GCC]Add 'force-dwarf-lexical-blocks' command line option


Hi,

Currently GCC only emits DWARF debug information (DW_TAG_lexical_block DIEs) for compound statements containing significant local declarations.
However, code coverage tools that process the DWARF debug information to
implement block/path coverage need more complete lexical block information.

This patch adds the necessary functionality under the control of a new
command line argument: -fforce-dwarf-lexical-blocks.

When this flag is set, a DW_TAG_lexical_block DIE will be emitted for every function body, loop body, switch body, case statement, if-then and if-else statement, even if the body is a single statement. Likewise, a lexical block will be emitted for the first label of a labeled statement. This block ends at the end of the current lexical scope, or when a break, continue, goto or return statement is encountered at the same lexical scope level. Consequently, any case in a switch statement that does not flow through to the next case, will have its own dwarf lexical block.

The complete change proposal contains 3 patches (attached first 2):
  1.  Add command line option -fforce-dwarf-lexical-blocks
  2.  Use of flag_force_dwarf_blocks in C.

Attached are the proposed ChangeLog additions, named according to the directory each one belongs to.

A third patch, extending the proposed functionality to C++ will be submitted in a separate message.

NOTE: This is a second submit, with changes made according to maintainer's sugestions.

All check-c and check-c++ tests have been run for unix target.
The only test that failed with the -fforce-dwarf-lexical-blocks set
was:
FAIL: gcc.dg/debug/dwarf2/inline2.c scan-assembler-times \\(DIE \\([^\n]*\\) DW_TAG_lexical_block 6
as expected.

Best regards,
Andrei Herman
Mentor Graphics Corporation
Israel branch

Attachment: 0001-Add-command-line-option-fforce-dwarf-lexical-blocks.patch
Description: Text document

Attachment: 0002-Use-flag_force_dwarf_blocks.patch
Description: Text document

Attachment: gcc_c_ChangeLog
Description: Text document

Attachment: gcc_c-family_ChangeLog
Description: Text document

Attachment: gcc_ChangeLog
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]