Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Ton van Overbeek <v-overbeek@cistron.nl>
To: Eli Zaretskii <eliz@gnu.org>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [PATCH] Fix coff symbol table reading problem for C code compiled by g++
Date: Sun, 15 Aug 2004 00:29:00 -0000	[thread overview]
Message-ID: <Pine.LNX.4.58.0408150215290.32440@picard.cistron.nl> (raw)
In-Reply-To: <7137-Sat14Aug2004143240+0300-eliz@gnu.org>

On Sat, 14 Aug 2004, Eli Zaretskii wrote:

> > Date: Fri, 13 Aug 2004 02:06:00 +0200 (CEST)
> > From: Ton van Overbeek <v-overbeek@cistron.nl>
> >
> > 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 <<EOF > 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


  reply	other threads:[~2004-08-15  0:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-13  0:06 Ton van Overbeek
2004-08-14 11:36 ` Eli Zaretskii
2004-08-15  0:29   ` Ton van Overbeek [this message]
2004-08-21 12:19     ` Eli Zaretskii
2004-09-16  0:23 ` Jim Blandy

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=Pine.LNX.4.58.0408150215290.32440@picard.cistron.nl \
    --to=v-overbeek@cistron.nl \
    --cc=eliz@gnu.org \
    --cc=gdb-patches@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