From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3654 invoked by alias); 9 Feb 2005 16:46:13 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 3625 invoked from network); 9 Feb 2005 16:46:07 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org with SMTP; 9 Feb 2005 16:46:07 -0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.12.11/8.12.11) with ESMTP id j19Gk7rL009002 for ; Wed, 9 Feb 2005 11:46:07 -0500 Received: from potter.sfbay.redhat.com (potter.sfbay.redhat.com [172.16.27.15]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id j19Gk7O22487 for ; Wed, 9 Feb 2005 11:46:07 -0500 Received: from cygbert.vinschen.de (vpn50-32.rdu.redhat.com [172.16.50.32]) by potter.sfbay.redhat.com (8.12.8/8.12.8) with ESMTP id j19Gk4IR009850 for ; Wed, 9 Feb 2005 11:46:05 -0500 Received: by cygbert.vinschen.de (Postfix, from userid 500) id 6E13B57D77; Wed, 9 Feb 2005 17:45:57 +0100 (CET) Date: Wed, 09 Feb 2005 17:02:00 -0000 From: Corinna Vinschen To: gdb-patches@sources.redhat.com Subject: Re: [RFA] testsuite/gdb.base/maint.exp: Add relative pathname test and fix test for Cygwin Message-ID: <20050209164557.GP2597@cygbert.vinschen.de> Reply-To: gdb-patches@sources.redhat.com Mail-Followup-To: gdb-patches@sources.redhat.com References: <20050203125811.GA19985@cygbert.vinschen.de> <420A1A04.9010106@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <420A1A04.9010106@gnu.org> User-Agent: Mutt/1.4.2i X-SW-Source: 2005-02/txt/msg00057.txt.bz2 On Feb 9 09:11, Andrew Cagney wrote: > Corinna Vinschen wrote: > >Hi, > > > >this patch adds a new test, which tests for the path problem described > >and patched in my posting to this list from 2005-01-24: > > > > http://sources.redhat.com/ml/gdb-patches/2005-01/msg00234.html > > > >which still awaits approval. > > > >The below patch adds a test for the added ability to handle relativ paths > >to object files. It FAILs on current GDB but it PASSes with my patch to > >symmisc.c. > > Looks good, just some refinement before committing ... Thanks for the review. Applied with the changes you've suggested, see below. Changes tested on Cygwin. Corinna ChangeLog: * symmisc.c: Include gdb_stat.h. (maintenance_print_msymbols): Use inode numbers to compare files. testsuite/ChangeLog: * maint.exp: Raise timeout to give Cygwin targeted GDBs more time for printing symbols and statistics. Add test for using relative pathnames in "maint print msymbols" test. Mark "maint info sections DATA" XFAIL on Cygwin. Remove Cygwin XFAIL mark on "help maint dump-me" and "maint dump-me" tests. Index: symmisc.c =================================================================== RCS file: /cvs/src/src/gdb/symmisc.c,v retrieving revision 1.34 diff -p -u -r1.34 symmisc.c --- symmisc.c 12 Jan 2005 18:31:33 -0000 1.34 +++ symmisc.c 9 Feb 2005 16:40:21 -0000 @@ -35,6 +35,7 @@ #include "bcache.h" #include "block.h" #include "gdb_regex.h" +#include "gdb_stat.h" #include "dictionary.h" #include "gdb_string.h" @@ -930,6 +931,8 @@ maintenance_print_msymbols (char *args, char *symname = NULL; struct objfile *objfile; + struct stat sym_st, obj_st; + dont_repeat (); if (args == NULL) @@ -948,7 +951,10 @@ maintenance_print_msymbols (char *args, /* If a second arg is supplied, it is a source file name to match on */ if (argv[1] != NULL) { - symname = argv[1]; + symname = xfullpath (argv[1]); + make_cleanup (xfree, symname); + if (symname && stat (symname, &sym_st)) + perror_with_name (symname); } } @@ -962,8 +968,9 @@ maintenance_print_msymbols (char *args, immediate_quit++; ALL_OBJFILES (objfile) - if (symname == NULL || strcmp (symname, objfile->name) == 0) - dump_msymbols (objfile, outfile); + if (symname == NULL + || (!stat (objfile->name, &obj_st) && sym_st.st_ino == obj_st.st_ino)) + dump_msymbols (objfile, outfile); immediate_quit--; fprintf_filtered (outfile, "\n\n"); do_cleanups (cleanups); Index: testsuite/gdb.base/maint.exp =================================================================== RCS file: /cvs/src/src/gdb/testsuite/gdb.base/maint.exp,v retrieving revision 1.23 diff -p -u -r1.23 maint.exp --- testsuite/gdb.base/maint.exp 7 Feb 2004 23:26:47 -0000 1.23 +++ testsuite/gdb.base/maint.exp 9 Feb 2005 16:40:21 -0000 @@ -187,6 +187,13 @@ gdb_expect { timeout { fail "(timeout) maint demangle" } } +# The timeout value is raised, because printing all the symbols and +# statistical information about Cygwin and Windows libraries takes a lot +# of time. +if [istarget "*-*-cygwin*"] { + set oldtimeout $timeout + set timeout [expr $timeout + 500] +} send_gdb "maint print statistics\n" gdb_expect { @@ -316,6 +323,42 @@ gdb_expect { timeout { fail "(timeout) maint print msymbols" } } +# Check that maint print msymbols allows relative pathnames +set mydir [pwd] +gdb_test "cd ${objdir}" "Working directory ${objdir}\..*" +gdb_test_multiple "maint print msymbols msymbols_output2 ${subdir}/${testfile}" "maint print msymbols" { + -re "^maint print msymbols msymbols_output2 \[^\n\]*\r\n$gdb_prompt $" { + gdb_test_multiple "shell ls msymbols_output2" "maint print msymbols" { + -re "msymbols_output2\r\n$gdb_prompt $" { + gdb_test_multiple "shell grep factorial msymbols_output2" "maint print msymbols" { + -re "\\\[ *$decimal\\\] T\[ \t\]+$hex factorial.*$gdb_prompt $" { + pass "maint print msymbols" + } + -re ".*$gdb_prompt $" { + fail "maint print msymbols" + } + timeout { + fail "(timeout) maint print msymbols" + } + } + gdb_test "shell rm -f msymbols_output2" "" + } + -re ".*$gdb_prompt $" { + fail "maint print msymbols" + } + timeout { + fail "(timeout) maint print msymbols" + } + } + } + -re ".*$gdb_prompt $" { + fail "maint print msymbols" + } + timeout { + fail "(timeout) maint print msymbols" + } +} +gdb_test "cd ${mydir}" "Working directory ${mydir}\..*" send_gdb "maint print symbols\n" gdb_expect { @@ -421,6 +464,10 @@ gdb_expect { # Test for new option: DATA section flag # If your text section is tagged DATA, xfail this test. +# +# The "maint info sections DATA" test is marked for XFAIL on Cygwin, +# because Windows has text sections marked DATA. +setup_xfail "*-*-*cygwin*" send_gdb "maint info sections DATA\n" gdb_expect { -re ".* .text .*$gdb_prompt $" { fail "maint info sections DATA" } @@ -511,10 +558,6 @@ gdb_expect { timeout { fail "(timeout) help maint demangle" } } -# dump-me is disabled ifdef _WIN32. -if [ishost *cygwin*] { - setup_xfail "*-*-*" -} send_gdb "help maint dump-me\n" gdb_expect { -re "Get fatal error; make debugger dump its core\\.\r\nGDB sets its handling of SIGQUIT back to SIG_DFL and then sends\r\nitself a SIGQUIT signal\\..*$gdb_prompt $"\ @@ -652,9 +695,6 @@ gdb_expect { #set oldtimeout $timeout #set timeout [expr $timeout + 300] -if [ishost *cygwin*] { - setup_xfail "*-*-*" -} send_gdb "maint dump-me\n" gdb_expect { -re "Should GDB dump core.*\\(y or n\\) $"\ -- Corinna Vinschen Cygwin Project Co-Leader Red Hat, Inc.