From owner-freebsd-current Fri Jan 3 3:46:38 2003 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D85FB37B401 for ; Fri, 3 Jan 2003 03:46:35 -0800 (PST) Received: from mail01.svc.cra.dublin.eircom.net (mail01.svc.cra.dublin.eircom.net [159.134.118.17]) by mx1.FreeBSD.org (Postfix) with SMTP id 9EE7543ED4 for ; Fri, 3 Jan 2003 03:46:34 -0800 (PST) (envelope-from pmedwards@eircom.net) Received: (qmail 41790 messnum 161665 invoked from network[159.134.237.75/jimbo.eircom.net]); 3 Jan 2003 11:46:33 -0000 Received: from jimbo.eircom.net (HELO webmail.eircom.net) (159.134.237.75) by mail01.svc.cra.dublin.eircom.net (qp 41790) with SMTP; 3 Jan 2003 11:46:33 -0000 From: "Peter Edwards" To: freebsd-current@freebsd.org Subject: gdb of C++ program broken due to missing objects from Makefile. Date: Fri, 3 Jan 2003 11:46:33 +0000 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit X-Originating-IP: 62.17.151.61 X-Mailer: Eircom Net CRC Webmail (http://www.eircom.net/) Organization: Eircom Net (http://www.eircom.net/) Message-Id: <20030103114634.9EE7543ED4@mx1.FreeBSD.org> Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Hi, Debugging trivial C++ programs in GDB is knackered, complaining about "ABI doesn't define required function XXX" when doing operations such as printing classes and structures which inherit from others, and setting breakpoints in virtual functions, etc. Adding "gnu-v2-abi.c" and "gnu-v3-abi.c" to XSRCS in src/gnu/usr.bin/binutils/gdb/Makefile fixes the problem. This seems like a reasonably large problem with GDB as it stands currently. Does someone fancy committing this? patch and before/after example follow. Index: Makefile =================================================================== RCS file: /pub/FreeBSD/development/FreeBSD-CVS/src/gnu/usr.bin/binutils/gdb/Makefile,v retrieving revision 1.62 diff -u -r1.62 Makefile --- Makefile 12 Oct 2002 21:23:53 -0000 1.62 +++ Makefile 3 Jan 2003 11:40:52 -0000 @@ -37,6 +37,7 @@ ui-file.c ui-out.c wrapper.c cli-out.c \ cli-cmds.c cli-cmds.h cli-decode.c cli-decode.h cli-script.c \ cli-script.h cli-setshow.c cli-setshow.h cli-utils.c cli-utils.h +XSRCS+= gnu-v2-abi.c gnu-v3-abi.c XSRCS+= freebsd-uthread.c kvm-fbsd.c SRCS= init.c ${XSRCS} nm.h tm.h xm.h gdbversion.c xregex.h petere@rocklobster$ cat > test.cc << . heredoc> petere@rocklobster$ cat > test.cc << . heredoc> #include heredoc> heredoc> struct A { heredoc> const char *fieldOfA; heredoc> A() : fieldOfA("A's field") {} heredoc> }; heredoc> heredoc> struct B : public A { heredoc> const char * fieldOfB; heredoc> B() : fieldOfB("B's field") {} heredoc> }; heredoc> heredoc> main() heredoc> { heredoc> B myB; heredoc> pause(); heredoc> } heredoc> . petere@rocklobster$ g++ -g test.cc petere@rocklobster$ /usr/bin/gdb ./a.out GNU gdb 5.2.1 (FreeBSD) Copyright 2002 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i386-undermydesk-freebsd"... (gdb) b 16 Breakpoint 1 at 0x80485b7: file test.cc, line 16. (gdb) run Starting program: /local/petere/a.out Breakpoint 1, main () at test.cc:16 16 pause(); (gdb) p myB $1 = {ABI doesn't define required function baseclass_offset (gdb) quit The program is running. Exit anyway? (y or n) y petere@rocklobster$ /tmp/peters_fixed_gdb ./a.out GNU gdb 5.2.1 (FreeBSD) Copyright 2002 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i386-undermydesk-freebsd"... (gdb) b 16 Breakpoint 1 at 0x80485b7: file test.cc, line 16. (gdb) run Starting program: /local/petere/a.out Breakpoint 1, main () at test.cc:16 16 pause(); (gdb) p myB $1 = { = { fieldOfA = 0x8048692 "A's field" }, members of B: fieldOfB = 0x8048688 "B's field" } (gdb) To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message