This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [PATCH] Objective-C language support.
- From: Michael Snyder <msnyder at redhat dot com>
- To: Adam Fedor <fedor at doc dot com>
- Cc: gdb-patches at sources dot redhat dot com
- Date: Tue, 08 Oct 2002 17:12:56 -0700
- Subject: Re: [PATCH] Objective-C language support.
- Organization: Red Hat, Inc.
- References: <3D889A97.90202@doc.com>
Adam Fedor wrote:
>
> This patch adds Objective-C language support to gdb based upon a patch
> provided by Apple Computer Inc from their version of gdb. Note that the
> patch only contains changes to existing files. New files (objc-lang.h,
> objc-lang.c, objc-exp.y) and a gdb.objc testsuite directory are located at
>
> ftp://ftp.gnustep.org/pub/gnustep/contrib/gdb-objc-patch.tar.gz
Adam, these changes have no effect on anyone who is not debugging
objective c. They can go in as soon as the appropriate enum values
definitions are in.
> * parse.c: (length_of_subexp, prefixify_subexp): Handle
> OP_MSGCALL, OP_SELECTOR, OP_NSSTRING, and OP_SELF.
> Index: gdb/parse.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/parse.c,v
> retrieving revision 1.25
> diff -u -p -r1.25 parse.c
> --- gdb/parse.c 21 Jun 2002 14:32:10 -0000 1.25
> +++ gdb/parse.c 17 Sep 2002 19:30:53 -0000
> @@ -867,6 +867,11 @@ length_of_subexp (register struct expres
> args = 1 + longest_to_int (expr->elts[endpos - 2].longconst);
> break;
>
> + case OP_MSGCALL: /* Objective C message (method) call */
> + oplen = 4;
> + args = 1 + longest_to_int (expr->elts[endpos - 2].longconst);
> + break;
> +
> case UNOP_MAX:
> case UNOP_MIN:
> oplen = 3;
> @@ -898,6 +903,8 @@ length_of_subexp (register struct expres
> /* fall through */
> case OP_M2_STRING:
> case OP_STRING:
> + case OP_NSSTRING: /* Objective C Foundation Class NSString constant */
> + case OP_SELECTOR: /* Objective C "@selector" pseudo-op */
> case OP_NAME:
> case OP_EXPRSTRING:
> oplen = longest_to_int (expr->elts[endpos - 2].longconst);
> @@ -936,6 +943,7 @@ length_of_subexp (register struct expres
>
> /* C++ */
> case OP_THIS:
> + case OP_SELF:
> oplen = 2;
> break;
>
> @@ -1004,6 +1012,11 @@ prefixify_subexp (register struct expres
> args = 1 + longest_to_int (inexpr->elts[inend - 2].longconst);
> break;
>
> + case OP_MSGCALL: /* Objective C message (method) call */
> + oplen = 4;
> + args = 1 + longest_to_int (inexpr->elts[inend - 2].longconst);
> + break;
> +
> case UNOP_MIN:
> case UNOP_MAX:
> oplen = 3;
> @@ -1034,6 +1047,8 @@ prefixify_subexp (register struct expres
> /* fall through */
> case OP_M2_STRING:
> case OP_STRING:
> + case OP_NSSTRING: /* Objective C Foundation Class NSString constant */
> + case OP_SELECTOR: /* Objective C "@selector" pseudo-op */
> case OP_NAME:
> case OP_EXPRSTRING:
> oplen = longest_to_int (inexpr->elts[inend - 2].longconst);
> @@ -1072,6 +1087,7 @@ prefixify_subexp (register struct expres
>
> /* C++ */
> case OP_THIS:
> + case OP_SELF:
> oplen = 2;
> break;
>