From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Matt Rice <ratmice@gmail.com>
Cc: Michael Snyder <msnyder@vmware.com>,
"gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: Re: disable objective-c stuff when theres no objective-c cu.
Date: Sun, 17 Oct 2010 20:13:00 -0000 [thread overview]
Message-ID: <20101017201252.GA22566@host1.dyn.jankratochvil.net> (raw)
In-Reply-To: <AANLkTinCmHKyxq=LU28Sp==ijAWheSiYXkxyc85_h9yp@mail.gmail.com>
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
next prev parent reply other threads:[~2010-10-17 20:13 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-05 22:37 Matt Rice
2010-10-05 23:31 ` Michael Snyder
2010-10-05 23:35 ` Matt Rice
2010-10-06 2:30 ` Matt Rice
2010-10-06 8:51 ` Jan Kratochvil
2010-10-06 10:03 ` Matt Rice
2010-10-06 13:12 ` Matt Rice
2010-10-06 17:06 ` Joel Brobecker
2010-10-06 17:54 ` Matt Rice
2010-10-17 20:13 ` Jan Kratochvil [this message]
2010-10-17 21:57 ` Matt Rice
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20101017201252.GA22566@host1.dyn.jankratochvil.net \
--to=jan.kratochvil@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=msnyder@vmware.com \
--cc=ratmice@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox