Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Simon Marchi <simark@simark.ca>
To: George Barrett <bob@bob131.so>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] Fix handling of null stap semaphores
Date: Tue, 31 Dec 2019 17:37:00 -0000	[thread overview]
Message-ID: <55c5578c-5b24-6987-9b8d-46a40ac36587@simark.ca> (raw)
In-Reply-To: <9rhhdg5t27f6viytriu_m1zufab3j6qfbalt3izvvhcvmzp2bhad@mail.bob131.so>

On 2019-12-30 11:39 p.m., George Barrett wrote:
> On Mon, Dec 30, 2019 at 12:59:30PM -0500, Simon Marchi wrote:
>> Yeah, I know writing a test case is not the most fun part, but it pays in
>> the long run.  I can help if you are not familiar enough with
>> tcl/expect/dejagnu.
> 
> I can stumble through enough to get something ready for review, but there is
> a bit of a hiccup I wanted some advice on: the testing strategy you outlined
> hinges on prepare_for_testing producing PIC executables, but AFAICS this is
> neither done by default nor can I find a facility in the test suite utilities
> to achieve this. Is adding -pie/-fPIC to additional_flags acceptable in this
> instance?

If nothing else is specified, the testsuite produces executables with the default
settings of the toolchain.  If, for a test, you need to force creating a PIE or
a non-PIE, you can pass these flags to gdb_compile & al:

   - pie: Force creation of PIE executables.
   - nopie: Prevent creation of PIE executables.

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=blob;f=gdb/testsuite/lib/gdb.exp;h=8b1ec62c9c21570f3d3cb4c9d3fa0bdce016876e;hb=HEAD#l3686

If there are some differences in how PIE and non-PIE are handled, it can be good
to run the test with both.  This can be achieved relatively easily with a:

  foreach_with_prefix pie { "nopie" "pie" } {
    ...
  }

Here's an example:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=blob;f=gdb/testsuite/gdb.base/break-idempotent.exp;h=96f91c50f906955b289b7ee7dfd65dc7c375e79a;hb=HEAD#l149

> On a related note, I was a bit surprised to discover that the test case
> doesn't actually ever define USE_PROBES since the argument provided to
> stap_test(_no_debuginfo) is `-DUSE_PROBES' instead of
> `additional_flags=-DUSE_PROBES'. This seems like a trivial enough fix to be
> rolled into a single commit, but I was thinking that the fix wouldn't be
> particularly evident from the diff if the -pie flags were added in the same
> patch. Would this be worth splitting into an independent patch?

Yes, totally, a separate patch (ideally before, in the same series) would be perfect.
This shows that the test is written in a poor way, it does not appear to actually
test anything related to semaphores.  At least, I think it should parse the output
of "info probes" and expect an hexadecimal number for the semaphore address.

Good catch, btw.  Also, shouldn't it be called USE_SEMAPHORES and not USE_PROBES?

Thanks for looking into this.

Simon


  reply	other threads:[~2019-12-31 17:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-03 19:59 George Barrett
2019-12-18 17:20 ` [PING] " George Barrett
2019-12-28  5:28   ` [PING**2] " George Barrett
2019-12-29 18:58 ` Simon Marchi
     [not found]   ` <63-043i577lrr0nz3p9q-864io50kubhf/q6&oul1hzd/xh4.u6c@mail.bob131.so>
2019-12-30 17:59     ` Simon Marchi
2019-12-31  4:39       ` George Barrett
2019-12-31 17:37         ` Simon Marchi [this message]
2019-12-31 17:59           ` George Barrett
2019-12-31 17:56   ` Simon Marchi

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=55c5578c-5b24-6987-9b8d-46a40ac36587@simark.ca \
    --to=simark@simark.ca \
    --cc=bob@bob131.so \
    --cc=gdb-patches@sourceware.org \
    /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