From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15368 invoked by alias); 9 Oct 2002 00:30:29 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 15361 invoked from network); 9 Oct 2002 00:30:28 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sources.redhat.com with SMTP; 9 Oct 2002 00:30:28 -0000 Received: from int-mx2.corp.redhat.com (nat-pool-rdu-dmz.redhat.com [172.16.52.200]) by mx1.redhat.com (8.11.6/8.11.6) with ESMTP id g990AlX25401 for ; Tue, 8 Oct 2002 20:10:47 -0400 Received: from potter.sfbay.redhat.com (potter.sfbay.redhat.com [172.16.27.15]) by int-mx2.corp.redhat.com (8.11.6/8.11.6) with ESMTP id g990ULl01831; Tue, 8 Oct 2002 20:30:26 -0400 Received: from redhat.com (dhcp-172-16-25-149.sfbay.redhat.com [172.16.25.149]) by potter.sfbay.redhat.com (8.11.6/8.11.6) with ESMTP id g990ULN30933; Tue, 8 Oct 2002 17:30:21 -0700 Message-ID: <3DA37857.466240D9@redhat.com> Date: Tue, 08 Oct 2002 17:30:00 -0000 From: Michael Snyder Organization: Red Hat, Inc. X-Accept-Language: en MIME-Version: 1.0 To: Adam Fedor CC: gdb-patches@sources.redhat.com Subject: Re: [PATCH] Objective-C language support. References: <3D889A97.90202@doc.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-SW-Source: 2002-10/txt/msg00200.txt.bz2 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, if no one objects in a few days, let's check in the following subset of your valops.c changes. This is transparent to anyone who isn't debugging objective c (and for those who are, it simply allows the use of "self" in place of "this"). Note that some of the valops.c changes are not included in this approval. > * valops.c (value_of_local): New function. > (value_of_this): Use it. > Index: gdb/valops.c > =================================================================== > RCS file: /cvs/src/src/gdb/valops.c,v > retrieving revision 1.72 > diff -u -p -r1.72 valops.c > --- gdb/valops.c 14 Sep 2002 02:09:39 -0000 1.72 > +++ gdb/valops.c 17 Sep 2002 19:31:14 -0000 > @@ -3231,18 +3245,17 @@ value_full_object (struct value *argp, s > > > > -/* C++: return the value of the class instance variable, if one exists. > +/* Return the value of the local variable, if one exists. > Flag COMPLAIN signals an error if the request is made in an > inappropriate context. */ > > struct value * > -value_of_this (int complain) > +value_of_local (const char *name, int complain) > { > struct symbol *func, *sym; > struct block *b; > int i; > - static const char funny_this[] = "this"; > - struct value *this; > + struct value * ret; > > if (selected_frame == 0) > { > @@ -3256,7 +3269,7 @@ value_of_this (int complain) > if (!func) > { > if (complain) > - error ("no `this' in nameless context"); > + error ("no %s in nameless context", name); > else > return 0; > } > @@ -3266,26 +3279,39 @@ value_of_this (int complain) > if (i <= 0) > { > if (complain) > - error ("no args, no `this'"); > + error ("no args, no %s", name); > else > return 0; > } > > /* Calling lookup_block_symbol is necessary to get the LOC_REGISTER > symbol instead of the LOC_ARG one (if both exist). */ > - sym = lookup_block_symbol (b, funny_this, NULL, VAR_NAMESPACE); > + sym = lookup_block_symbol (b, name, NULL, VAR_NAMESPACE); > if (sym == NULL) > { > if (complain) > - error ("current stack frame not in method"); > + error ("current stack frame does not contain a variable named \"%s\"", name); > else > return NULL; > } > > - this = read_var_value (sym, selected_frame); > - if (this == 0 && complain) > - error ("`this' argument at unknown address"); > - return this; > + ret = read_var_value (sym, selected_frame); > + if (ret == 0 && complain) > + error ("%s argument unreadable", name); > + return ret; > +} > + > +/* C++/Objective-C: return the value of the class instance variable, > + if one exists. Flag COMPLAIN signals an error if the request is > + made in an inappropriate context. */ > + > +struct value * > +value_of_this (int complain) > +{ > + if (current_language->la_language == language_objc) > + return value_of_local ("self", complain); > + else > + return value_of_local ("this", complain); > } > > /* Create a slice (sub-string, sub-array) of ARRAY, that is LENGTH elements