From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2435 invoked by alias); 17 Oct 2010 21:57:54 -0000 Received: (qmail 2426 invoked by uid 22791); 17 Oct 2010 21:57:53 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,TW_BJ,TW_YM X-Spam-Check-By: sourceware.org Received: from mail-iw0-f169.google.com (HELO mail-iw0-f169.google.com) (209.85.214.169) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 17 Oct 2010 21:57:48 +0000 Received: by iwn1 with SMTP id 1so419564iwn.0 for ; Sun, 17 Oct 2010 14:57:46 -0700 (PDT) MIME-Version: 1.0 Received: by 10.42.137.3 with SMTP id w3mr1891240ict.359.1287352666102; Sun, 17 Oct 2010 14:57:46 -0700 (PDT) Received: by 10.231.191.200 with HTTP; Sun, 17 Oct 2010 14:57:46 -0700 (PDT) In-Reply-To: <20101017201252.GA22566@host1.dyn.jankratochvil.net> References: <4CABB53A.8000101@vmware.com> <20101006085132.GA11910@host1.dyn.jankratochvil.net> <20101017201252.GA22566@host1.dyn.jankratochvil.net> Date: Sun, 17 Oct 2010 21:57:00 -0000 Message-ID: Subject: Re: disable objective-c stuff when theres no objective-c cu. From: Matt Rice To: Jan Kratochvil Cc: Michael Snyder , "gdb-patches@sourceware.org" Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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/msg00280.txt.bz2 On Sun, Oct 17, 2010 at 1:12 PM, Jan Kratochvil wrote: > 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. =A0and 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. =A0I can imagine it could be inconvenient fo= r Obj-C > development (which I do not know myself, though). I tend to agree, with the conservative approach, requiring objc: sometimes could lead to an inconsistent user experience I prefer this approach because of the minimal user impact, yet we get the bulk of objc_decode out of the way of non-objc users. >> doesn't seem as though reading language symfiles frobs the current >> language afaict. > > It really does not. > > > + =A0set_language_has_cu_loaded(subfile->language); > > here should be a space: `...loaded (subfile->...' k, will fix that > +/* A mask for languages that want to enable specific behaviours if (not = when) > + =A0 a compilation unit of that language has been loaded. */ > +#define CU_LOADED_C_LANG_MASK =A0 =A0 =A0 =A0 =A00x1 << 0 > +#define CU_LOADED_CPLUS_LANG_MASK =A0 =A0 =A00x1 << 1 > > Do I miss something why don't you use enum language like (1 << language_o= bjc)? > nr_languages =3D=3D 14 so it fits fine into a bitmask. =A0BTW such #defin= e right > hand sides should be in parentheses (for operator priority surprises duri= ng > their use). before i spin a new patch, lets resolve this, the reason I used a define instead of an enum was because I vaguely reember weird differences wrt c and c++ enum use as numerical values. Not sure if this case is actually hit by that, I just figured that define was relatively future-proof, if a bit ugly, i should probably actually try it with c++. I definitely prefer enum to what i did here. so yeah, there was a reason but its possibly irrelevent and/or unecessary. > +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'. =A0Checking its content th= en > means iterating ALL_OBJFILES but I would find it acceptable. =A0(Some > accelerations of such scheme are also possible - when performance is a go= al of > this patch anyway.) =A0This would make the GDB behavior more deterministi= c IMO. ahh, I had totally spaced on this and the multi-process impact of this change, thanks will look into this. > +unsigned int > +language_has_cu_loaded (enum language lang) > +{ > + =A0unsigned int lang_mask =3D mask_for_language (lang); > + =A0return cu_languages_loaded_mask & lang_mask; > +} > > As it returns boolean it should be just `int' and I would make it normali= zed > to 0-or-1. k