This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: Breaking in a c++ method with current language set to c.
On Sun, Mar 11, 2007 at 09:06:34PM +0000, Pedro Alves wrote:
> >How much invasive? I don't like the global "current language"; like
> >the global "selected frame", it's prone to this sort of problem when
> >we'd really rather be looking at a different language.
> As my first approach I had added a new parameter to lookup_symbol, and
> changed all the calls throughout to pass the language that seemed to
> make sense or current_language otherwise. I ended up touching many
> files I wouldn't be able to test, like fortran, scheme, java and ada
> support. It was more invasive than I could afford :) (,and probably wrong).
> As an intermediate step, I came up with this version. It adds a new
> lookup_symbol_in_language, and tweaks a few worker functions to accept
> the language by parameter, instead of relying on the current language.
> lookup_symbol is then a simple wrapper that passes the current_language
> to the new lookup_symbol_in_language. I needed to tweak ada-lang.c,
> because the lookup_symbol_in_language name was already taken there. The
> approach implemented there was similar to my previous patch, that is, it
> temporarily switched the current language [1]. As I don't have an ada
> compiler (and I can't fit any on my machine), I can't be be sure I caught
> all the hard coded current_language uses, so I've just make the ada
> function static and added a FIXME. Maybe someone will be able to try
> with the new version in symtab.c.
> What do you think of this approach?
I like this much better. I tested using your version for Ada, and it
seemed to work - but we don't have test coverage for the problem case,
apparently, since commenting out the set_language call in
ada_lookup_symbol_in_language did not cause any test failures. I
think you should go ahead and remove the Ada-specific version. If
there's a problem we can fix it.
Could you do that, and also check for overly long lines in your patch?
Thanks in advance.
--
Daniel Jacobowitz
CodeSourcery