[Bug debug/101283] Several tests fail on Darwin with -gctf/gbtf
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101283 Indu Bhagat changed: What|Removed |Added CC||ibhagat at gcc dot gnu.org Status|NEW |RESOLVED Resolution|--- |FIXED --- Comment #22 from Indu Bhagat --- Failing tests have been fixed and target now have an option to opt out of CTF/BTF. Closing the bug.
[Bug debug/101283] Several tests fail on Darwin with -gctf/gbtf
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101283 --- Comment #21 from Iain Sandoe --- (In reply to Indu Bhagat from comment #20) > Commit https://gcc.gnu.org/g:f007a638a86e4b59bef0a0d8efa5bb8c5e5b200a added > support for targets to opt out of CTF/BTF support. I think that from the Darwin perspective the problem was already fixed before this - if that action handles the bug for other affected targets, then it could certainly be closed from the Darwin-PoV.
[Bug debug/101283] Several tests fail on Darwin with -gctf/gbtf
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101283 --- Comment #20 from Indu Bhagat --- Commit https://gcc.gnu.org/g:f007a638a86e4b59bef0a0d8efa5bb8c5e5b200a added support for targets to opt out of CTF/BTF support.
[Bug debug/101283] Several tests fail on Darwin with -gctf/gbtf
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101283 David Edelsohn changed: What|Removed |Added CC||dje at gcc dot gnu.org --- Comment #19 from David Edelsohn --- I disabled on AIX because CTF and BTF were not enumerated as explicit debug formats that emitted the normal GCC warning checked by DejaGNU.
[Bug debug/101283] Several tests fail on Darwin with -gctf/gbtf
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101283 --- Comment #18 from Indu Bhagat --- (In reply to Richard Biener from comment #4) > It might make sense to provide targets a means to opt-out of CTF/BTF support > and thus diagnose -gctf as unsupported on them. Yes, I agree. It makes sense to have provide some means to opt out of CTF/BTF support. I will look into this.
[Bug debug/101283] Several tests fail on Darwin with -gctf/gbtf
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101283 --- Comment #17 from CVS Commits --- The master branch has been updated by Indu Bhagat : https://gcc.gnu.org/g:d9e9532bb3bf5db4cd6afd49d343ede5b27c3c9f commit r12-2094-gd9e9532bb3bf5db4cd6afd49d343ede5b27c3c9f Author: Indu Bhagat Date: Tue Jul 6 16:11:47 2021 -0700 BTF testsuite: Remove explicit check on btm_type The value of btm_type is the BTF type ID of the referred type. The order in which the BTF types are added can change across platforms and also as the code evolves, hence changing the BTF type ID. As there is no direct and portable method of testing that a BTF type refers to another BTF type of a specific kind, remove the explicit check on btm_type. This patch adjusts the testcase without affecting the test coverage as other testcases already have similar constructs. It also fixes a subset of failures as seen on Darwin. 2021-07-06 Indu Bhagat gcc/testsuite/ChangeLog: PR debug/101283 * gcc.dg/debug/btf/btf-bitfields-3.c: Remove the check on btm_type.
[Bug debug/101283] Several tests fail on Darwin with -gctf/gbtf
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101283 --- Comment #16 from CVS Commits --- The master branch has been updated by Indu Bhagat : https://gcc.gnu.org/g:97bcacfb5ac49afa4e305489dd110cc446451549 commit r12-2093-g97bcacfb5ac49afa4e305489dd110cc446451549 Author: Indu Bhagat Date: Tue Jul 6 16:02:38 2021 -0700 CTF testsuite: Remove explicit check on ctv_typeidx The value of ctv_typeidx is the CTF type ID of the data type of the associated variable. The order in which the CTF types are added can change across platforms and also as the code evolves, hence changing the CTF type ID. As there is no direct and portable method of testing that the data type of a CTF variable is of a specific kind, remove the check on ctv_typeidx. This also fixes a subset of failures as seen on Darwin. 2021-07-06 Indu Bhagat gcc/testsuite/ChangeLog: PR debug/101283 * gcc.dg/debug/ctf/ctf-attr-mode-1.c: Remove the check for ctv_typeidx.
[Bug debug/101283] Several tests fail on Darwin with -gctf/gbtf
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101283 --- Comment #15 from CVS Commits --- The master branch has been updated by Indu Bhagat : https://gcc.gnu.org/g:151b423a82f4bf15e3225833028f5258ea254cb9 commit r12-2090-g151b423a82f4bf15e3225833028f5258ea254cb9 Author: Indu Bhagat Date: Tue Jul 6 13:53:58 2021 -0700 dwarf2ctf: the unit of sou field location is bits [PR101283] If the value of the DW_AT_data_member_location attribute is constant, the associated unit is bytes. This patch amends incorrect behaviour which was being exercised with -gdwarf-2. This caused some of the failures as noted in PR debug/101283 (specifically the BTF tests involving btm_offset). The testcase ctf-struct-array-2.c was erroneously checking for the value of ctm_offset in number of bytes. The patch fixes the calculation of the field location value for a struct member in dwarf2ctf and adjusts the testcase. This patch also fixes some of the failing tests as noted in PR debug/101283. 2021-07-06 Indu Bhagat gcc/ChangeLog: PR debug/101283 * dwarf2ctf.c (ctf_get_AT_data_member_location): Multiply by 8 to get number of bits. gcc/testsuite/ChangeLog: PR debug/101283 * gcc.dg/debug/ctf/ctf-struct-array-2.c: Adjust the value in the testcase.
[Bug debug/101283] Several tests fail on Darwin with -gctf/gbtf
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101283 --- Comment #14 from Indu Bhagat --- With the two patches (commit r12-2044-ga3543b5e8002c033b2304d7ac1d1e58218eebb51 + the other in review) only two further failures remain to be looked into: FAIL: gcc.dg/debug/btf/btf-bitfields-3.c scan-assembler-times [\t ]0x2[\t ]+[^\n]*btm_type 1 FAIL: gcc.dg/debug/ctf/ctf-attr-mode-1.c scan-assembler-times [\t ]0x3[\t ]+[^\n]*ctv_typeidx 1 I will look into them next.
[Bug debug/101283] Several tests fail on Darwin with -gctf/gbtf
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101283 --- Comment #13 from CVS Commits --- The master branch has been updated by Indu Bhagat : https://gcc.gnu.org/g:a3543b5e8002c033b2304d7ac1d1e58218eebb51 commit r12-2044-ga3543b5e8002c033b2304d7ac1d1e58218eebb51 Author: Indu Bhagat Date: Mon Jul 5 17:28:24 2021 -0700 CTF,BTF testsuite: Use -gdwarf-4 for restrict type qualifier [PR101283] DWARF DIEs do not contain DW_TAG_restrict_type when DWARF version is 2. CTF/BTF generation feeds off DWARF DIEs, and as such, CTF records of kind CTF_K_RESTRICT cease to be generated when DWARF version is 2. This patch fixes the failure of these testcases on Darwin by using an explicit -gdwarf-4 in the dg-options. This keeps the CTF record generation for restrict type qualifier tested. PR debug/101283 - Several tests fail on Darwin with -gctf/gbtf 2021-07-05 Indu Bhagat gcc/testsuite/ChangeLog: PR debug/101283 * gcc.dg/debug/btf/btf-cvr-quals-1.c: Use -gdwarf-4 on Darwin targets. * gcc.dg/debug/ctf/ctf-cvr-quals-1.c: Likewise.
[Bug debug/101283] Several tests fail on Darwin with -gctf/gbtf
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101283 --- Comment #12 from Indu Bhagat --- The intention is to be able to generate CTF/BTF correctly irrespective of the DWARF version. The case of DW_TAG_restrict_type is unique though, and looks like we will need special handling. To be specific, the 'restrict' keyword related failures are: - gcc.dg/debug/ctf/ctf-cvr-quals-1.c - gcc.dg/debug/btf/btf-cvr-quals-1.c DW_TAG_restrict_type is not generated for DWARF-2. So, adding a target specific option for these looks like a reasonable way forward. So for the btf testcase, something like - /* { dg-options "-O0 -gbtf -dA -gdwarf-4" { target { *-*-darwin* } } } */ Next, for some of the *-bitfield-*.c test failures, the issue can be masked away by forcing -gdwarf-4, yes. But the correct fix can be done in dwarf2ctf.c and with that, there is not need to force a -gdwarf-4 in those tests. I will post a patch for these two soon.
[Bug debug/101283] Several tests fail on Darwin with -gctf/gbtf
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101283 --- Comment #11 from Iain Sandoe --- (In reply to Indu Bhagat from comment #10) > (In reply to Iain Sandoe from comment #9) > > (In reply to Iain Sandoe from comment #8) > > > we are now left with (where I suspect that the remaining fails are an > > > artefact of the way in which Darwin represents offsets instead of > > > relocations in DWARF debug sections): > > > > on a bit more looking, that is probably not the reason - I guess we will > > have to look at what the represented structures are and why they have > > different renderings for Darwin. > > I am looking into these failures one by one. It seems that the issue is as you noted on IRC, that Darwin defaults to generating DWARF-2. I have confirmed that overriding this to DWARF-4 for btf/ctf fixes the test fails - I'll make an interim patch to do this in Darwin's option processing. However, I guess the bottom line question is "do you intend to support versions of DWARF earlier than 4 as a source for BTF/CTF"? The corner-case comes when a user enables both CTF and DWARF, in which case we could be demanding a higher version of DWARF to support CTF than the system tools can handle for the dwarf output.
[Bug debug/101283] Several tests fail on Darwin with -gctf/gbtf
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101283 --- Comment #10 from Indu Bhagat --- (In reply to Iain Sandoe from comment #9) > (In reply to Iain Sandoe from comment #8) > > we are now left with (where I suspect that the remaining fails are an > > artefact of the way in which Darwin represents offsets instead of > > relocations in DWARF debug sections): > > on a bit more looking, that is probably not the reason - I guess we will > have to look at what the represented structures are and why they have > different renderings for Darwin. I am looking into these failures one by one.
[Bug debug/101283] Several tests fail on Darwin with -gctf/gbtf
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101283 --- Comment #9 from Iain Sandoe --- (In reply to Iain Sandoe from comment #8) > we are now left with (where I suspect that the remaining fails are an > artefact of the way in which Darwin represents offsets instead of > relocations in DWARF debug sections): on a bit more looking, that is probably not the reason - I guess we will have to look at what the represented structures are and why they have different renderings for Darwin.
[Bug debug/101283] Several tests fail on Darwin with -gctf/gbtf
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101283 --- Comment #8 from Iain Sandoe --- we are now left with (where I suspect that the remaining fails are an artefact of the way in which Darwin represents offsets instead of relocations in DWARF debug sections): Running target unix/-m64 Running /src-local/gcc-master/gcc/testsuite/gcc.dg/debug/btf/btf.exp ... FAIL: gcc.dg/debug/btf/btf-bitfields-1.c scan-assembler-times [\t ]0xa20[\t ]+[^\n]*btm_offset 1 FAIL: gcc.dg/debug/btf/btf-bitfields-1.c scan-assembler-times [\t ]0x72a[\t ]+[^\n]*btm_offset 1 FAIL: gcc.dg/debug/btf/btf-bitfields-1.c scan-assembler-times [\t ]0x1340[\t ]+[^\n]*btm_offset 1 FAIL: gcc.dg/debug/btf/btf-bitfields-2.c scan-assembler-times [\t ]0x2020[\t ]+[^\n]*btm_offset 1 FAIL: gcc.dg/debug/btf/btf-bitfields-3.c scan-assembler-times [\t ]0x2[\t ]+[^\n]*btm_type 1 FAIL: gcc.dg/debug/btf/btf-bitfields-4.c scan-assembler-times [\t ]0x403[\t ]+[^\n]*btt_info 1 FAIL: gcc.dg/debug/btf/btf-cvr-quals-1.c scan-assembler-times [\t ]0xb00[\t ]+[^\n]*btt_info 2 Running /src-local/gcc-master/gcc/testsuite/gcc.dg/debug/ctf/ctf.exp ... FAIL: gcc.dg/debug/ctf/ctf-attr-mode-1.c scan-assembler-times [\t ]0x3[\t ]+[^\n]*ctv_typeidx 1 FAIL: gcc.dg/debug/ctf/ctf-cvr-quals-1.c scan-assembler-times [\t ]0[\t ]+[^\n]*ctt_name 7 FAIL: gcc.dg/debug/ctf/ctf-cvr-quals-1.c scan-assembler-times [\t ]0x3600[\t ]+[^\n]*ctt_info 2 Running /src-local/gcc-master/gcc/testsuite/gcc.dg/debug/debug.exp ... === gcc Summary for unix/-m64 === # of expected passes1214 # of unexpected failures10 # of unsupported tests 24 Running target unix/-m32 Running /src-local/gcc-master/gcc/testsuite/gcc.dg/debug/btf/btf.exp ... FAIL: gcc.dg/debug/btf/btf-bitfields-1.c scan-assembler-times [\t ]0xa20[\t ]+[^\n]*btm_offset 1 FAIL: gcc.dg/debug/btf/btf-bitfields-1.c scan-assembler-times [\t ]0x72a[\t ]+[^\n]*btm_offset 1 FAIL: gcc.dg/debug/btf/btf-bitfields-1.c scan-assembler-times [\t ]0x1340[\t ]+[^\n]*btm_offset 1 FAIL: gcc.dg/debug/btf/btf-bitfields-2.c scan-assembler-times [\t ]0x2020[\t ]+[^\n]*btm_offset 1 FAIL: gcc.dg/debug/btf/btf-bitfields-3.c scan-assembler-times [\t ]0x2[\t ]+[^\n]*btm_type 1 FAIL: gcc.dg/debug/btf/btf-bitfields-4.c scan-assembler-times [\t ]0x403[\t ]+[^\n]*btt_info 1 FAIL: gcc.dg/debug/btf/btf-cvr-quals-1.c scan-assembler-times [\t ]0xb00[\t ]+[^\n]*btt_info 2 Running /src-local/gcc-master/gcc/testsuite/gcc.dg/debug/ctf/ctf.exp ... FAIL: gcc.dg/debug/ctf/ctf-attr-mode-1.c scan-assembler-times [\t ]0x3[\t ]+[^\n]*ctv_typeidx 1 FAIL: gcc.dg/debug/ctf/ctf-cvr-quals-1.c scan-assembler-times [\t ]0[\t ]+[^\n]*ctt_name 7 FAIL: gcc.dg/debug/ctf/ctf-cvr-quals-1.c scan-assembler-times [\t ]0x3600[\t ]+[^\n]*ctt_info 2 Running /src-local/gcc-master/gcc/testsuite/gcc.dg/debug/debug.exp ... === gcc Summary for unix/-m32 === # of expected passes1214 # of unexpected failures10 # of unsupported tests 24 === gcc Summary === # of expected passes2428 # of unexpected failures20 # of unsupported tests 48
[Bug debug/101283] Several tests fail on Darwin with -gctf/gbtf
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101283 --- Comment #7 from CVS Commits --- The master branch has been updated by Iain D Sandoe : https://gcc.gnu.org/g:85017431068251628478f38346c273418c71209b commit r12-1983-g85017431068251628478f38346c273418c71209b Author: Iain Sandoe Date: Fri Jul 2 09:51:57 2021 +0100 Darwin, CTF, BTF: Do not run the DWARF debug link for BTF/CTF [PR101283]. Darwin uses an efficient two-stage process for debug linking. The static linker (ld64) notes the inputs required but does not link the debug. When required / on demand the debug is linked into a separate package by the debug linker (dsymutil). At present none of the Darwin tools consume or understand BTF/CTF. The static linker silently accepts the sections (but will not act on them as containing anything to be processed). However, the debug linker produces a warning that it has been presented with input with no [DWARF] debug content: warning: no debug symbols in executable (-arch x86_64). This causes several testsuite fails with excess errors. Signed-off-by: Iain Sandoe PR debug/101283 - Several tests fail on Darwin with -gctf/gbtf PR debug/101283 gcc/ChangeLog: * config/darwin.h (DSYMUTIL_SPEC): Do not try to run dsymutil for BTF/CTF.
[Bug debug/101283] Several tests fail on Darwin with -gctf/gbtf
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101283 --- Comment #6 from CVS Commits --- The master branch has been updated by Iain D Sandoe : https://gcc.gnu.org/g:eb817f27e82769aef545d580a0c47a3aa50d1ec4 commit r12-1982-geb817f27e82769aef545d580a0c47a3aa50d1ec4 Author: Iain Sandoe Date: Fri Jul 2 09:44:59 2021 +0100 Darwin, BTF: Provide a suitable section name for BTF [PR101283]. In a similar manner to r12-1960-gcc8453012f75d, this provides a placeholder section name for BTF data. This change groups BTF and CTF debug formats in the same segment, but keeps them in separate sections. As per the CTF section designation, this should be agreed or amended to an agreed form before GCC 12 ships. Signed-off-by: Iain Sandoe PR debug/101283 - Several tests fail on Darwin with -gctf/gbtf PR debug/101283 gcc/ChangeLog: * config/darwin.h (CTF_INFO_SECTION_NAME): Update the segment to include BTF. (BTF_INFO_SECTION_NAME): New.
[Bug debug/101283] Several tests fail on Darwin with -gctf/gbtf
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101283 --- Comment #5 from Iain Sandoe --- (In reply to Richard Biener from comment #4) > It might make sense to provide targets a means to opt-out of CTF/BTF support > and thus diagnose -gctf as unsupported on them. In the short-term, I've got fixes for the invocation-related issues, which I'll commit today. A new debug format is clearly a vast undertaking - requiring buy-in from many organisations - in the case of Darwin, it will mean amendment to ld64 (to recognise and deal with relocation-less offsets) and dsymutil (to handle linking the debug) and then lldb / gdb / backtrace etc. to deal with common consumers. Releases for these tools are controlled by Apple - clearly one can self-build hacked version, but that's extremely unlikely to reach the larger majority of Darwin/macOS developers. == for opt out. It would be a simple matter to add a driver self-spec to reject '-gctf' and '-gbtf' (which can be arranged to give an error) and then, I guess, to add opt-out to the testsuite selectors? In any event, opt-out is likely the only sensible action for older platforms where "rebuild the world" is not an option; how can this interoperate with existing libraries etc. using DWARF debug?
[Bug debug/101283] Several tests fail on Darwin with -gctf/gbtf
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101283 --- Comment #4 from Richard Biener --- It might make sense to provide targets a means to opt-out of CTF/BTF support and thus diagnose -gctf as unsupported on them.