Breaking in a c++ method with current language set to c.
Pedro Alves
pedro_alves@portugalmail.pt
Mon Mar 5 03:37:00 GMT 2007
Hi all,
I got a fail in gdb.cp/psmang.exp while debugging gdbserver, related to the fact
that I have debug info in my c startup files, which in turn made me have the
current language set to c. The test tried to do a break like,
break A::method
, which failed, because the current way of finding struct/union methods doesn't
take into account the language of A. When we get to linespec.c:find_method, if
we know that A is a c++ class, we know that 'method' is a c++ method.
I've looked at several ways to fix it, and all but this one turned out more
invasive than I hoped for, because current_language is used in a several places
(in symtab.c). Instead, I simply wrapped linespec.c:find_method with a
set_language (lang of A), guarded with a cleanup.
With class A from the new testcase in the patch,
before:
(gdb) set lang c
(gdb) b A::method
the class A does not have any method named method
Hint: try 'A::method<TAB> or 'A::method<ESC-?>
(Note leading single quote.)
after:
(gdb) set lang c
[0] cancel
[1] all
[2] A::method(A*) at main.cc:17
[3] A::method(int) at main.cc:12
[4] A::method() at main.cc:7
Tested on i686-pc-cygwin,
OK?
Cheers,
Pedro Alves
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: psmang.exp.diff
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20070305/d5f3c370/attachment.ksh>
More information about the Gdb-patches
mailing list