This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Reducing the use of current_language...
- From: Joel Brobecker <brobecker at adacore dot com>
- To: gdb-patches at sourceware dot org
- Date: Mon, 8 Oct 2007 16:26:13 -0700
- Subject: Reducing the use of current_language...
Hello,
There is a project that I'm itching to start is to rework a bit our
expression evaluation interfaces to use an explicit language rather
than relying on the current_language global. The reason for this is
that it will make it much clearer which language is to be used and
will prevent some oopsies that can appear during situations like:
breakpoint_re_set_one
-> set language to breakpoint language
-> re-evaluation breakpoint location
-> reset language to intial value
I have seen some cases, especially during the inferior startup
phase, where we inadvertandly switch the language to an irrelevant
value because as a side-effect of calling "select_frame ()". As
a result, we end up evaluating the breakpoint location using
the wrong language!
On mips-irix, we end up getting errors like this:
% gdb foo
(gdb) b foo
Breakpoint 1 at 0x1000278c: file foo.adb, line 4.
(gdb) run
Starting program: /kern.a/brobecke/head/ex/foo
Error in re-setting breakpoint 1:
Function "foo" not defined.
Program exited normally.
I think it's going to be a lot cleaner to pass a specific language
to the parser/evaluator rather having it use the current language.
And it's going to help us fix that problem above. Right now, I'm
not sure I can find a solution as we have done a few times in the
past already.
(I remember I have make a patch a long time ago to compensate
for this type of issue, and I wanted to find it back to get more
details, but somehow I can't find it. Bummer!).
Anyway, I think it's a good idea, so do let me know if you disagree.
No need wasting my time if I'm the only one convinced!
--
Joel