Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Yao Qi <yao@codesourcery.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] Skip argv0-symlink.exp on target argv[0] isn't available
Date: Fri, 17 Oct 2014 11:15:00 -0000	[thread overview]
Message-ID: <5440FA3F.4000805@redhat.com> (raw)
In-Reply-To: <87lhofkvr8.fsf@codesourcery.com>

On 10/17/2014 08:20 AM, Yao Qi wrote:

>>> >> +
>>> >> +		send_gdb "p argv\[0\]\n"
>>> >> +		gdb_expect {
>>> >> +		    -re " = $hex \".*$exe\"\r\n${gdb_prompt} $" {
>> >
>> > I suspect this may break if remote (host|target) testing,
>> > and not sharing the filesystem between build/host/target.
>> > Isn't $exe here a full path on the build?
>> >
> $exe can be a full path, and can be a base name too.  It depends on proc
> standard_temp_file.  You are right that it is a mistake to use the build
> file path on host.  I change it to 
> 
>   ".*[file tail $exe]\"\r\n${gdb_prompt} $"

OK.  So I'm somewhat worried about silently reducing coverage due to
some problem here, either now, or in the future.

So how about instead of silently skipping the tests, call
unsupported, like:

  global has_argv0
  set test "verify dereferenced value"
  if { $has_argv0 } {
     gdb_test "python print (arg0)" "0x.*$testfile\"" $test
  } else {
     unsupported $test
  }

etc.

> +gdb_caching_proc gdb_has_argv0 {
> +    set result 0
...
> +    # Helper proc.
> +    proc gdb_has_argv0_1 { exe } {
...
> +    set result [gdb_has_argv0_1 $exe]

And then in addition, add an assert here for the main OSs
we support, like so:

 if { !$result
      && ([istarget *-*-linux*]
         || [istarget *-*-gnu*]
         || [istarget *-*-cygwin*]
         || [istarget *-*-mingw*]
         || [istarget *-*-darwin*]
         || [istarget *-*-bsd*]
         || [istarget *-*-solaris*]
         || [istarget *-*-msdosdjgpp*]
         || [istarget *-*-go32*]
	 || [istarget *-*-aix*]
         || [istarget *-*-hpux*]) } {
    fail "argv[0] should be available on this target"
 }

> +    # Helper proc.
> +    proc gdb_has_argv0_1 { exe } {
> +	global srcdir subdir
> +	global gdb_prompt hex decimal
> +
> +	gdb_exit
> +	gdb_start
> +	gdb_reinitialize_dir $srcdir/$subdir
> +	gdb_load "$exe"

BTW, use clean_restart here?  (if so, I think 'global srcdir subdir'
becomes unnecessary too)


  reply	other threads:[~2014-10-17 11:15 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-16  6:29 Yao Qi
2014-10-16 17:48 ` Pedro Alves
2014-10-17  7:24   ` Yao Qi
2014-10-17 11:15     ` Pedro Alves [this message]
2014-10-17 13:20       ` Yao Qi
2014-10-17 13:27         ` Pedro Alves
2014-10-18 13:03           ` Yao Qi

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=5440FA3F.4000805@redhat.com \
    --to=palves@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=yao@codesourcery.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