From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2121 invoked by alias); 22 May 2013 00:45:09 -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 2110 invoked by uid 89); 22 May 2013 00:45:08 -0000 X-Spam-SWARE-Status: No, score=-3.7 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.1 Received: from mail-qc0-f202.google.com (HELO mail-qc0-f202.google.com) (209.85.216.202) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Wed, 22 May 2013 00:45:07 +0000 Received: by mail-qc0-f202.google.com with SMTP id d1so143696qcz.1 for ; Tue, 21 May 2013 17:45:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=date:message-id:from:to:subject:x-gm-message-state; bh=/BgNo+1tEPZ7/GalzmWuOnaLOsMSW7K5CrEz7DUEjf0=; b=Gvz5RMhMeuU0424vF2q1K5yfjxC7WGBvtk6mHXx9xdKOX9W2R8x6Ppy6xOlb/4fh7h gwlQPmjLbsxDYawvK1+GElfymXYapBi3jmuaF7xB4ZMJZXpVyspYzHNZcfSfV1TQhIBO vHGuRwvaA2ZbpSk9G0mdWVdOmPU4ByJYljZ8N97kuAgyDkOW9YYOiYPN+A8BrOpmQONe RgogJD7nPp0aRUFVxkIgrNojP1yFVbKIC0KEdPJ5IGWrVJOF5QzW0uTAU1hPymilcjiL fqKIa1Z5REcbXOnQaGPI+Shc0aRYR/eM5zKfoMPXQVl445atP3YeF8TeIAOhcycDka9m LOuA== X-Received: by 10.236.151.133 with SMTP id b5mr2436838yhk.49.1369183505715; Tue, 21 May 2013 17:45:05 -0700 (PDT) Received: from corp2gmr1-1.hot.corp.google.com (corp2gmr1-1.hot.corp.google.com [172.24.189.92]) by gmr-mx.google.com with ESMTPS id h2si435965yhj.2.2013.05.21.17.45.05 for (version=TLSv1.1 cipher=AES128-SHA bits=128/128); Tue, 21 May 2013 17:45:05 -0700 (PDT) Received: from ruffy2.mtv.corp.google.com (ruffy2.mtv.corp.google.com [172.17.128.107]) by corp2gmr1-1.hot.corp.google.com (Postfix) with ESMTP id 55C0831C230 for ; Tue, 21 May 2013 17:45:05 -0700 (PDT) Date: Wed, 22 May 2013 00:45:00 -0000 Message-Id: From: Doug Evans To: gdb-patches@sourceware.org Subject: [RFC] Support temporary breakpoints in runto_main. X-Gm-Message-State: ALoCoQklPUG/4G86kEqtfq+CWupAbIZ8JKwJwuon9GUvr3Cbwh60y9EUbgzySuYobNht9H6PcN7nxQB5I8wUx9y5d6WjYnL+HvgULxnDDd4TMmnuGUQOY0C+kPnC6Fvcl5daAtmU9QlmFRayCry8PsAvX1Pgqg18hpsVU/GM/Kd+owngtVaWe2quilNejhUL7l6yJz6BuFvR6PS/Wb1N+pl5LhjCVjvVDCmFdalSgmG7KmBVtQJGpg8= X-SW-Source: 2013-05/txt/msg00799.txt.bz2 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". 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 00:44:01 -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 [runto main $args] } ### Continue, and expect to hit a breakpoint.