public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Fix annota1.exp: run until main breakpoint in some pc
@ 2014-04-04 10:09 Hui Zhu
  2014-04-04 16:55 ` Keith Seitz
  0 siblings, 1 reply; 2+ messages in thread
From: Hui Zhu @ 2014-04-04 10:09 UTC (permalink / raw)
  To: gdb-patches ml

[PATCH] Fix annota1.exp: run until main breakpoint in some pc

Got "FAIL: gdb.base/annota1.exp: new thread (timeout)" in some pc, because:
\x1a\x1apost-prompt
Starting program: /scratch/hzhu/zd3/obj/test-2014.05-999999-i686-pc-linux-gnu/host-i386-linux/default/gdb.d/gdb.base/annota1
warning: the debug information found in "/lib/ld-2.11.1.so" does not match "/lib/ld-linux.so.2" (CRC mismatch).
The warning line make this test get fail.

Make a patch that add "|.*warning: the debug information found in.*" to
test to handle this fail.

Thanks,
Hui

2014-04-04  Hui Zhu  <hui@codesourcery.com>

	* gdb.base/annota1.exp: Update test for "run until main
	breakpoint".

--- a/gdb/testsuite/gdb.base/annota1.exp
+++ b/gdb/testsuite/gdb.base/annota1.exp
@@ -129,7 +129,7 @@ gdb_test_multiple "info break" "breakpoi
  #exp_internal 1
  set binexp [string_to_regexp $binfile]
  gdb_test_multiple "run" "run until main breakpoint" {
-    -re "\r\n\032\032post-prompt\r\nStarting program: $binexp \(\r\nwarning: Skipping \[^\r\n\]+ .gdb_index section in \[^\r\n\]+\r\nDo \"set use-deprecated-index-sections on\" before the file is read\r\nto use the section anyway\\.\)?\(\(\r\n\r\n\032\032frames-invalid\)|\(\r\n\r\n\032\032breakpoints-invalid\)\)*\r\n\r\n\032\032starting\(\(\r\n\r\n\032\032frames-invalid\)|\(\r\n\r\n\032\032breakpoints-invalid\)\)*\r\n\r\n\032\032breakpoint 1\r\n\r\nBreakpoint 1, \r\n\032\032frame-begin 0 $hex\r\n\r\n\032\032frame-function-name\r\nmain\r\n\032\032frame-args\r\n \\(\\)\r\n\032\032frame-source-begin\r\n at \r\n\032\032frame-source-file\r\n.*annota1.c\r\n\032\032frame-source-file-end\r\n:\r\n\032\032frame-source-line\r\n$main_line\r\n\032\032frame-source-end\r\n\r\n\r\n\032\032source.*$srcfile:$main_line:.*:beg:$hex\r\n\r\n\032\032frame-end\r\n\r\n\032\032stopped.*$gdb_prompt$" {
+    -re "\r\n\032\032post-prompt\r\nStarting program: $binexp \(\r\nwarning: Skipping \[^\r\n\]+ .gdb_index section in \[^\r\n\]+\r\nDo \"set use-deprecated-index-sections on\" before the file is read\r\nto use the section anyway\\.\|.*warning: the debug information found in.*)?\(\(\r\n\r\n\032\032frames-invalid\)|\(\r\n\r\n\032\032breakpoints-invalid\)\)*\r\n\r\n\032\032starting\(\(\r\n\r\n\032\032frames-invalid\)|\(\r\n\r\n\032\032breakpoints-invalid\)\)*\r\n\r\n\032\032breakpoint 1\r\n\r\nBreakpoint 1, \r\n\032\032frame-begin 0 $hex\r\n\r\n\032\032frame-function-name\r\nmain\r\n\032\032frame-args\r\n \\(\\)\r\n\032\032frame-source-begin\r\n at \r\n\032\032frame-source-file\r\n.*annota1.c\r\n\032\032frame-source-file-end\r\n:\r\n\032\032frame-source-line\r\n$main_line\r\n\032\032frame-source-end\r\n\r\n\r\n\032\032source.*$srcfile:$main_line:.*:beg:$hex\r\n\r\n\032\032frame-end\r\n\r\n\032\032stopped.*$gdb_prompt$" {
  	pass "run until main breakpoint"
      }
  }

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Fix annota1.exp: run until main breakpoint in some pc
  2014-04-04 10:09 [PATCH] Fix annota1.exp: run until main breakpoint in some pc Hui Zhu
@ 2014-04-04 16:55 ` Keith Seitz
  0 siblings, 0 replies; 2+ messages in thread
From: Keith Seitz @ 2014-04-04 16:55 UTC (permalink / raw)
  To: Hui Zhu, gdb-patches ml

On 04/04/2014 03:08 AM, Hui Zhu wrote:
> --- a/gdb/testsuite/gdb.base/annota1.exp
> +++ b/gdb/testsuite/gdb.base/annota1.exp
> @@ -129,7 +129,7 @@ gdb_test_multiple "info break" "breakpoi
>   #exp_internal 1
>   set binexp [string_to_regexp $binfile]
>   gdb_test_multiple "run" "run until main breakpoint" {
> -    -re "\r\n\032\032post-prompt\r\nStarting program: $binexp
> \(\r\nwarning: Skipping \[^\r\n\]+ .gdb_index section in
> \[^\r\n\]+\r\nDo \"set use-deprecated-index-sections on\" before the
> file is read\r\nto use the section
> anyway\\.\)?\(\(\r\n\r\n\032\032frames-invalid\)|\(\r\n\r\n\032\032breakpoints-invalid\)\)*\r\n\r\n\032\032starting\(\(\r\n\r\n\032\032frames-invalid\)|\(\r\n\r\n\032\032breakpoints-invalid\)\)*\r\n\r\n\032\032breakpoint
> 1\r\n\r\nBreakpoint 1, \r\n\032\032frame-begin 0
> $hex\r\n\r\n\032\032frame-function-name\r\nmain\r\n\032\032frame-args\r\n \\(\\)\r\n\032\032frame-source-begin\r\n
> at
> \r\n\032\032frame-source-file\r\n.*annota1.c\r\n\032\032frame-source-file-end\r\n:\r\n\032\032frame-source-line\r\n$main_line\r\n\032\032frame-source-end\r\n\r\n\r\n\032\032source.*$srcfile:$main_line:.*:beg:$hex\r\n\r\n\032\032frame-end\r\n\r\n\032\032stopped.*$gdb_prompt$"
> {
> +    -re "\r\n\032\032post-prompt\r\nStarting program: $binexp
> \(\r\nwarning: Skipping \[^\r\n\]+ .gdb_index section in
> \[^\r\n\]+\r\nDo \"set use-deprecated-index-sections on\" before the
> file is read\r\nto use the section anyway\\.\|.*warning: the debug
> information found
> in.*)?\(\(\r\n\r\n\032\032frames-invalid\)|\(\r\n\r\n\032\032breakpoints-invalid\)\)*\r\n\r\n\032\032starting\(\(\r\n\r\n\032\032frames-invalid\)|\(\r\n\r\n\032\032breakpoints-invalid\)\)*\r\n\r\n\032\032breakpoint
> 1\r\n\r\nBreakpoint 1, \r\n\032\032frame-begin 0
> $hex\r\n\r\n\032\032frame-function-name\r\nmain\r\n\032\032frame-args\r\n \\(\\)\r\n\032\032frame-source-begin\r\n
> at
> \r\n\032\032frame-source-file\r\n.*annota1.c\r\n\032\032frame-source-file-end\r\n:\r\n\032\032frame-source-line\r\n$main_line\r\n\032\032frame-source-end\r\n\r\n\r\n\032\032source.*$srcfile:$main_line:.*:beg:$hex\r\n\r\n\032\032frame-end\r\n\r\n\032\032stopped.*$gdb_prompt$"
> {
>       pass "run until main breakpoint"
>       }
>   }

Since you are touching this, can I make an impassioned plea to replace 
this huge, incomprehensible mess with something a little more sane, 
using tcl lists, variable substitutions, and the join command? Like so:

set output_list {}
lappend output_list A
lappend output_list B
lappend output_list C
set expected [join $output_list "\r\n"]
gdb_test_multiple "run" run until main breakpoint" {
    -re $expected { pass "run until main breakpoint" }
    # ...
}

This is /phenomenally/ easier to read, modify, and figure what went 
wrong with a FAIL.

It is relatively easy to take this command and break it at line breaks, 
e.g., [please excuse me if my mail client wraps this]

{}
\032\032post-prompt
Starting program: $binexp \(\r\nwarning: Skipping \[^\r\n\]+ .gdb_index 
section in \[^\r\n\]+
Do \"set use-deprecated-index-sections on\" before the file is read\r\n
to use the section anyway\\.\|.*warning: the debug information found 
in.*)?\(\(\r\n\r\n\032\032frames-invalid\)|\(\r\n\r\n\032\032breakpoints-invalid\)\)*
{}
\032\032starting\(\(\r\n\r\n\032\032frames-invalid\)|\(\r\n\r\n\032\032breakpoints-invalid\)\)*
{}
\032\032breakpoint 1

and so on.

I would go so far as to set variables for all those optional warnings 
and annotations [to turn them into simpler regexps like 
"$skip_section_warning|$debug_info_warning"]. Likewise with the 
(repeated) "frames-invalid" and "breakpoints-invalid" annotations.

Of course, this is a bit beyond the original patch (which is okay), and 
therefore a maintainer may just advise that you ignore my plea, which 
you are welcome to do anyway. :-)

Keith

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-04-04 16:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-04 10:09 [PATCH] Fix annota1.exp: run until main breakpoint in some pc Hui Zhu
2014-04-04 16:55 ` Keith Seitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).