From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7353 invoked by alias); 27 Sep 2016 20:12:09 -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 7343 invoked by uid 89); 27 Sep 2016 20:12:08 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.6 required=5.0 tests=AWL,BAYES_20,RCVD_IN_DNSWL_NONE,SPF_SOFTFAIL autolearn=no version=3.3.2 spammy=U*gdb, pstate, CUT, approximately X-HELO: telf.telf.com Received: from tel.telf.com (HELO telf.telf.com) (192.254.205.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 27 Sep 2016 20:11:58 +0000 Received: from rrcs-70-60-125-182.midsouth.biz.rr.com ([70.60.125.182]:59615 helo=[10.0.9.33]) by telf.telf.com with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.80.1) (envelope-from ) id 1boyjM-0007Nr-Cg; Tue, 27 Sep 2016 16:11:56 -0400 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Subject: Re: Restored Objective-C language support From: Giah de Barag Date: Tue, 27 Sep 2016 21:03:00 -0000 Cc: Tom Tromey Content-Transfer-Encoding: 7bit Message-Id: <4B6B73EF-8E5A-41CF-9C81-B98852136C37@crelg.com> References: <7A49D05A-EC2C-40A9-B454-AC6B8810DF31@crelg.com> To: GDB Patches X-Get-Message-Sender-Via: telf.telf.com: authenticated_id: gdb@crelg.com X-SW-Source: 2016-09/txt/msg00383.txt.bz2 2016-09-27 Giah de Barag Summary ------- This new patch restores a newly-discovered removed piece of objective-c language support. This piece (like those previously reported) seems to have been inadvertently removed when objc-eval.y was deleted. Problem Behavior ---------------- This problem surfaces when typecasting an object pointer to a class type (in order to dereference it and examine its member variables). (gdb) p (NSAutoreleasePool *)pool A syntax error in expression, near `NSAutoreleasePool *)pool'. (gdb) Correction ---------- Applying this patch corrects the problem by simply restoring a rule from objc-eval.y (that was lost when objc-eval.y was deleted). Corrected Behavior ------------------ After applying the patch, the problem disappears and the missing language support reappears. Here is a pointer to an object being typecast in order to be dereferenced. (gdb) p (NSAutoreleasePool *)pool $2 = (struct NSAutoreleasePool *) 0x6e0a58 (gdb) p *$ $3 = { { isa = 0x671fee80 <_OBJC_Class_NSAutoreleasePool> }, _parent = 0x0, _child = 0x0, _released = 0x4c15818, _released_head = 0x6e1178, _released_count = 8889, _addImp = 0x670219fa <-[NSAutoreleasePool addObject:]>, _internal = 0x0 } (gdb) Patch ----- Here is the patch. It restores one rule from objc-eval.y. ----- CUT HERE ----- diff --git a/gdb/c-exp.y b/gdb/c-exp.y @@ -1216,6 +1221,14 @@ type : ptype typebase /* Implements (approximately): (type-qualifier)* type-specifier */ : TYPENAME { $$ = $1.type; } + | CLASSNAME + { + if ($1.type == NULL) + error ("No symbol \"%s\" in current context.", + copy_name($1.stoken)); + else + $$ = $1.type; + } | INT_KEYWORD { $$ = lookup_signed_typename (parse_language (pstate), parse_gdbarch (pstate), ----- CUT HERE -----