From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Daniel Manfis" To: gdb@sourceware.cygnus.com Subject: Re: Referencing C++ functions with non-demangled names. Date: Tue, 22 May 2001 03:13:00 -0000 Message-id: <3B0A6656.20605.AA051@localhost> References: <3B0987CD.7848.1387DF@localhost> <87lmnq18iv.fsf@dynamic-addr-83-177.resnet.rochester.edu> X-SW-Source: 2001-05/msg00314.html > Errr, I need a test case, it works fine here. > I also need to know what compiler version, etc, you are using. linux : Mandrake 7.2 (kernel 2.2.17-21mdk) gcc : 3.0, snapshot 20010423 gdb : 5.0 (RPM from/for Mandrake 7.2) test case: ////////////////////////////////////////////////////////////////////// // File name : a.cc void f() {} int main() { f() ; } ////////////////////////////////////////////////////////////////////// I compile with one of the following options, all of them give the same results: g++ -ggdb3 a.cc g++ -g3 a.cc g++ -gstabs+3 a.cc > The workaround is to quote it, or remove the filename: from the > front (or both). C++ functions with the same name must be the same > function, by the one definition rule, so prefixing it like that is > pointless. Here is what i tried to do to set a breakpoint on functoin 'f', all of the methods failing: break a.cc:f break 'a.cc:f' break f break 'f' (i couldn't use double-quotes: when i try to do that (break "f"), gdb crashes with segmentation fault (as it is, by the way, when you type "break .")). But i could set a breakpoint on 'f' function with the following expression: break _Z1fv The only function breakpoint i could set using function's non-mangled name, is the 'main' function breakpoint (using "break main" expression. Probably the reason i succeeded to set breakpoint on 'main' with it's non-mangled name, is because it's name is not mangled (at least when i step through the program, gdb never prints 'main''s name in a mangled form, as it does with all the other C++ functions). Also, i couldn't set breakpoints on functions in a namespaces unless i use it's mangled name, a notation like "break 'ns::f'" won't do (instead, provided there is function 'f' in a namespace 'ns', i have to use "break _ZN2ns1fEv") Generally, namespaces are not recognized at all. For example, if i type "break ns::" and press , instead of displaying functions from that namespace, all functions in the scope are displayed (as it happens when you type "break" and press ). I thought that maybe there is a problem with gdb's RPM package i am using, but it is impossible for me to check - i barely have a space to ungzip a source package, let along build it. Daniel. _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com