From patchwork Sun Oct 12 19:43:28 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kratochvil X-Patchwork-Id: 3207 Received: (qmail 20972 invoked by alias); 12 Oct 2014 19:43:38 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 20963 invoked by uid 89); 12 Oct 2014 19:43:38 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.0 required=5.0 tests=AWL, BAYES_00, SPF_HELO_PASS, SPF_PASS, T_RP_MATCHES_RCVD 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 (AES256-GCM-SHA384 encrypted) ESMTPS; Sun, 12 Oct 2014 19:43:37 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s9CJhXAx006286 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Sun, 12 Oct 2014 15:43:33 -0400 Received: from host2.jankratochvil.net (ovpn-116-34.ams2.redhat.com [10.36.116.34]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s9CJhS2H014413 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=NO); Sun, 12 Oct 2014 15:43:31 -0400 Date: Sun, 12 Oct 2014 21:43:28 +0200 From: Jan Kratochvil To: Yao Qi Cc: gdb-patches@sourceware.org, Miroslav Franc Subject: [patchv2] save breakpoints does not save signal catchpoints correctly Message-ID: <20141012194328.GA15430@host2.jankratochvil.net> References: <20141003203219.GA30562@host2.jankratochvil.net> <87r3yhs6sr.fsf@codesourcery.com> <20141009175452.GA26010@host2.jankratochvil.net> <87y4soivu2.fsf@codesourcery.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <87y4soivu2.fsf@codesourcery.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-IsSubscribed: yes On Fri, 10 Oct 2014 02:59:01 +0200, Yao Qi wrote: > I didn't mean to compare two lists. We only have one list here, and we > can check each element in it, for example, Done. Thanks, Jan gdb/ 2014-10-03 Miroslav Franc Jan Kratochvil Fix "save breakpoints" for "catch" command. * break-catch-sig.c (signal_catchpoint_print_recreate): Add trailing newline. gdb/testsuite/ 2014-10-12 Jan Kratochvil Yao Qi Fix "save breakpoints" for "catch" command. * gdb.base/catch-signal.exp: Add gdb_breakpoint "main". Remove -nonewline. Match also the added "main" line. diff --git a/gdb/break-catch-sig.c b/gdb/break-catch-sig.c index c41bf33..579fb78 100644 --- a/gdb/break-catch-sig.c +++ b/gdb/break-catch-sig.c @@ -346,6 +346,7 @@ signal_catchpoint_print_recreate (struct breakpoint *b, struct ui_file *fp) } else if (c->catch_all) fprintf_unfiltered (fp, " all"); + fputc_unfiltered ('\n', fp); } /* Implement the "explains_signal" breakpoint_ops method for signal diff --git a/gdb/testsuite/gdb.base/catch-signal.exp b/gdb/testsuite/gdb.base/catch-signal.exp index 22caf40..616b2a8 100644 --- a/gdb/testsuite/gdb.base/catch-signal.exp +++ b/gdb/testsuite/gdb.base/catch-signal.exp @@ -117,6 +117,7 @@ foreach {arg desc} {"" "standard signals" \ "set catchpoint '$arg' for printing" gdb_test "info break" "$decimal.*catchpoint.*signal.*$desc.*" \ "info break for '$arg'" + gdb_breakpoint "main" gdb_test "save breakpoints [standard_output_file bps.$i]" \ "Saved to file .*bps.$i.*" \ "save breakpoints for '$arg'" @@ -124,7 +125,8 @@ foreach {arg desc} {"" "standard signals" \ set filename [remote_upload host [standard_output_file bps.$i] \ [standard_output_file bps-local.$i]] set fd [open $filename] - set contents [read -nonewline $fd] + set file_data [read $fd] + set data [split $file_data "\n"] close $fd if {$arg == ""} { @@ -132,11 +134,17 @@ foreach {arg desc} {"" "standard signals" \ } else { set pattern "catch signal $arg" } - if {[string match $pattern $contents]} { - pass "results of save breakpoints for '$arg'" - } else { - fail "results of save breakpoints for '$arg'" - } + gdb_assert {[expr [llength $data] == 3]} \ + "Number of lines of save breakpoints for '$arg'" + # Check the first line. + gdb_assert {[string match $pattern [lindex $data 0]]} \ + "1st line of save breakpoints for '$arg'" + # Check the second line. + gdb_assert {[string match "break main" [lindex $data 1]]} \ + "2nd line of save breakpoints for '$arg'" + # Check the trailing newline. + gdb_assert {[string match "" [lindex $data 2]]} \ + "Trailing newline of save breakpoints for '$arg'" incr i }