From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3108 invoked by alias); 15 Aug 2004 00:29:42 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 3101 invoked from network); 15 Aug 2004 00:29:41 -0000 Received: from unknown (HELO primx.cistron.nl) (62.216.30.74) by sourceware.org with SMTP; 15 Aug 2004 00:29:41 -0000 Received: from picard.cistron.nl ([62.216.30.70] ident=mail) by primx.cistron.nl with esmtp (Exim 4.33 #1) id 1Bw8u5-00028W-A1; Sun, 15 Aug 2004 02:29:41 +0200 Received: from v-overbeek (helo=localhost) by picard.cistron.nl with local-esmtp (Exim 3.35 #1 (Debian)) id 1Bw8u5-0000JB-00; Sun, 15 Aug 2004 02:29:41 +0200 Date: Sun, 15 Aug 2004 00:29:00 -0000 From: Ton van Overbeek To: Eli Zaretskii cc: gdb-patches@sources.redhat.com Subject: Re: [PATCH] Fix coff symbol table reading problem for C code compiled by g++ In-Reply-To: <7137-Sat14Aug2004143240+0300-eliz@gnu.org> Message-ID: References: <7137-Sat14Aug2004143240+0300-eliz@gnu.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-SW-Source: 2004-08/txt/msg00516.txt.bz2 On Sat, 14 Aug 2004, Eli Zaretskii wrote: > > Date: Fri, 13 Aug 2004 02:06:00 +0200 (CEST) > > From: Ton van Overbeek > > > > I found a bug/problem in the symbol reading code in symtab.c in gdb-6.2. > > Thanks for the report and the patch. > > Could you please also provide a short test case and an example > compile-link-GDB session script which both shows how to eproduce the > problem and the exact outputs from GDB? > Here is a script illustrating the problem. Since I am working on a gdb-6.x port for m68k-palmos the script is m68k-palmos specific (main has to be called PilotMain), but it should be easy to adapt to the general case. ------------------------------------------------------------------------------- #!/bin/sh set -x # Set to gdb used GDB=./gdb cat << EOF > test.c /* Following #ifdef m68k-palmos specific */ #ifdef __cplusplus extern "C" { int PilotMain(void); } #endif void g (void) { } void f (void) { } /* In m68k-palmos no main(), but PilotMain() */ int PilotMain (void) { f(); g(); return 0; } EOF cat < test.cmd file test break f info break quit EOF m68k-palmos-g++ --version echo "Compiling & Linking test program" m68k-palmos-g++ -g -o test test.c echo "Running gdb" $GDB --command test.cmd rm -f test.c test.cmd test ------------------------------------------------------------------------------- Here is the output from the script when runnin with a gdb without the patch: ------------------------------------------------------------------------------- + GDB=./gdb + cat + cat + m68k-palmos-g++ --version 2.95.3-kgpd + echo Compiling & Linking test program Compiling & Linking test program + m68k-palmos-g++ -g -o test test.c + echo Running gdb Running gdb + ./gdb --command test.cmd GNU gdb 6.2 Copyright 2004 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 "--host=i686-pc-cygwin --target=m68k-palmos". Breakpoint 1 at 0x138: file test.c, line 9. Num Type Disp Enb Address What 1 breakpoint keep y 0x00000138 in g__Fv at test.c:9 + rm -f test.c test.cmd test ------------------------------------------------------------------------------ Note the breakpoint is set at the end of the preceding function and the preceding function name g__Fv is the mangled name. Now the output of the patched gdb: ------------------------------------------------------------------------------ + GDB=./gdb-new + cat + cat + m68k-palmos-g++ --version 2.95.3-kgpd + echo Compiling & Linking test program Compiling & Linking test program + m68k-palmos-g++ -g -o test test.c + echo Running gdb Running gdb + ./gdb-new --command test.cmd GNU gdb 6.2 Copyright 2004 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 "--host=i686-pc-cygwin --target=m68k-palmos". Breakpoint 1 at 0x148: file test.c, line 13. Num Type Disp Enb Address What 1 breakpoint keep y 0x00000148 in f(void) at test.c:13 + rm -f test.c test.cmd test ------------------------------------------------------------------------------ Now the breakpoint is reported correctly. I hope you can convert this to a test program + expect script for the testsuite. Let me know i this is sufficient. Ton van Overbeek