From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26729 invoked by alias); 17 Oct 2010 20:13:06 -0000 Received: (qmail 26718 invoked by uid 22791); 17 Oct 2010 20:13:03 -0000 X-SWARE-Spam-Status: No, hits=-6.1 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,TW_YM,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 17 Oct 2010 20:12:59 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o9HKCvb1000805 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sun, 17 Oct 2010 16:12:57 -0400 Received: from host1.dyn.jankratochvil.net (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id o9HKCsdu025027 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Sun, 17 Oct 2010 16:12:56 -0400 Received: from host1.dyn.jankratochvil.net (localhost [127.0.0.1]) by host1.dyn.jankratochvil.net (8.14.4/8.14.4) with ESMTP id o9HKCsLI023998; Sun, 17 Oct 2010 22:12:54 +0200 Received: (from jkratoch@localhost) by host1.dyn.jankratochvil.net (8.14.4/8.14.4/Submit) id o9HKCqpA023978; Sun, 17 Oct 2010 22:12:52 +0200 Date: Sun, 17 Oct 2010 20:13:00 -0000 From: Jan Kratochvil To: Matt Rice Cc: Michael Snyder , "gdb-patches@sourceware.org" Subject: Re: disable objective-c stuff when theres no objective-c cu. Message-ID: <20101017201252.GA22566@host1.dyn.jankratochvil.net> References: <4CABB53A.8000101@vmware.com> <20101006085132.GA11910@host1.dyn.jankratochvil.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) 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: 2010-10/txt/msg00279.txt.bz2 On Wed, 06 Oct 2010 15:12:06 +0200, Matt Rice wrote: > what I mean is that 'break' is not related to the current language, > but the language which we want to be the current language > when the breakpoint is hit. and so 'set language' to use language > specific breakpoints is arguably wrong because the current language > may not be the language of the breakpoint we want set. OK, I understand that Obj-C is special that it (a) is mixed with C/C++ and even possibly having C/C++ main(), (b) requiring Obj-C specific support to just figure out where to place a breakpoint. That `objc:' breakpoint prefix etc. could be nice but a more conservative change IMO also makes sense. I can imagine it could be inconvenient for Obj-C development (which I do not know myself, though). > doesn't seem as though reading language symfiles frobs the current > language afaict. It really does not. + set_language_has_cu_loaded(subfile->language); here should be a space: `...loaded (subfile->...' +/* A mask for languages that want to enable specific behaviours if (not when) + a compilation unit of that language has been loaded. */ +#define CU_LOADED_C_LANG_MASK 0x1 << 0 +#define CU_LOADED_CPLUS_LANG_MASK 0x1 << 1 Do I miss something why don't you use enum language like (1 << language_objc)? nr_languages == 14 so it fits fine into a bitmask. BTW such #define right hand sides should be in parentheses (for operator priority surprises during their use). +static unsigned int cu_languages_loaded_mask; One can imagine this mask may (possibly in the future) modify user-visible behavior due to a different code paths being executed due to it - which is also its purpose. Loading program A, kill, loading program B would behave differently than just loading program B with fresh GDB. I would place such mask into `struct objfile'. Checking its content then means iterating ALL_OBJFILES but I would find it acceptable. (Some accelerations of such scheme are also possible - when performance is a goal of this patch anyway.) This would make the GDB behavior more deterministic IMO. +unsigned int +language_has_cu_loaded (enum language lang) +{ + unsigned int lang_mask = mask_for_language (lang); + return cu_languages_loaded_mask & lang_mask; +} As it returns boolean it should be just `int' and I would make it normalized to 0-or-1. Thanks, Jan