This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Which language when parsing a breakpoint condition?


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.)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]