This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Skip argv0-symlink.exp on target argv[0] isn't available


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)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]