On 9/20/23 07:53, FX Coudert wrote:
ping**2
Hi,
This was a painful one to fix, because I hate regexps, especially when they are
quoted. On darwin, we have this failure:
FAIL: gcc.dg/debug/dwarf2/inline4.c scan-assembler
DW_TAG_inlined_subroutine[^\\\\(]*\\\\([^\\\\)]*\\\\)[^\\\\(]*\\\\(DIE
\\\\(0x[0-9a-f]*\\\\) DW_TAG_formal_parameter[^\\\\(]*\\\\(DIE
\\\\(0x[0-9a-f]*\\\\) DW_TAG_variable
That hideous regexp is trying to match (generated on Linux):
.uleb128 0x4 # (DIE (0x5c) DW_TAG_inlined_subroutine)
.long 0xa0 # DW_AT_abstract_origin
.quad .LBI4 # DW_AT_entry_pc
.byte .LVU2 # DW_AT_GNU_entry_view
.quad .LBB4 # DW_AT_low_pc
.quad .LBE4-.LBB4 # DW_AT_high_pc
.byte 0x1 # DW_AT_call_file (u.c)
.byte 0xf # DW_AT_call_line
.byte 0x14 # DW_AT_call_column
.uleb128 0x5 # (DIE (0x7d) DW_TAG_formal_parameter)
.long 0xad # DW_AT_abstract_origin
.long .LLST0 # DW_AT_location
.long .LVUS0 # DW_AT_GNU_locviews
.uleb128 0x6 # (DIE (0x8a) DW_TAG_variable)
It is using the parentheses to check what is between DW_TAG_inlined_subroutine,
DW_TAG_formal_parameter and DW_TAG_variable. There’s only one block of parentheses
in the middle, that "(u.c)”. However, on darwin, the generated output is more
compact:
.uleb128 0x4 ; (DIE (0x188) DW_TAG_inlined_subroutine)
.long 0x1b8 ; DW_AT_abstract_origin
.quad LBB4 ; DW_AT_low_pc
.quad LBE4 ; DW_AT_high_pc
.uleb128 0x5 ; (DIE (0x19d) DW_TAG_formal_parameter)
.long 0x1c6 ; DW_AT_abstract_origin
.uleb128 0x6 ; (DIE (0x1a2) DW_TAG_variable)
I think that’s valid as well, and the test should pass (what the test really
wants to check is that there is no DW_TAG_lexical_block emitted there, see
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=37801 for its origin). It could be
achieved in two ways:
1. making darwin emit the DW_AT_call_file
2. adjusting the regexp to match, making the internal block of parentheses
optional
I chose the second approach. It makes the test pass on darwin. If someone can
test it on linux, it’d be appreciated :) I don’t have ready access to such a
system right now.
Once that passes, OK to commit?
I actually tested the change on a few embedded targets (rx-elf,
bfin-elf, visium-elf and lm32-elf). For this change, that should be
sufficient.
OK for the trunk, sorry for the delay.
jeff