From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25322 invoked by alias); 4 Apr 2014 16:55:46 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 25309 invoked by uid 89); 4 Apr 2014 16:55:46 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 04 Apr 2014 16:55:44 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s34Gte8Y029811 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 4 Apr 2014 12:55:41 -0400 Received: from valrhona.uglyboxes.com (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s34GtdHW025485 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Fri, 4 Apr 2014 12:55:40 -0400 Message-ID: <533EE40B.8000607@redhat.com> Date: Fri, 04 Apr 2014 16:55:00 -0000 From: Keith Seitz User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0 MIME-Version: 1.0 To: Hui Zhu , gdb-patches ml Subject: Re: [PATCH] Fix annota1.exp: run until main breakpoint in some pc References: <533E84B7.6050303@mentor.com> In-Reply-To: <533E84B7.6050303@mentor.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2014-04/txt/msg00073.txt.bz2 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