From mboxrd@z Thu Jan 1 00:00:00 1970 From: Fernando Nasser To: Michael Snyder , Stan Shebs , Fernando Nasser , gdb@sources.redhat.com, vinschen@redhat.com Subject: Re: Stabs or Dwarf Was: [PATCH]: testsuite/gdb.base/constvars.exp Date: Thu, 27 Sep 2001 12:58:00 -0000 Message-id: <3BB383EF.8DB94CF@redhat.com> References: <20010925192434.M29024@cygbert.vinschen.de> <3BB0C224.AB324D56@cygnus.com> <3BB0CB81.8385E123@redhat.com> <3BB0F122.3E45B3ED@cygnus.com> <3BB236BB.F50E045E@cygnus.com> <3BB24ABF.1072EE55@apple.com> <3BB24F75.A33E707E@redhat.com> <3BB2553F.8A639565@cygnus.com> <3BB31D00.71964047@redhat.com> X-SW-Source: 2001-09/msg00264.html Well, Jim Blandy pointed out that there is already a get_debug_format (it is used in ptype.exp, list.exp and in half a dozen of the C++ test files). It uses the "info source" command that Michael mentioned (so it is as reliable as "info source" is). For convenience, there is also a setup_xfail_format that causes the following test to fail if the debug format is the one specified. As Michael Snyder pointed out in another list, we actually have concluded that we should do the opposite: xfail if _not_ the specified format ;-) Anyway, it is simple to test for DWARF2 or any other that we know we can detect more reliably and that can accommodate the tests and xfail for all the others. Thanks to all for the suggestions. Here is the code for the function: global debug_format set debug_format "unknown" # Run the gdb command "info source" and extract the debugging format # information from the output and save it in debug_format. proc get_debug_format { } { global gdb_prompt global verbose global expect_out global debug_format set debug_format "unknown" send_gdb "info source\n" gdb_expect 10 { -re "Compiled with (.*) debugging format.\r\n$gdb_prompt $" { set debug_format $expect_out(1,string) verbose "debug format is $debug_format" return 1; } -re "No current source file.\r\n$gdb_prompt $" { perror "get_debug_format used when no current source file" return 0; } -re "$gdb_prompt $" { warning "couldn't check debug format (no valid response)." return 1; } timeout { warning "couldn't check debug format (timed out)." return 1; } } } -- Fernando Nasser Red Hat Canada Ltd. E-Mail: fnasser@redhat.com 2323 Yonge Street, Suite #300 Toronto, Ontario M4P 2C9