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 14:27:15 +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> <5440FA3F dot 4000805 at redhat dot com> <874mv2ltut dot fsf at codesourcery dot com>
On 10/17/2014 02:16 PM, Yao Qi wrote:
> Pedro Alves <palves@redhat.com> writes:
>
>> 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
>> }
>>
>
> OK, fixed in the updated patch.
>
>> 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"
>> }
>>
>
> OK, I list all OSes GDB supports (extracted from configure.tgt and configure.ac).
>
>>> + # 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)
>
> Unfortunately we can't. clean_restart loads file from $objdir/$subdir,
> but $exe is in $objdir or $objdir/temp.
>
OK. This version looks good to me.
Thanks,
Pedro Alves