This is the mail archive of the
gdb@sources.redhat.com
mailing list for the GDB project.
Re: Which language when parsing a breakpoint condition?
- From: Jim Blandy <jimb at redhat dot com>
- To: Joel Brobecker <brobecker at gnat dot com>
- Cc: gdb at sources dot redhat dot com
- Date: 08 Sep 2003 14:34:56 -0500
- Subject: Re: Which language when parsing a breakpoint condition?
- References: <20030905232358.GB925@gnat.com> <20030905232839.GC925@gnat.com>
You're absolutely right. When the language mode is auto, it's silly
to parse an expression in the context of a particular block, but in a
language other than the one the block in written in.
Your code looks like the right idea to me, too. Some notes:
- expout->language_defn needs to be set correctly, too, doesn't it?
- Since get_selected_block can return zero, you'll need to deal with
the case where expression_context_block is zero.
You can linearize the cases like this, I think:
if (language_mode == language_manual)
lang = current_language
else if (expression_context_block)
set lang from that, with block_function and language_def
else
lang = current_language
At least, I think this makes it clearer that every case is covered.
Up to you.
(This sort of issue comes up a lot in relation to conditional
breakpoints, since I think it's one of the few cases where an
expression is ever parsed/evaluated in a scope other than that of the
selected frame. Checking watchpoints is a similar case.)