From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26199 invoked by alias); 22 May 2013 07:34:36 -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 26181 invoked by uid 89); 22 May 2013 07:34:34 -0000 X-Spam-SWARE-Status: No, score=-4.5 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.1 Received: from mail-gh0-f202.google.com (HELO mail-gh0-f202.google.com) (209.85.160.202) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Wed, 22 May 2013 07:34:33 +0000 Received: by mail-gh0-f202.google.com with SMTP id g24so166814ghb.5 for ; Wed, 22 May 2013 00:34:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:mime-version:content-type:content-transfer-encoding:message-id :date:to:subject:in-reply-to:references:x-mailer:x-gm-message-state; bh=UL6SdL8gVavSkxXZ+qbJjRsPnZWK24XvS0alti6lKiA=; b=WxMN74XisL1U42Ykr0K87xPgIaJVTPR/Nn3mGMI0m+kBRgXvg8lAXJLueolkjaditL Uvutmph1lwozLGQgfm1Q2OkOmNgASaXCM/OT07YhPpZ/A1nnSIVJTzZiJfUxRgha9oq7 iE9uhxYb4MK9HlYUjhDQqnt3D10I1ceE3njaAHPMscwVGGJbV1V44S20bhL9anuo9C1G BjpTdZb00MC4bwxW6nmjefbMREW7Hjh78fHrTpAKREqdnACUkiz3SZ+KVc8qhKMm+F0L GPMhHHEGOR+dDJxyTm21psb/wsTBZTV8TnCPPsyK8VX3yPLjT3DgKRy4EuLqjwjpVnDM qbhQ== X-Received: by 10.236.84.177 with SMTP id s37mr2700511yhe.37.1369208071973; Wed, 22 May 2013 00:34:31 -0700 (PDT) Received: from corp2gmr1-2.hot.corp.google.com (corp2gmr1-2.hot.corp.google.com [172.24.189.93]) by gmr-mx.google.com with ESMTPS id n23si538864yhi.7.2013.05.22.00.34.31 for (version=TLSv1.1 cipher=AES128-SHA bits=128/128); Wed, 22 May 2013 00:34:31 -0700 (PDT) Received: from ruffy2.mtv.corp.google.com (ruffy2.mtv.corp.google.com [172.17.128.107]) by corp2gmr1-2.hot.corp.google.com (Postfix) with ESMTP id 90BF05A41F3 for ; Wed, 22 May 2013 00:34:31 -0700 (PDT) From: Doug Evans MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <20892.29958.954822.19459@ruffy2.mtv.corp.google.com> Date: Wed, 22 May 2013 07:34:00 -0000 To: gdb-patches@sourceware.org Subject: Re: [RFC] Support temporary breakpoints in runto_main. In-Reply-To: References: X-Gm-Message-State: ALoCoQkSTnTofzsNoMGnZ7xX+mJM7eizaBrpnL+/KJfZ7hfDsC/OsjHCTZBk7dQ27x5jXL0XpLRUJhiZE0MbcDZza7EwNKxmdQSo4iHATV5SszJdx5Tr6Cdv0aDvlKbtbiHjmQRm0jMMkOHPmxM25Ny6Ijk7qc4x3JyhLC/PTsrgB0ZHyfMW46x66d7ldbBIo63oCzw0CuLEYXlVSZBLd6WQK13bHooYETkEGEFNy5eUZgVLk3gynK8= X-SW-Source: 2013-05/txt/msg00811.txt.bz2 Doug Evans writes: > Hi. > > If I imagine I'm new to gdb and see the name runto_main I can well > imagine not expecting the implementation of that command to leave the > breakpoint behind. > Leaving the breakpoint behind is not something I would expect from that name. > > Thus to me I think the default for runto_main should be to use > a temporary breakpoint. However, there are several tests that > have been written that assume it does. > > And, there is one test that assumed it didn't: wp-replication.exp. > But that I fixed differently: > http://sourceware.org/ml/gdb-patches/2013-05/msg00797.html > > This patch adds the ability to use temporary breakpoints, > and makes the default "permanent". Thought it would be easy > to switch the default once all the various tests are updated. > > This is only RFC as I'm happy to check it in, but it's not something > that "fixes" a bug or is currently useful. > > 2013-05-21 Doug Evans > > * lib/gdb.exp (gdb_breakpoint): New option "permanent". > (runto): Ditto. > (runto_main): New argument "args". Blech. Gotta love tcl varargs. Here's a revised patch. 2013-05-21 Doug Evans * lib/gdb.exp (gdb_breakpoint): New option "permanent". (runto): Ditto. (runto_main): New argument "args". Index: testsuite/lib/gdb.exp =================================================================== RCS file: /cvs/src/src/gdb/testsuite/lib/gdb.exp,v retrieving revision 1.231 diff -u -p -r1.231 gdb.exp --- testsuite/lib/gdb.exp 6 May 2013 22:11:15 -0000 1.231 +++ testsuite/lib/gdb.exp 22 May 2013 07:18:52 -0000 @@ -336,14 +336,19 @@ proc gdb_start_cmd {args} { # Set a breakpoint at FUNCTION. If there is an additional argument it is # a list of options; the supported options are allow-pending, temporary, -# message, no-message, and passfail. +# permanent, message, no-message, and passfail. # The result is 1 for success, 0 for failure. # +# By default a permanent breakpoint is created. +# # Note: The handling of message vs no-message is messed up, but it's based # on historical usage. By default this function does not print passes, # only fails. # no-message: turns off printing of fails (and passes, but they're already off) # message: turns on printing of passes (and fails, but they're already on) +# +# If both temporary/permanent or message/no-message are specified, +# the last one wins. proc gdb_breakpoint { function args } { global gdb_prompt @@ -354,18 +359,20 @@ proc gdb_breakpoint { function args } { set pending_response y } - set break_command "break" - set break_message "Breakpoint" - if {[lsearch -exact $args temporary] != -1} { + set temporary_loc [lsearch -exact $args temporary] + set permanent_loc [lsearch -exact $args permanent] + if { $temporary_loc > $permanent_loc } { set break_command "tbreak" set break_message "Temporary breakpoint" + } else { + set break_command "break" + set break_message "Breakpoint" } set print_pass 0 set print_fail 1 set no_message_loc [lsearch -exact $args no-message] set message_loc [lsearch -exact $args message] - # The last one to appear in args wins. if { $no_message_loc > $message_loc } { set print_fail 0 } elseif { $message_loc > $no_message_loc } { @@ -430,6 +437,9 @@ proc gdb_breakpoint { function args } { # just compare to "function" because it might be a fully qualified, # single quoted C++ function specifier. # +# By default a permanent breakpoint is used. +# Override this by passing "temporary" in args. +# # If there are additional arguments, pass them to gdb_breakpoint. # We recognize no-message/message ourselves. # The default is no-message. @@ -444,8 +454,16 @@ proc runto { function args } { delete_breakpoints - # Default to "no-message". - set args "no-message $args" + # Default to "no-message" and "permanent". + set args "no-message permanent $args" + + set temporary_loc [lsearch -exact $args temporary] + set permanent_loc [lsearch -exact $args permanent] + if { $temporary_loc > $permanent_loc } { + set break_message "Temporary breakpoint" + } else { + set break_message "Breakpoint" + } set print_pass 0 set print_fail 1 @@ -474,13 +492,13 @@ proc runto { function args } { # the "at foo.c:36" output we get with -g. # the "in func" output we get without -g. gdb_expect 30 { - -re "Break.* at .*:$decimal.*$gdb_prompt $" { + -re "$break_message \[0-9\]*, .* at .*:$decimal.*$gdb_prompt $" { if { $print_pass } { pass $test_name } return 1 } - -re "Breakpoint \[0-9\]*, \[0-9xa-f\]* in .*$gdb_prompt $" { + -re "$break_message \[0-9\]*, \[0-9xa-f\]* in .*$gdb_prompt $" { if { $print_pass } { pass $test_name } @@ -525,12 +543,13 @@ proc runto { function args } { } # Ask gdb to run until we hit a breakpoint at main. +# args is the same as for runto. # # N.B. This function deletes all existing breakpoints. # If you don't want that, use gdb_start_cmd. -proc runto_main { } { - return [runto main no-message] +proc runto_main { args } { + return [eval runto main $args] } ### Continue, and expect to hit a breakpoint.