Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: "Daniel Manfis" <dany_100@yahoo.com>
To: gdb@sourceware.cygnus.com
Subject: Re: Referencing C++ functions with non-demangled names.
Date: Tue, 22 May 2001 03:13:00 -0000	[thread overview]
Message-ID: <3B0A6656.20605.AA051@localhost> (raw)
In-Reply-To: <87lmnq18iv.fsf@dynamic-addr-83-177.resnet.rochester.edu>

> 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 <ESC-?>, 
instead of displaying functions from that namespace, all functions in 
the scope are displayed (as it happens when you type "break" and 
press <ESC-?>).


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



  reply	other threads:[~2001-05-22  3:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-05-21 11:24 Daniel Manfis
2001-05-21 18:23 ` Daniel Berlin
2001-05-22  3:13   ` Daniel Manfis [this message]
2001-05-22  6:29     ` Daniel Berlin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3B0A6656.20605.AA051@localhost \
    --to=dany_100@yahoo.com \
    --cc=gdb@sourceware.cygnus.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox