From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-io1-xd44.google.com (mail-io1-xd44.google.com [IPv6:2607:f8b0:4864:20::d44]) by sourceware.org (Postfix) with ESMTPS id 375DE3857C7B for ; Thu, 16 Jul 2020 18:07:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 375DE3857C7B Received: by mail-io1-xd44.google.com with SMTP id q74so7022770iod.1 for ; Thu, 16 Jul 2020 11:07:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=fFzqO55nZpcWtvfGE5z8vsuUwnXJkQ/qITvxmNfyPv0=; b=AYEdYIRG7QHC3ohFGUJkICO7OhdwekloXO2ceAfwJcWCBE/8BKUK727kNh58edZ8d8 OpMgY/lFNeXhgxJ/uzKKF8vuhAA/5bvMQdri32KaFJZ/h00cefwM1lxj4SQV+sGALkRA wHjCJpQBPSFdDW0aWWnPYlGc+gUIVDNnIP0kqL3swH/mozYh12P2pkjwjnSaQEEU/UWp hPHxpnxoMAFItSwJU7hGhpiKgdVAFZBxSJRP8rlOjKyjdl1cG5/Rluvv1aZWCvSj55js YtBOrMLs/zGFU4WEqRJGgmXJjsp/IMFNHlR3fF4VTPbZqJSCc/xOvWVmBjucLz3nyn5+ fpfQ== X-Gm-Message-State: AOAM530Y31zDeUPFrykKqU6DmMHPYgu8sWxPvOjO6tO1NTT/KwMLMITb XLQr4HCRiKEg5Z0BL9Nol5zySGUZV1G05CjGZ3z17w== X-Google-Smtp-Source: ABdhPJwUjU5bVkpkcFFoGRJR16YbNqCcNzCfx3YQARhpygqQDCDR6nP+rU6KqbKpTODBNCjRhVNopraT445saqcAgRw= X-Received: by 2002:a6b:6d07:: with SMTP id a7mr5652817iod.166.1594922870423; Thu, 16 Jul 2020 11:07:50 -0700 (PDT) MIME-Version: 1.0 References: <20200716172149.GG2737@embecosm.com> In-Reply-To: <20200716172149.GG2737@embecosm.com> From: Caroline Tice Date: Thu, 16 Jul 2020 11:07:39 -0700 Message-ID: Subject: Re: [PATCH] Update testsuite mechanism to allow object files as source files. To: Andrew Burgess Cc: Caroline Tice via Gdb-patches , Eric Christopher , Tom Tromey , Simon Marchi Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-19.0 required=5.0 tests=BAYES_00, DKIMWL_WL_MED, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, USER_IN_DEF_DKIM_WL, USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Jul 2020 18:07:52 -0000 This text, extracted from my detailed explanation, DOES explain (I thought) why the existing DWARF assembler can't be used: > > A further twist is that > > the GNU assembler currently chokes on DWARF v5 .debug_line sections, because > > they start their file index at 0 instead of 1, and the GNU assembler has not > > been updated to handle this. This is not a problem for > > assembly files generated by GCC, because GCC generates DWARF v3 > > .debug_line sections, even when passed -gdwarf-5. Clang on the other hand, > > when passed -gdwarf-5, generates DWARF v5 .debug_line tables. So using a > > clang-generated .s file for the test is not an option, because the GNU > > assembler chokes on it. -- Caroline cmtice@google.com On Thu, Jul 16, 2020 at 10:21 AM Andrew Burgess wrote: > > * Caroline Tice via Gdb-patches [2020-07-16 09:50:36 -0700]: > > > Since this patch will be resulting in something of a policy change, I > > expect there will be a fair > > amount of discussion around it. > > > > High level summary: > > In some (hopefully rare) cases, certain tests MUST be built with a > > particular compiler to work. If that compiler is not GCC, then it > > makes it very burdensome for developers to run the GDB testsuite and > > test those tests. This change allows those tests to use object files > > (generated by the required compiler) as the test source file, so that > > when the test suite is run with GCC those tests will still > > execute/test properly. > > > > Details: > > This change is motivated by the fact that clang and GCC sometimes generate > > different output, which affects whether or not a test works properly. The > > particular motivating example is the gdb.dwarf2/dw5-rnglist-test.exp test, > > which tests whether or not GDB is properly reading/handling DWARF v5 > > DW_AT_ranges of the form DW_FORM_rnglistx in lexical block dies. GCC does > > not generate that code, so compiling the test with GCC does not successfully > > test anything. Clang does generate that code, so the only way to properly > > test this is to compile the test case with clang. A further twist is that > > the GNU assembler currently chokes on DWARF v5 .debug_line sections, because > > they start their file index at 0 instead of 1, and the GNU assembler has not > > been updated to handle this. This is not a problem for > > assembly files generated by GCC, because GCC generates DWARF v3 > > .debug_line sections, even when passed -gdwarf-5. Clang on the other hand, > > when passed -gdwarf-5, generates DWARF v5 .debug_line tables. So using a > > clang-generated .s file for the test is not an option, because the GNU > > assembler chokes on it. > > > > This patch updates lib/gdb.exp to allow it to properly handle test > > cases where the source file is in fact an object file, and it updates > > the dw5-rnglist-test to use an object file rather than the .cc file. This > > in turn makes the test itself compiler-agnostic. > > I haven't looked at this particular test, but I think any > justification for this change, especially when the example you cite is > about different DWARF, should include an explanation about why the > existing DWARF assembler can't be used in this case. > > Thanks, > Andrew > > > > > > > -- Caroline Tice > > cmtice@google.com > > > > gdb/testsuite/ChangeLog > > > > 2020-07-16 Caroline Tice > > > > * lib/gdb.exp (build_executable_from_specs): Create output_dir > > variable from call to standard_output_file; update code that > > compiles source files to object files and copies them to output > > directory, to check first and make sure they are not already > > object file. If they are already object files, just copy them to > > output directory. > > * gdb.dwarf2/dw5-rnglist-test.o: New file (object file) > > * gdb.dwarf2/dw5-rnglist-test.exp: Update to use .o file rather than > > .cc file; this removes the dependency of this test on clang and > > allows it to work with GCC as well. > >