* Re: [RFA] testsuite/gdb.base/maint.exp: Add relative pathname test and fix test for Cygwin [not found] <20050203125811.GA19985@cygbert.vinschen.de> @ 2005-02-09 14:54 ` Andrew Cagney 2005-02-09 17:02 ` Corinna Vinschen 0 siblings, 1 reply; 4+ messages in thread From: Andrew Cagney @ 2005-02-09 14:54 UTC (permalink / raw) To: gdb-patches 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 ... > This patch also tweaks maint.exp to get useful results also on Cygwin: > > - So far, the "help maint dump-me" and "maint dump-me" tests are > marked XFAIL on Cygwin. That's not necessary anymore, so I removed > the XFAIL settings. Ya! An audit of the entire testsuite/ pulling any other similar XFAILs would be treated as obvious ;-) > - The timeout value is raised, because printing all the symbols and > statistical information about Cygwin and Windows libraries takes a lot > of time. .... should be added here as a comment and made cygwin only. > > +set oldtimeout $timeout > +set timeout [expr $timeout + 500] > > send_gdb "maint print statistics\n" > gdb_expect { > @@ -316,6 +318,49 @@ gdb_expect { > timeout { fail "(timeout) maint print msymbols" } > } > > +# Check that maint print msymbols allows relative pathnames > +set mydir [pwd] Can you change these new tests to use gdb_test_multiple, unlike gdb_send/gdb_expect, that handles internal errors, timeouts, and similar directly so is much more robust. For indentation, I'd just use the style ..... { commands } (yes I know the existing file is totally inconsistent in both those regards, lets get the new code right :-) > +send_gdb "cd ${objdir}\n" > +gdb_expect { > + -re "Working directory ${objdir}\..*$gdb_prompt $" \ > + { pass "cd into objdir" } > + -re ".*$gdb_prompt $" \ > + { fail "cd into objdir" } > + timeout { fail "(timeout) cd into objdir" } > +} > +send_gdb "maint print msymbols msymbols_output ${subdir}/${testfile}\n" > +gdb_expect { > + -re "^maint print msymbols msymbols_output \[^\n\]*\r\n$gdb_prompt $"\ > + { > + send_gdb "shell ls msymbols_output\n" > + gdb_expect { > + -re "msymbols_output\r\n$gdb_prompt $"\ > + { > + send_gdb "shell grep factorial msymbols_output\n" > + gdb_expect { > + -re "\\\[ *$decimal\\\] T\[ \t\]+$hex factorial.*$gdb_prompt $"\ > + { pass "maint print msymbols rel-path" } > + -re ".*$gdb_prompt $" { fail "maint print msymbols rel-path" } > + timeout { fail "(timeout) maint print msymbols rel-path" } > + } > + gdb_test "shell rm -f msymbols_output" "" > + > + } > + -re ".*$gdb_prompt $" { fail "maint print msymbols rel-path" } > + timeout { fail "(timeout) maint print msymbols rel-path" } > + } > + } > + -re ".*$gdb_prompt $" { fail "maint print msymbols rel-path" } > + timeout { fail "(timeout) maint print msymbols rel-path" } > + } > +send_gdb "cd ${mydir}\n" > +gdb_expect { > + -re "Working directory ${mydir}\..*$gdb_prompt $" \ > + { pass "cd into objdir" } > + -re ".*$gdb_prompt $" \ > + { fail "cd into objdir" } > + timeout { fail "(timeout) cd into objdir" } > +} > > send_gdb "maint print symbols\n" > gdb_expect { > @@ -421,6 +466,7 @@ gdb_expect { > > # Test for new option: DATA section flag > # If your text section is tagged DATA, xfail this test. Again with this ... > - The "maint info sections DATA" test is marked for XFAIL on Cygwin, > because Windows has text sections marked DATA. Andrew ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [RFA] testsuite/gdb.base/maint.exp: Add relative pathname test and fix test for Cygwin 2005-02-09 14:54 ` [RFA] testsuite/gdb.base/maint.exp: Add relative pathname test and fix test for Cygwin Andrew Cagney @ 2005-02-09 17:02 ` Corinna Vinschen 2005-02-09 17:09 ` Andrew Cagney 0 siblings, 1 reply; 4+ messages in thread From: Corinna Vinschen @ 2005-02-09 17:02 UTC (permalink / raw) To: gdb-patches 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. ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [RFA] testsuite/gdb.base/maint.exp: Add relative pathname test and fix test for Cygwin 2005-02-09 17:02 ` Corinna Vinschen @ 2005-02-09 17:09 ` Andrew Cagney 2005-02-09 18:37 ` Corinna Vinschen 0 siblings, 1 reply; 4+ messages in thread From: Andrew Cagney @ 2005-02-09 17:09 UTC (permalink / raw) To: Corinna Vinschen; +Cc: gdb-patches Um, I've so far only looked at this: > 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. not this > ChangeLog: > > * symmisc.c: Include gdb_stat.h. > (maintenance_print_msymbols): Use inode numbers to compare files. Andrew ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [RFA] testsuite/gdb.base/maint.exp: Add relative pathname test and fix test for Cygwin 2005-02-09 17:09 ` Andrew Cagney @ 2005-02-09 18:37 ` Corinna Vinschen 0 siblings, 0 replies; 4+ messages in thread From: Corinna Vinschen @ 2005-02-09 18:37 UTC (permalink / raw) To: gdb-patches On Feb 9 12:03, Andrew Cagney wrote: > Um, I've so far only looked at this: > > > 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. > > not this > > >ChangeLog: > > > > * symmisc.c: Include gdb_stat.h. > > (maintenance_print_msymbols): Use inode numbers to compare files. > > Andrew Oh, sorry. I wouldn't have expected that, since the maint.exp patch doesn't make any sense without the symmisc.c patch. Corinna -- Corinna Vinschen Cygwin Project Co-Leader Red Hat, Inc. ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2005-02-09 17:08 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20050203125811.GA19985@cygbert.vinschen.de>
2005-02-09 14:54 ` [RFA] testsuite/gdb.base/maint.exp: Add relative pathname test and fix test for Cygwin Andrew Cagney
2005-02-09 17:02 ` Corinna Vinschen
2005-02-09 17:09 ` Andrew Cagney
2005-02-09 18:37 ` Corinna Vinschen
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox