Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Corinna Vinschen <vinschen@redhat.com>
To: gdb-patches@sources.redhat.com
Subject: Re: [RFA] testsuite/gdb.base/maint.exp: Add relative pathname test and fix test for Cygwin
Date: Wed, 09 Feb 2005 17:02:00 -0000	[thread overview]
Message-ID: <20050209164557.GP2597@cygbert.vinschen.de> (raw)
In-Reply-To: <420A1A04.9010106@gnu.org>

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.


  reply	other threads:[~2005-02-09 16:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20050203125811.GA19985@cygbert.vinschen.de>
2005-02-09 14:54 ` Andrew Cagney
2005-02-09 17:02   ` Corinna Vinschen [this message]
2005-02-09 17:09     ` Andrew Cagney
2005-02-09 18:37       ` Corinna Vinschen

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=20050209164557.GP2597@cygbert.vinschen.de \
    --to=vinschen@redhat.com \
    --cc=gdb-patches@sources.redhat.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