From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18724 invoked by alias); 13 Dec 2011 21:13:02 -0000 Received: (qmail 18709 invoked by uid 22791); 13 Dec 2011 21:13:01 -0000 X-SWARE-Spam-Status: No, hits=-3.2 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 13 Dec 2011 21:12:48 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 80C362BB147; Tue, 13 Dec 2011 16:12:47 -0500 (EST) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id FcL+ig8subV2; Tue, 13 Dec 2011 16:12:47 -0500 (EST) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id AB8172BB144; Tue, 13 Dec 2011 16:12:46 -0500 (EST) Received: by joel.gnat.com (Postfix, from userid 1000) id E0AAE145615; Tue, 13 Dec 2011 13:12:45 -0800 (PST) From: Joel Brobecker To: gdb-patches@sourceware.org Cc: Joel Brobecker Subject: [RFC/RFA] Add handling for unqualified Ada operators in linespecs Date: Tue, 13 Dec 2011 21:24:00 -0000 Message-Id: <1323810763-5563-1-git-send-email-brobecker@adacore.com> 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 X-SW-Source: 2011-12/txt/msg00425.txt.bz2 Hello, This patch enhances the linespec parser to recognize unqualified operator names in linespecs. This allows the user to insert a breakpoint on operator "+" as follow, for instance: (gdb) break "+" Previously, it was possible to insert such a breakpoint, but one had to fully qualify the function name. For instance: (gdb) break ops."+" Not the most elegant solution, but relatively self contained. So I thought I'd submit it, after all. It's still not completely functional because, for it to work, it needs the symtabs to be already read-in (or, in other words, the partial symbol search is still not working). But that's actually another, much more general problem, which is related to breakpoints using unqualified function names in general. I will try to think about that on its own. gdb/ChangeLog: * linespec.c (locate_first_half): Add handling of Ada operators when the current language is Ada. Tested on x86_64-linux. It should also only affect Ada. OK to apply? --- gdb/linespec.c | 18 ++++++++++++++++++ 1 files changed, 18 insertions(+), 0 deletions(-) diff --git a/gdb/linespec.c b/gdb/linespec.c index 0ac54f7..2201be3 100644 --- a/gdb/linespec.c +++ b/gdb/linespec.c @@ -1334,6 +1334,24 @@ locate_first_half (char **argptr, int *is_quote_enclosed) char *p, *p1; int has_comma; + /* Check if the linespec starts with an Ada operator (such as "+", + or ">", for instance). */ + p = *argptr; + if (p[0] == '"' + && current_language->la_language == language_ada) + { + const struct ada_opname_map *op; + + for (op = ada_opname_table; op->encoded != NULL; op++) + if (strncmp (op->decoded, p, strlen (op->decoded)) == 0) + break; + if (op->encoded != NULL) + { + *is_quote_enclosed = 0; + return p + strlen (op->decoded); + } + } + /* Maybe we were called with a line range FILENAME:LINENUM,FILENAME:LINENUM and we must isolate the first half. Outer layers will call again later for the second half. -- 1.7.1