public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Caroline Tice <cmtice@google.com>
To: Andrew Burgess <andrew.burgess@embecosm.com>
Cc: Caroline Tice via Gdb-patches <gdb-patches@sourceware.org>,
	Eric Christopher <echristo@google.com>,
	 Tom Tromey <tom@tromey.com>, Simon Marchi <simark@simark.ca>
Subject: Re: [PATCH] Update testsuite mechanism to allow object files as source files.
Date: Thu, 16 Jul 2020 11:07:39 -0700	[thread overview]
Message-ID: <CABtf2+Rms8Z2G_mrnf_3yGLsMs32XenGmGT-uDkt+U6QDXMmqw@mail.gmail.com> (raw)
In-Reply-To: <20200716172149.GG2737@embecosm.com>

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
<andrew.burgess@embecosm.com> wrote:
>
> * Caroline Tice via Gdb-patches <gdb-patches@sourceware.org> [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  <cmtice@google.com>
> >
> >         * 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.
>
>

  reply	other threads:[~2020-07-16 18:07 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-16 16:50 Caroline Tice
2020-07-16 17:21 ` Andrew Burgess
2020-07-16 18:07   ` Caroline Tice [this message]
2020-07-16 18:29     ` Andrew Burgess
2020-07-16 17:33 ` Joseph Myers
2020-07-16 18:13   ` Caroline Tice
2020-07-16 18:47     ` Andrew Burgess
2020-07-16 20:35     ` Joseph Myers
2020-07-16 20:12   ` Tom Tromey
2020-07-16 21:10     ` Caroline Tice
2020-07-16 21:16       ` Eric Christopher
2020-07-17  9:48         ` Andrew Burgess
2020-07-17 16:05           ` Caroline Tice
2020-07-17  9:43       ` Andrew Burgess
2020-07-17 17:45         ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CABtf2+Rms8Z2G_mrnf_3yGLsMs32XenGmGT-uDkt+U6QDXMmqw@mail.gmail.com \
    --to=cmtice@google.com \
    --cc=andrew.burgess@embecosm.com \
    --cc=echristo@google.com \
    --cc=gdb-patches@sourceware.org \
    --cc=simark@simark.ca \
    --cc=tom@tromey.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).