From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12763 invoked by alias); 18 Oct 2013 19:09:47 -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 12750 invoked by uid 89); 18 Oct 2013 19:09:47 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.4 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS 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 ESMTP; Fri, 18 Oct 2013 19:09:46 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r9IJ98fv011036 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 18 Oct 2013 15:09:08 -0400 Received: from host2.jankratochvil.net (ovpn-116-33.ams2.redhat.com [10.36.116.33]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r9IJ93DG028208 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Fri, 18 Oct 2013 15:09:06 -0400 Date: Fri, 18 Oct 2013 19:09:00 -0000 From: Jan Kratochvil To: Pierre Muller Cc: Keith Seitz , "gdb-patches@sourceware.org ml" , Sergio Durigan Junior , Tom Tromey Subject: [pascal patch] Use case_sensitive_off [Re: Regression for gdb.pascal/* [Re: [RFA 4/4] Constify parse_linesepc]] Message-ID: <20131018190903.GA15104@host2.jankratochvil.net> References: <5249C987.50809@redhat.com> <87d2no4uim.fsf@fleche.redhat.com> <524BA344.2070802@redhat.com> <20131016095743.GA17072@host2.jankratochvil.net> <52602A08.4020705@redhat.com> <87ob6ntyc4.fsf@fleche.redhat.com> <20131018172032.GA12122@host2.jankratochvil.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20131018172032.GA12122@host2.jankratochvil.net> User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes X-SW-Source: 2013-10/txt/msg00581.txt.bz2 On Fri, 18 Oct 2013 19:20:32 +0200, Jan Kratochvil wrote: > Case insensitive symbols should be supported (originally written for Fortran) > since: > commit 5b7743a275e4610fe6ea57f0c61e317490ee6854 > Date: Wed Apr 27 20:03:03 2011 +0000 > Case insensitive lookups implementation. > (+about one fallout later) > > While f_language_defn has case_sensitive_off > I see that pascal_language_defn has case_sensitive_on. p-exp.y currently contains: sym = lookup_symbol (tmp, expression_context_block, /* second chance uppercased (as Free Pascal does). */ sym = lookup_symbol (tmp, expression_context_block, /* Third chance Capitalized (as GPC does). */ sym = lookup_symbol (tmp, expression_context_block, which works for fpc -g or fpc -gw2 capitalizing the symbols. But it no longer works for -gw3 or -gw4 where fpc keeps the original case: <1><83>: Abbrev Number: 2 (DW_TAG_variable) <84> DW_AT_name : st with "set case-sensitive off" it works fine: (gdb) p st $1 = 0x626700 #13'Hello, world!' (gdb) p sT No symbol "sT" in current context. (gdb) set case-sensitive off warning: the current case sensitivity setting does not match the language. (gdb) p sT $2 = 0x626700 #13'Hello, world!' I do not know much about Pascal in GDB but do you think this is OK? The patch is on top of Keith's one. Thanks, Jan gdb/ 2013-10-18 Jan Kratochvil * p-exp.y (uptok): Remove variable i, remove the uppercasing. Update function comment. (yylex): Replace strcmp calls for strcasecmp. Remove uppercasing and capitalizing of symbols. * p-lang.c (pascal_language_defn): Use case_sensitive_off. diff --git a/gdb/p-exp.y b/gdb/p-exp.y index 8cb98c0..af338e1 100644 --- a/gdb/p-exp.y +++ b/gdb/p-exp.y @@ -1102,20 +1102,14 @@ static const struct token tokentab2[] = {":=", ASSIGN, BINOP_END}, {"::", COLONCOLON, BINOP_END} }; -/* Allocate uppercased var: */ -/* make an uppercased copy of tokstart. */ +/* Allocate a duplicate of NAMELEN length. */ + static char * uptok (const char *tokstart, int namelen) { - int i; char *uptokstart = (char *)malloc(namelen+1); - for (i = 0;i <= namelen;i++) - { - if ((tokstart[i]>='a' && tokstart[i]<='z')) - uptokstart[i] = tokstart[i]-('a'-'A'); - else - uptokstart[i] = tokstart[i]; - } + + memcpy (uptokstart, tokstart, namelen); uptokstart[namelen]='\0'; return uptokstart; } @@ -1448,29 +1442,29 @@ yylex (void) switch (namelen) { case 6: - if (strcmp (uptokstart, "OBJECT") == 0) + if (strcasecmp (uptokstart, "OBJECT") == 0) { free (uptokstart); return CLASS; } - if (strcmp (uptokstart, "RECORD") == 0) + if (strcasecmp (uptokstart, "RECORD") == 0) { free (uptokstart); return STRUCT; } - if (strcmp (uptokstart, "SIZEOF") == 0) + if (strcasecmp (uptokstart, "SIZEOF") == 0) { free (uptokstart); return SIZEOF; } break; case 5: - if (strcmp (uptokstart, "CLASS") == 0) + if (strcasecmp (uptokstart, "CLASS") == 0) { free (uptokstart); return CLASS; } - if (strcmp (uptokstart, "FALSE") == 0) + if (strcasecmp (uptokstart, "FALSE") == 0) { yylval.lval = 0; free (uptokstart); @@ -1478,13 +1472,13 @@ yylex (void) } break; case 4: - if (strcmp (uptokstart, "TRUE") == 0) + if (strcasecmp (uptokstart, "TRUE") == 0) { yylval.lval = 1; free (uptokstart); return TRUEKEYWORD; } - if (strcmp (uptokstart, "SELF") == 0) + if (strcasecmp (uptokstart, "SELF") == 0) { /* Here we search for 'this' like inserted in FPC stabs debug info. */ @@ -1542,44 +1536,6 @@ yylex (void) else sym = lookup_symbol (tmp, expression_context_block, VAR_DOMAIN, &is_a_field_of_this); - /* second chance uppercased (as Free Pascal does). */ - if (!sym && is_a_field_of_this.type == NULL && !is_a_field) - { - for (i = 0; i <= namelen; i++) - { - if ((tmp[i] >= 'a' && tmp[i] <= 'z')) - tmp[i] -= ('a'-'A'); - } - if (search_field && current_type) - is_a_field = (lookup_struct_elt_type (current_type, tmp, 1) != NULL); - if (is_a_field || parse_completion) - sym = NULL; - else - sym = lookup_symbol (tmp, expression_context_block, - VAR_DOMAIN, &is_a_field_of_this); - } - /* Third chance Capitalized (as GPC does). */ - if (!sym && is_a_field_of_this.type == NULL && !is_a_field) - { - for (i = 0; i <= namelen; i++) - { - if (i == 0) - { - if ((tmp[i] >= 'a' && tmp[i] <= 'z')) - tmp[i] -= ('a'-'A'); - } - else - if ((tmp[i] >= 'A' && tmp[i] <= 'Z')) - tmp[i] -= ('A'-'a'); - } - if (search_field && current_type) - is_a_field = (lookup_struct_elt_type (current_type, tmp, 1) != NULL); - if (is_a_field || parse_completion) - sym = NULL; - else - sym = lookup_symbol (tmp, expression_context_block, - VAR_DOMAIN, &is_a_field_of_this); - } if (is_a_field) { diff --git a/gdb/p-lang.c b/gdb/p-lang.c index 07006cd..a26c0c4 100644 --- a/gdb/p-lang.c +++ b/gdb/p-lang.c @@ -417,7 +417,7 @@ const struct language_defn pascal_language_defn = "pascal", /* Language name */ language_pascal, range_check_on, - case_sensitive_on, + case_sensitive_off, array_row_major, macro_expansion_no, &exp_descriptor_standard,