This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Skip argv0-symlink.exp on target argv[0] isn't available
- From: Pedro Alves <palves at redhat dot com>
- To: Yao Qi <yao at codesourcery dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Fri, 17 Oct 2014 12:15:11 +0100
- Subject: Re: [PATCH] Skip argv0-symlink.exp on target argv[0] isn't available
- Authentication-results: sourceware.org; auth=none
- References: <1413440712-3645-1-git-send-email-yao at codesourcery dot com> <54400505 dot 6070908 at redhat dot com> <87lhofkvr8 dot fsf at codesourcery dot 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)