From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20685 invoked by alias); 7 Nov 2013 16:07:17 -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 20676 invoked by uid 89); 7 Nov 2013 16:07:16 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.1 required=5.0 tests=AWL,BAYES_00,RDNS_NONE,SPAM_SUBJECT,SPF_HELO_PASS,SPF_PASS,URIBL_BLOCKED autolearn=no version=3.3.2 X-HELO: mx1.redhat.com Received: from Unknown (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 07 Nov 2013 16:07:08 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id rA7G6wtZ018564 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 7 Nov 2013 11:06:59 -0500 Received: from barimba (ovpn-113-94.phx2.redhat.com [10.3.113.94]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id rA7G6uX5008454 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Thu, 7 Nov 2013 11:06:57 -0500 From: Tom Tromey To: Joel Brobecker Cc: gdb-patches@sourceware.org Subject: Re: [RFC/Ada 1/2] Add command to list Ada exceptions References: <1383836650-6104-1-git-send-email-brobecker@adacore.com> <1383836650-6104-2-git-send-email-brobecker@adacore.com> Date: Thu, 07 Nov 2013 16:11:00 -0000 In-Reply-To: <1383836650-6104-2-git-send-email-brobecker@adacore.com> (Joel Brobecker's message of "Thu, 7 Nov 2013 19:04:09 +0400") Message-ID: <87bo1wxkkf.fsf@fleche.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SW-Source: 2013-11/txt/msg00188.txt.bz2 >>>>> "Joel" == Joel Brobecker writes: Joel> (gdb) info exceptions Joel> All defined exceptions: Joel> constraint_error: 0x613dc0 Since the name of the command is unavoidably generic, how about adding "Ada" into the output somewhere, so that non-Ada users don't get confused when the command doesn't do anything useful for them? Like (gdb) info exceptions All defined Ada exceptions: constraint_error: 0x613dc0 Joel> + for (i = 0; i < sizeof (standard_exc) / sizeof (char *); i++) How about ARRAY_SIZE here? Joel> +static void Joel> +ada_add_exceptions_from_frame (regex_t *preg, struct frame_info *frame, Joel> + VEC(ada_exc_info) **exceptions) Joel> +{ [...] Joel> + if (BLOCK_FUNCTION (block)) The current style requires a "!= NULL" here. Joel> +VEC(ada_exc_info) * Joel> +ada_exceptions_list (char *regexp) I think regexp can be const. Joel> + if (regexp != NULL) Joel> + { Joel> + int status; Joel> + Joel> + preg = alloca (sizeof (regex_t)); Joel> + status = regcomp (preg, regexp, REG_NOSUB); Joel> + if (status != 0) Joel> + { Joel> + char *err = get_regcomp_error (status, preg); Joel> + Joel> + make_cleanup (xfree, err); Joel> + error (_("Invalid regexp (%s): %s"), err, regexp); Joel> + } Joel> + make_regfree_cleanup (preg); Joel> + } These days there is compile_rx_or_error, which wraps all this up. Joel> + printf_filtered (regexp Joel> + ? "All exceptions matching regular expression \"%s\":\n" Joel> + : "All defined exceptions:\n", regexp); This needs an explicit "== NULL". Tom