From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1778 invoked by alias); 25 Nov 2010 10:25:50 -0000 Received: (qmail 1720 invoked by uid 22791); 25 Nov 2010 10:25:48 -0000 X-SWARE-Spam-Status: No, hits=-2.6 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO sourceware.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 25 Nov 2010 10:25:43 +0000 From: "anonyme_uprh at hotmail dot com" To: gdb-prs@sourceware.org Subject: [Bug c++/12266] New: Typedefs are not expanded to their base types in breakpoint definitions X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: c++ X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: anonyme_uprh at hotmail dot com X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Date: Thu, 25 Nov 2010 20:47:00 -0000 Mailing-List: contact gdb-prs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-prs-owner@sourceware.org X-SW-Source: 2010-q4/txt/msg00167.txt.bz2 http://sourceware.org/bugzilla/show_bug.cgi?id=3D12266 Summary: Typedefs are not expanded to their base types in breakpoint definitions Product: gdb Version: 7.2 Status: NEW Severity: normal Priority: P2 Component: c++ AssignedTo: unassigned@sourceware.org ReportedBy: anonyme_uprh@hotmail.com Hello everyone. I seem to have found a bug / feature in GDB 7.2 for C++. The problem is tha= t=20 typedefs are not converted to their base type when one tries to set a=20 breakpoint into a function that has a typedef'd type as parameter. Here's a simple program that triggers this bug: main.cpp - - - - - - - - - - - - - - - - - - - - - - - - - #include typedef std::string foo; void calltest(foo val) {} int main() { calltest(foo("")); } - - - - - - - - - - - - - - - - - - - - - - - - - Compiled with: "g++ -O0 -g main.cpp -o a.out" Now, when you start the program with gdb 7.2, you'll get the following=20 whatis replies: - - - - - - - - - - - - - - - - - - - - - - - - - (gdb) whatis foo type =3D std::string (gdb) whatis calltest type =3D void (foo) - - - - - - - - - - - - - - - - - - - - - - - - - But now, try to set a breakpoint. Once with "foo" and once with=20 "std::string"; which should be equal, as whatis has just told us. - - - - - - - - - - - - - - - - - - - - - - - - - (gdb) break calltest(foo) Breakpoint 1 at 0x80485e7: file main.cpp, line 5. (gdb) break calltest(std::string) Can't find member of namespace, class, struct, or union named "calltest(std::string)" Hint: try 'calltest(std::string) or 'calltest(std::string) (Note leading single quote.) Make breakpoint pending on future shared library load? (y or [n]) n - - - - - - - - - - - - - - - - - - - - - - - - - So, you might try to see the expansion. This is what GDB returns on Tab: - - - - - - - - - - - - - - - - - - - - - - - - - (gdb) break calltest [...] calltest(foo) calltest(std::basic_string,=20 std::allocator >) [...] - - - - - - - - - - - - - - - - - - - - - - - - - So, among the massive amounts of text, we find both foo, and the full=20 "std::string" typedef-expansion. Okay, so we try to set the breakpoint=20 accordingly: - - - - - - - - - - - - - - - - - - - - - - - - - (gdb) whatis calltest(std::string) type =3D void (foo) (gdb) whatis calltest(std::basic_string, std::allocator >) type =3D void (foo) (gdb) break calltest(std::basic_string, std::allocator >) Can't find member of namespace, class, struct, or union named [...] Make breakpoint pending on future shared library load? (y or [n]) n - - - - - - - - - - - - - - - - - - - - - - - - - So ... what this tells me is that "whatis" reads the symbol table correctly= ,=20 but "break" somehow doesn't. But wait, it gets even better. Now quit GDB and restart it. This is what yo= u=20 get when you issue the "break" as the very first command: - - - - - - - - - - - - - - - - - - - - - - - - - (gdb) break calltest(foo) Function "calltest(foo)" not defined. Make breakpoint pending on future shared library load? (y or [n]) n (gdb) whatis foo type =3D std::string (gdb) break calltest(foo) Breakpoint 1 at 0x80485e7: file main.cpp, line 5. - - - - - - - - - - - - - - - - - - - - - - - - - Interesting, isn't it? Do note that you can substitute the "whatis" with a= =20 range of commands; for example "break main", or "list" and the second call= =20 will still work. But not all commands, observe: - - - - - - - - - - - - - - - - - - - - - - - - - (gdb) break calltest(foo) Function "calltest(foo)" not defined. Make breakpoint pending on future shared library load? (y or [n]) n (gdb) break calltest(foo) Function "calltest(foo)" not defined. Make breakpoint pending on future shared library load? (y or [n]) n - - - - - - - - - - - - - - - - - - - - - - - - - Furthermore, starting with a fresh GDB will also change what the=20 tab-expansion shows. Instead of lots and lots of types, it only shows the=20 two "calltest" function entries; but at the same time, it shows "std::string" instead of the full typedef-expansion for std::string in the second entry. Anyway, here's the platform and program versions I used for testing: OS: Ubuntu 10.10 gdb: 7.2-ubuntu g++: (Ubuntu/Linaro 4.4.4-14ubuntu5) 4.4.5 I've tested the same program with an older, self-compiled GDB 7.1, and ther= e=20 I get this: - - - - - - - - - - - - - - - - - - - - - - - - - (gdb) break calltest(foo) Function "calltest(foo)" not defined. Make breakpoint pending on future shared library load? (y or [n]) n (gdb) whatis foo type =3D std::string (gdb) break calltest(foo) Function "calltest(foo)" not defined. Make breakpoint pending on future shared library load? (y or [n]) n (gdb) break calltest(std::string) Breakpoint 1 at 0x8048627: file main.cpp, line 5. - - - - - - - - - - - - - - - - - - - - - - - - - Basically, I have no clue what could trigger this strange behaviour. It=20 almost seems to me as if GDB 7.2 added support for typedef'd variables, but= =20 broke the "break" statement in a way that causes it to not read the=20 symbol-table correctly anymore, but I could be a mile off with that=20 suspicion. Any help would be appreciated, thanks, Martin Schr=C3=B6der. --=20 Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=3Demail ------- You are receiving this mail because: ------- You are on the CC list for the bug.