This is the mail archive of the
mailing list for the GDB project.
Re: disable objective-c stuff when theres no objective-c cu.
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.
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
+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.
+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