This is the mail archive of the gdb-patches@sources.redhat.com 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: [RFA] testsuite/gdb.base/maint.exp: Add relative pathname test and fix test for Cygwin


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.


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