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

Message ID 533E84B7.6050303@mentor.com
State New, archived
Headers

Commit Message

Hui Zhu April 4, 2014, 10:08 a.m. UTC
  [PATCH] Fix annota1.exp: run until main breakpoint in some pc

Got "FAIL: gdb.base/annota1.exp: new thread (timeout)" in some pc, because:
post-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".
  

Comments

Keith Seitz April 4, 2014, 4:55 p.m. UTC | #1
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
  

Patch

--- 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"
      }
  }