From: "André Pönitz" <apoenitz@trolltech.com>
To: gdb@sources.redhat.com
Subject: gdb problem with 'malloc' in unnamed namespace
Date: Tue, 05 Aug 2008 12:05:00 -0000 [thread overview]
Message-ID: <200808051407.14091.apoenitz@trolltech.com> (raw)
Hi all.
Thanks to Andreas Schwab I have now a pretty minimal example
that makes me think that gdb has a problem with handling a
function called "malloc" in the unnamed namespace:
echo 'namespace { void malloc(int, int) {} } int main() {}' | g++ -xc++ -g -
gdb -batch -ex 'b main' -ex 'r' -ex 'p "xxx"' ./a.out
yields:
Breakpoint 1 at 0x400548: file <stdin>, line 1.
Breakpoint 1, main () at <stdin>:1
1 <stdin>: No such file or directory.
in <stdin>
Current language: auto; currently c++
too few arguments in function call
So the 'malloc' from the debugged program is picked up by gdb, even if the
symbol name ("_ZN29_GLOBAL__N__00000000_271D34D06mallocEv") does
not match.
Note that the case of too few argument, the error message is
slightly more useful as it mentions at least 'malloc':
echo 'namespace { void malloc() {} } int main() {}' | g++ -xc++ -g -
gdb -batch -ex 'b main' -ex 'r' -ex 'p "xxx"' ./a.out
yields:
Breakpoint 1 at 0x400542: file <stdin>, line 1.
Breakpoint 1, main () at <stdin>:1
1 <stdin>: No such file or directory.
in <stdin>
Current language: auto; currently c++
No memory available to program: call to malloc failed
What can I do from the user side to inform gdb that it should
not use the malloc from the anon namespace?
André
next reply other threads:[~2008-08-05 12:05 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-05 12:05 André Pönitz [this message]
2008-08-05 12:13 ` Daniel Jacobowitz
2008-08-05 12:40 ` Andreas Schwab
2008-08-05 12:56 ` André Pönitz
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=200808051407.14091.apoenitz@trolltech.com \
--to=apoenitz@trolltech.com \
--cc=gdb@sources.redhat.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