From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12325 invoked by alias); 5 Aug 2008 12:05:10 -0000 Received: (qmail 12311 invoked by uid 22791); 5 Aug 2008 12:05:09 -0000 X-Spam-Check-By: sourceware.org Received: from hoat.troll.no (HELO hoat.troll.no) (62.70.27.150) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 05 Aug 2008 12:04:30 +0000 Received: from hoat.troll.no (tedur.troll.no [62.70.27.154]) by hoat.troll.no (Postfix) with SMTP id 56F4220540 for ; Tue, 5 Aug 2008 14:04:28 +0200 (CEST) Received: from gar.trolltech.de (gar.trolltech.de [10.4.0.24]) by hoat.troll.no (Postfix) with ESMTP id 3CEA8204E3 for ; Tue, 5 Aug 2008 14:04:28 +0200 (CEST) From: =?utf-8?q?Andr=C3=A9_P=C3=B6nitz?= To: gdb@sources.redhat.com Subject: gdb problem with 'malloc' in unnamed namespace Date: Tue, 05 Aug 2008 12:05:00 -0000 User-Agent: KMail/1.9.9 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200808051407.14091.apoenitz@trolltech.com> X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2008-08/txt/msg00065.txt.bz2 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 -=20 gdb -batch -ex 'b main' -ex 'r' -ex 'p "xxx"' ./a.out=20 yields: Breakpoint 1 at 0x400548: file , line 1. Breakpoint 1, main () at :1 1 : No such file or directory. in 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=20 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=20 yields: Breakpoint 1 at 0x400542: file , line 1. Breakpoint 1, main () at :1 1 : No such file or directory. in 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=C3=A9=20