From patchwork Thu Oct 26 15:25:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 23853 Received: (qmail 2404 invoked by alias); 26 Oct 2017 15:25:42 -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 2270 invoked by uid 89); 26 Oct 2017 15:25:42 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=loud, 0-0 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; Thu, 26 Oct 2017 15:25:40 +0000 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 92E48C04AC4D for ; Thu, 26 Oct 2017 15:25:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 92E48C04AC4D Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=palves@redhat.com Received: from cascais.lan (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1C2B57F5FE for ; Thu, 26 Oct 2017 15:25:38 +0000 (UTC) From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH v5 3/4] Add base 'enable/disable invalid location range' tests Date: Thu, 26 Oct 2017 16:25:34 +0100 Message-Id: <1509031535-17778-4-git-send-email-palves@redhat.com> In-Reply-To: <1509031535-17778-1-git-send-email-palves@redhat.com> References: <1509031535-17778-1-git-send-email-palves@redhat.com> This adds tests that exercise the "bad breakpoint number" paths. Specifically: - malformed ranges - use of explicit 0 as bp/loc number. - inverted ranges I'm adding this as a baseline to improve. This shows that there's a lot of inconsistency in GDB's output (e.g., "bad" vs "Bad"). Also, IMO, the "0-0" and inverted range cases should be loud errors. That and more will all be addressed in the next patch. gdb/testsuite/ChangeLog: yyyy-mm-dd Pedro Alves * gdb.cp/ena-dis-br-range.exp: Add tests. --- gdb/testsuite/gdb.cp/ena-dis-br-range.exp | 38 +++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/gdb/testsuite/gdb.cp/ena-dis-br-range.exp b/gdb/testsuite/gdb.cp/ena-dis-br-range.exp index a17ee46..0ebc45f 100644 --- a/gdb/testsuite/gdb.cp/ena-dis-br-range.exp +++ b/gdb/testsuite/gdb.cp/ena-dis-br-range.exp @@ -132,3 +132,41 @@ gdb_test_no_output "disable 2.8-6" gdb_test "info break" [make_info_breakpoint_reply_re y y y y y y] \ "breakpoint info disable 2.8-6" + +# Check that invalid/open ranges are handled correctly. +with_test_prefix "open range" { + gdb_test "disable -" "bad breakpoint number at or near: '-'" + gdb_test "disable -1" "bad breakpoint number at or near: '-1'" + gdb_test "disable 1-" "bad breakpoint number at or near: '1-'" + gdb_test "disable 1.-2" "Bad breakpoint location number '-2'" + gdb_test "disable 1.2-" "bad breakpoint number at or near: '2-'" + gdb_test "disable 1.-2-3" "Bad breakpoint location number '-2'" + gdb_test "disable 1-2-3" "bad breakpoint number at or near: '1-2-3'" +} + +with_test_prefix "dangling period" { + gdb_test "disable 2." "bad breakpoint number at or near: '2.'" + gdb_test "disable .2" "bad breakpoint number at or near: '.2'" + gdb_test "disable 2.3.4" "bad breakpoint number at or near '2.3.4'" +} + +# Check that 0s are handled correctly. +with_test_prefix "zero" { + gdb_test "disable 0" "bad breakpoint number at or near '0'" + gdb_test "disable 0.0" "Bad breakpoint number '0.0'" + gdb_test "disable 0.1" "Bad breakpoint number '0.1'" + gdb_test "disable 0.1-2" "Bad breakpoint number '0.1-2'" + gdb_test "disable 2.0" "bad breakpoint number at or near '2.0'" + + # These should really fail... + gdb_test_no_output "disable 2.0-0" + gdb_test_no_output "enable 2.0-0" + + gdb_test "disable 2.0-1" "Bad breakpoint location number '0'" + + # Likewise, should fail. + gdb_test_no_output "disable 2.1-0" +} + +gdb_test "info break" [make_info_breakpoint_reply_re y y y y y y] \ + "breakpoint info after invalids"