From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3563 invoked by alias); 1 Apr 2008 14:00:16 -0000 Received: (qmail 3542 invoked by uid 22791); 1 Apr 2008 14:00:14 -0000 X-Spam-Check-By: sourceware.org Received: from NaN.false.org (HELO nan.false.org) (208.75.86.248) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 01 Apr 2008 13:59:55 +0000 Received: from nan.false.org (localhost [127.0.0.1]) by nan.false.org (Postfix) with ESMTP id A447C983BE; Tue, 1 Apr 2008 13:59:53 +0000 (GMT) Received: from caradoc.them.org (22.svnf5.xdsl.nauticom.net [209.195.183.55]) by nan.false.org (Postfix) with ESMTP id 7CD2698119; Tue, 1 Apr 2008 13:59:53 +0000 (GMT) Received: from drow by caradoc.them.org with local (Exim 4.69) (envelope-from ) id 1Jgh1k-0003nb-O0; Tue, 01 Apr 2008 09:59:52 -0400 Date: Tue, 01 Apr 2008 14:10:00 -0000 From: Daniel Jacobowitz To: Vladimir Prus Cc: gdb-patches@sources.redhat.com Subject: Re: [RFA] Fix breakpoint condition that use member variables. Message-ID: <20080401135952.GB12753@caradoc.them.org> Mail-Followup-To: Vladimir Prus , gdb-patches@sources.redhat.com References: <200803221240.16230.vladimir@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200803221240.16230.vladimir@codesourcery.com> User-Agent: Mutt/1.5.17 (2007-12-11) X-IsSubscribed: yes 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 X-SW-Source: 2008-04/txt/msg00010.txt.bz2 Eli's raised a valid concern, but I think it's unrelated to this change, so I will review this patch independently of it. On Sat, Mar 22, 2008 at 12:40:15PM +0300, Vladimir Prus wrote: > - /* If this is non-NULL, lookup_symbol will do the 'field_of_this' > - check, using this function to find the value of this. */ > + /* If this is non-NULL, specifies the name that of the implicit > + local variable that refers to the current object instance. */ Drop "that" in the first line. > diff --git a/gdb/m2-lang.c b/gdb/m2-lang.c > index 6b51fd5..400338e 100644 > --- a/gdb/m2-lang.c > +++ b/gdb/m2-lang.c > @@ -375,7 +375,7 @@ const struct language_defn m2_language_defn = > m2_val_print, /* Print a value using appropriate syntax */ > c_value_print, /* Print a top-level value */ > NULL, /* Language specific skip_trampoline */ > - value_of_this, /* value_of_this */ > + "this", /* name_of_this */ > basic_lookup_symbol_nonlocal, /* lookup_symbol_nonlocal */ > basic_lookup_transparent_type,/* lookup_transparent_type */ > NULL, /* Language specific symbol demangler */ This can be NULL. > diff --git a/gdb/symtab.c b/gdb/symtab.c > index ddd2310..7d9b4ea 100644 > --- a/gdb/symtab.c > +++ b/gdb/symtab.c > @@ -1198,17 +1198,34 @@ lookup_symbol_aux (const char *name, const char > *linkage_name, > > langdef = language_def (language); > > - if (langdef->la_value_of_this != NULL > - && is_a_field_of_this != NULL) > + if (langdef->la_name_of_this != NULL && is_a_field_of_this != NULL > + && block != NULL && !dict_empty (BLOCK_DICT (block))) > { > - struct value *v = langdef->la_value_of_this (0); > - > - if (v && check_field (v, name)) > + struct symbol *sym = lookup_block_symbol (block, > langdef->la_name_of_this, > + NULL, VAR_DOMAIN); value_of_local always gets the function block. This might have an inner block that does not correspond to the function. I think you need to find the enclosing function before checking dict_empty or calling lookup_block_symbol. You could use block_function to get the symbol and then SYMBOL_BLOCK_VALUE to get the containing block, or just walk up BLOCK_SUPERBLOCK looking for BLOCK_FUNCTION. > @@ -2773,10 +2739,7 @@ value_of_local (const char *name, int complain) > 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); > + return value_of_local (current_language->la_name_of_this, complain); > } > > /* Create a slice (sub-string, sub-array) of ARRAY, that is LENGTH Is this going to crash if we get here for a language where it is NULL? -- Daniel Jacobowitz CodeSourcery