From: Giah de Barag <gdb@crelg.com>
To: GDB Patches <gdb-patches@sourceware.org>
Cc: Tom Tromey <tom@tromey.com>
Subject: Re: Restored Objective-C language support
Date: Tue, 27 Sep 2016 21:03:00 -0000 [thread overview]
Message-ID: <4B6B73EF-8E5A-41CF-9C81-B98852136C37@crelg.com> (raw)
In-Reply-To: <7A49D05A-EC2C-40A9-B454-AC6B8810DF31@crelg.com>
2016-09-27 Giah de Barag <gdb@crelg.com>
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 -----
next prev parent reply other threads:[~2016-09-27 20:12 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-13 21:21 Giah de Barag
2016-09-14 22:54 ` Tom Tromey
2016-09-15 0:31 ` Matt Rice
2016-09-15 19:12 ` Giah de Barag
2016-09-16 5:52 ` Giah de Barag
2016-09-27 21:03 ` Giah de Barag [this message]
2016-10-12 2:14 ` Tom Tromey
2016-09-14 6:09 Roland Schwingel
2016-09-14 7:25 ` Giah de Barag
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4B6B73EF-8E5A-41CF-9C81-B98852136C37@crelg.com \
--to=gdb@crelg.com \
--cc=gdb-patches@sourceware.org \
--cc=tom@tromey.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox