Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* Re: So what is wrong with v3 C++
@ 2001-06-28 20:42 Michael Elizabeth Chastain
  2001-06-28 20:44 ` Christopher Faylor
                   ` (2 more replies)
  0 siblings, 3 replies; 25+ messages in thread
From: Michael Elizabeth Chastain @ 2001-06-28 20:42 UTC (permalink / raw)
  To: chastain, dan; +Cc: ac131313, gdb

> >   gdb/7   cout << 1 doesn't work for c++
> This one is bogus.
> It does work.
> I poitned this out on gdb.bugs.

No.  You pointed out that it works with dwarf2.  You acknowledged
that it doesn't work with stabs.  You wrote:

  http://sources.redhat.com/cgi-bin/gnatsweb.pl?cmd=view&pr=23&database=gdb

  As did I, look for the posting where i showed it worked for me with
  dwarf2 on both ppc, and x86.

  It doesn't work on stabs for one of two reasons:
  ....

> >   gdb/40  C++ template functions have return types in their names
> Normal. They should.
> Look at the ABI standard.

The problem is that a template function has a name such as
"int add_two_values<int>(int, int)", whereas a normal function has a
name such as "add_two_values(int, int)".  Note the return type at the
beginning of the name.

Specifically:

  % c++filt
  _Z14add_two_valuesIiET_S0_S0_
  int add_two_values<int>(int, int)
  _Z14add_two_valuesii
  add_two_values(int, int)

This was also a problem with v2.

I'm looking at section 5.1.2 of the ABI standard, "General Structure".
The demangling grammar gets down to "unqualified source code identifier"
in about ten productions, with no reference to the function return type.
Can you quote me the part of the ABI standard that puts the return type
before the name?

> >   gdb/41  testsuite/gdb.c++/demangle.exp needs v3 coverage
> libiberty already has demangler coverage for the demangler, why do we
> need it in gdb as well?

Gdb is the #1 client of the demangler so it's in our interest to check
for demangling bugs in our test suite.  That way we can find them and
push them upstream more easily.

The second reason is that libiberty/testsuite/demangle-expected has
only five cases that start with "_Z", and they are all --format=java.
So we actually have very little v3 coverage right now.

BTW, demangle.exp has 877 tests, but it covers four demangling styles:
gnu, lucid, arm, and hp.  So we are looking at 200-300 new tests,
not 900 new tests.

> >   gdb/59  static members in a base class confuse gdb
> Fixed. with a valops change i made a while ago.

I just tried this with this week's builds, and I'm getting an error:

  (gdb) p pB
  $1 = (B *) 0x8050538
  (gdb) p *pB
  Value can't be converted to integer.

Native Red Hat Linux 7, stabs, et cetera.

This is a different error than the bug reported in the PR.  Sigh.

> These bugs were always there, v3 just exposes them a heck of a lot
> more.  They used to be hard to see, and users would occasionally
> complain.
> Now it's right in their face, almost any time they use the standard
> library.

Yeah.  I claim that "v3 is almost better than v2".  But if v2 was
terrible, that still might not be very good.

From a scheduling point of view, JimB can fix a lot of bugs before
touching the dwarf2 reader.  From a release criteria point of view, I
just don't know how much scope work is necessary to have a shippable 5.1.

Michael


^ permalink raw reply	[flat|nested] 25+ messages in thread
* Re: So what is wrong with v3 C++
@ 2001-07-02 14:54 Benjamin Kosnik
  0 siblings, 0 replies; 25+ messages in thread
From: Benjamin Kosnik @ 2001-07-02 14:54 UTC (permalink / raw)
  To: gdb

> "If I make this change, will it break our GCC 3.0 support?  I don't
> have GCC 3.0 installed anywhere anymore..."

I thought 'gcc-3' support was broken anyway. That was the whole point
of the initial post.

> But until someone fixes stabs, I think it's reasonable to tell C++
> users that GCC only provides sufficient information when using Dwarf
> 2.

I think this is reasonable as well, and I think you'll find that most
C++ users are already doing this by configuring with --with-dwarf2. I
am willing to do the appropriate configure/documenation work to make
--enable-languages=c++ deal with this sanely.

I also think it's reasonable to try and get this working first, then
figure out how to back-port it to gcc-3 and/or older gdb
versions. Hopefully, if this work gets done somewhat quickly, the
compiler support should be in the gcc-3.01 release.

thanks again dudes,
benjamin


^ permalink raw reply	[flat|nested] 25+ messages in thread
* Re: So what is wrong with v3 C++
@ 2001-06-29 11:57 Benjamin Kosnik
  2001-07-02 20:28 ` Per Bothner
  0 siblings, 1 reply; 25+ messages in thread
From: Benjamin Kosnik @ 2001-06-29 11:57 UTC (permalink / raw)
  To: gdb

Y'all, I appreciate effort to fix C++ and make gdb usable for that
language.

Note, since we're at it, you might as well ask the Java people about
outstanding issues. Fixing many of the C++ related ones will most
probably help out Java as well, for those with an aversion to
C++. (This scoping stuff seems to be endemic to both java and C++.)


Other bugs, not mentioned in this thread.

1) cannot print contents of non-POD static data members reliably.
Hell, I most of the times I cannot print 'static const int' within a
class or nested class. This is the perennial 'cannot address memory
0x' bug. I've been reporting this for over 6 months.

2) cannot call static member functions with a fully qualified name.
ie
(gdb) p cout::sync_with_stdio(true)

For what it's worth, I've used gdb + an older version of Daniel's new
dwarf2 reader and it is better about the first of these things. It's
not been integrated, and the sources are sufficiently out of date that
it's a bit painful to use. I do keep this debugger around still, and
use it, it's quite nice.

I'm sure if you cross-post this message to libstdc++@gcc.gnu.org other
C++ programmers could give y'all more input. Pure chance (and the web
archive) introduced this thread to me. In the meantime, I'll post a
message to the library list pointing interested parties over to this
thread.

-benjamin


^ permalink raw reply	[flat|nested] 25+ messages in thread
* Re: So what is wrong with v3 C++
@ 2001-06-29 10:28 Michael Elizabeth Chastain
  2001-06-29 11:40 ` Daniel Berlin
  0 siblings, 1 reply; 25+ messages in thread
From: Michael Elizabeth Chastain @ 2001-06-29 10:28 UTC (permalink / raw)
  To: dan; +Cc: gdb

Daniel Berlin writes:

> The thing is, it shouldn't match against demangled forms, it should
> match against *fully qualified* forms.

Ah, I feel some illumination coming on.

> Aclass a;
> int c;
> c = int a::george(int, int)(5, 6);
> 
> That's what we've got now.

gdb's goal is to have an expression evaluator that is some reasonable
subset of the language under test.

In K & R C, the translation from "demangled" -> "fully qualified" is trivial.
In ANSI C, the translation from "demangled" -> "fully qualified" takes work.
  You have to convert "foo(int, int)" -> "foo".
  This conversion is actually built into a string matcher!
In C++, the translation from "demangled" -> "fully qualified" is hairy.
  There are a lot of cases and changing the string matchers is hopeless.

It sounds like we need a much more detailed demangler interface, where
the demangler gives us the demangled name, the fully qualified name,
plus any other forms of the name we care about.

Michael


^ permalink raw reply	[flat|nested] 25+ messages in thread
* Re: So what is wrong with v3 C++
@ 2001-06-29  0:56 Michael Elizabeth Chastain
  0 siblings, 0 replies; 25+ messages in thread
From: Michael Elizabeth Chastain @ 2001-06-29  0:56 UTC (permalink / raw)
  To: tromey; +Cc: ac131313, dan, gdb

Hi Tom,

> Unfortunately nobody wrote new tests as they wrote new code.  I think
> I mentioned the test suite to whoever wrote the new demangler, but was
> ignored.  Anyway I do think that the other goal still applies.
> Putting new tests in gdb is, imnsho, not as helpful as putting them
> into the demangler's own test suite.

Pro:
  Modularity suggests that the test suite goes with the software.
  Parsimony suggests that the test appear in just one place.

Con:
  Defensiveness suggests that gdb tests this library facility that it needs.
  Ecology suggests that it get tested where people are actually testing.

> If there is an administrative overhead that makes this hard, then that
> is the barrier that should be lowered.

I think of it as "ecology" rather than "administration".
Gdb people are used to running only the gdb test suite.

I just tried this in one of my build trees:

  % cd native/build/libiberty
  % make check
  /bin/sh /horton/chastain/fsf/2001-06-23/source/libiberty/testsuite/regress-demangle /horton/chastain/fsf/2001-06-23/source/libiberty/testsuite/demangle-expected
  All 645 tests passed

I wrote another trivial script.  I'll add this to my Sunday reports.

Michael


^ permalink raw reply	[flat|nested] 25+ messages in thread
* Re: So what is wrong with v3 C++
@ 2001-06-28 23:50 Michael Elizabeth Chastain
  2001-06-29  8:59 ` Daniel Berlin
  0 siblings, 1 reply; 25+ messages in thread
From: Michael Elizabeth Chastain @ 2001-06-28 23:50 UTC (permalink / raw)
  To: dan, gdb

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 7658 bytes --]

Yeah, here's a typescript of the whole megillah.

MichaelC

===

Script started on Thu Jun 28 22:44:46 2001
[chastain@snapon tmp]$ echo $PATH
/horton/chastain/fsf/2001-06-23/snapon/native/install/bin:/bin:/usr/bin
[chastain@snapon tmp]$ cat x1.cc
class A
{
  public:
    A();
    virtual ~A();
    static int i;
};

A::A()
{
  ;
}

A::~A()
{
  ;
}

int A::i = 1;

class B : public A
{
  public:
    B();
    virtual ~B();
    static int j;
    static int k;
};

B::B()
{
  ;
}

B::~B()
{
  ;
}

int B::j = 2;
int B::k = 3;

int main ()
{
  B * pB = new B;
  delete pB;
}
[chastain@snapon tmp]$ g++ -v
Reading specs from /horton/chastain/fsf/2001-06-23/snapon/native/install/lib/gcc-lib/i686-pc-linux-gnu/3.0.1/specs
Configured with: /horton/chastain/fsf/2001-06-23/source/configure --prefix=/horton/chastain/fsf/2001-06-23/snapon/native/install --disable-shared --enable-languages=c,c++,f77 --with-gnu-as --with-as=/horton/chastain/localdisk/snapon/baseline/binutils-2.11.2/native/install/bin/as --with-gnu-ld --with-ld=/horton/chastain/localdisk/snapon/baseline/binutils-2.11.2/native/install/bin/ld --enable-gdbmi
Thread model: single
gcc version 3.0.1 20010623 (prerelease)
[chastain@snapon tmp]$ g++ -g -o x1.exe x1.cc
[chastain@snapon tmp]$ gdb -v
GNU gdb 2001-06-24-cvs (MI_OUT)
Copyright 2001 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 "i686-pc-linux-gnu".
[chastain@snapon tmp]$ gdb gdb
GNU gdb 2001-06-24-cvs (MI_OUT)
Copyright 2001 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 "i686-pc-linux-gnu"...
(gdb) set prompt [top] 
[top] set args x1.exe
[top] break error
Breakpoint 1 at 0x80d4556: file /horton/chastain/fsf/2001-06-23/source/gdb/utils.c, line 653.
[top] run
Starting program: /horton/chastain/fsf/2001-06-23/snapon/native/install/bin/gdb x1.exe
GNU gdb 2001-06-24-cvs (MI_OUT)
Copyright 2001 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 "i686-pc-linux-gnu"...
(gdb) break main
Breakpoint 1 at 0x80488b6: file x1.cc, line 45.
(gdb) run
Starting program: /home/chastain/tmp/x1.exe 

Breakpoint 1, main () at x1.cc:45
45	  B * pB = new B;
(gdb) next
46	  delete pB;
(gdb) ptype pB
type = class B : public A {
  public:
    static int j;
    static int k;

    B & operator=(B const&);
    B(B const&);
    B(B const&);
    B();
    B();
    ~B();
    virtual ~B();
    virtual ~B();
} *
(gdb) print pB
$1 = (B *) 0x8050538
(gdb) print *pB

Breakpoint 1, error (string=0x819d620 "Value can't be converted to integer.")
    at /horton/chastain/fsf/2001-06-23/source/gdb/utils.c:653
653	  va_start (args, string);
[top] bt
#0  error (string=0x819d620 "Value can't be converted to integer.")
    at /horton/chastain/fsf/2001-06-23/source/gdb/utils.c:653
#1  0x0807445d in unpack_long ()
    at /horton/chastain/fsf/2001-06-23/source/gdb/values.c:661
#2  0x0807428e in value_as_pointer (val=0x84e9968)
    at /horton/chastain/fsf/2001-06-23/source/gdb/values.c:602
#3  0x0812dd90 in gnuv3_rtti_type (value=0x84f3e38, full_p=0xbffff0d8, 
    top_p=0xbffff0dc, using_enc_p=0xbffff0e0)
    at /horton/chastain/fsf/2001-06-23/source/gdb/gnu-v3-abi.c:211
#4  0x080d7a71 in value_rtti_type (v=0x84f3e38, full=0xbffff0d8, 
    top=0xbffff0dc, using_enc=0xbffff0e0)
    at /horton/chastain/fsf/2001-06-23/source/gdb/cp-abi.c:76
#5  0x0807d649 in value_full_object (argp=0x84f3e38, rtype=0x0, xfull=0, 
    xtop=0, xusing_enc=0)
    at /horton/chastain/fsf/2001-06-23/source/gdb/valops.c:3158
#6  0x0807a9cd in value_ind (arg1=0x84960f8)
    at /horton/chastain/fsf/2001-06-23/source/gdb/valops.c:1016
#7  0x08078655 in evaluate_subexp_standard (expect_type=0x0, exp=0x84e9910, 
    pos=0xbffff3c4, noside=EVAL_NORMAL)
    at /horton/chastain/fsf/2001-06-23/source/gdb/eval.c:1620
#8  0x0807532b in evaluate_subexp (expect_type=0x0, exp=0x84e9910, 
    pos=0xbffff3c4, noside=EVAL_NORMAL)
    at /horton/chastain/fsf/2001-06-23/source/gdb/eval.c:69
---Type <return> to continue, or q <return> to quit---
#9  0x080754ee in evaluate_expression (exp=0x84e9910)
    at /horton/chastain/fsf/2001-06-23/source/gdb/eval.c:158
#10 0x08083132 in print_command_1 (exp=0x8220416 "*pB", inspect=0, voidprint=1)
    at /horton/chastain/fsf/2001-06-23/source/gdb/printcmd.c:918
#11 0x08083323 in print_command (exp=0x8220416 "*pB", from_tty=1)
    at /horton/chastain/fsf/2001-06-23/source/gdb/printcmd.c:981
#12 0x080d22d3 in execute_command (p=0x8220418 "B", from_tty=1)
    at /horton/chastain/fsf/2001-06-23/source/gdb/top.c:789
#13 0x0809d97d in command_handler (command=0x8220410 "print *pB")
    at /horton/chastain/fsf/2001-06-23/source/gdb/event-top.c:513
#14 0x0809de43 in command_line_handler (rl=0x84a8c88 "(\013#\bðA\r\büóÿ¿\021")
    at /horton/chastain/fsf/2001-06-23/source/gdb/event-top.c:809
#15 0x08188a26 in rl_callback_read_char ()
    at /horton/chastain/fsf/2001-06-23/source/readline/callback.c:114
#16 0x0809d86f in stdin_event_handler (error=0, client_data=0x0)
    at /horton/chastain/fsf/2001-06-23/source/gdb/event-top.c:420
#17 0x080eb8b7 in handle_file_event (event_file_desc=0)
    at /horton/chastain/fsf/2001-06-23/source/gdb/event-loop.c:706
#18 0x080eb34e in process_event ()
    at /horton/chastain/fsf/2001-06-23/source/gdb/event-loop.c:335
#19 0x080eb39b in gdb_do_one_event (data=0x0)
    at /horton/chastain/fsf/2001-06-23/source/gdb/event-loop.c:372
#20 0x080d1e8a in catch_errors (func=0x80eb370 <gdb_do_one_event>, args=0x0, 
---Type <return> to continue, or q <return> to quit---
    errstring=0x81c6800 "", mask=6)
    at /horton/chastain/fsf/2001-06-23/source/gdb/top.c:472
#21 0x080eb3d3 in start_event_loop ()
    at /horton/chastain/fsf/2001-06-23/source/gdb/event-loop.c:396
#22 0x08070861 in captured_command_loop (data=0x0)
    at /horton/chastain/fsf/2001-06-23/source/gdb/main.c:102
#23 0x080d1e8a in catch_errors (func=0x8070850 <captured_command_loop>, 
    args=0x0, errstring=0x819ba82 "", mask=6)
    at /horton/chastain/fsf/2001-06-23/source/gdb/top.c:472
#24 0x08071073 in captured_main (data=0xbffff970)
    at /horton/chastain/fsf/2001-06-23/source/gdb/main.c:724
#25 0x080d1e8a in catch_errors (func=0x80708a0 <captured_main>, 
    args=0xbffff970, errstring=0x819ba82 "", mask=6)
    at /horton/chastain/fsf/2001-06-23/source/gdb/top.c:472
#26 0x080712d7 in main (argc=2, argv=0xbffff9e4)
    at /horton/chastain/fsf/2001-06-23/source/gdb/main.c:735
#27 0x400a0b65 in __libc_start_main (main=0x80712b0 <main>, argc=2, 
    ubp_av=0xbffff9e4, init=0x806fc68 <_init>, fini=0x819b950 <_fini>, 
    rtld_fini=0x4000df24 <_dl_fini>, stack_end=0xbffff9dc)
    at ../sysdeps/generic/libc-start.c:111
[top] cont
Continuing.
Value can't be converted to integer.
(gdb) cont
Continuing.

Program exited normally.
(gdb) quit

Program exited normally.
[top] quit
[chastain@snapon tmp]$ exit
exit

Script done on Thu Jun 28 22:46:27 2001


^ permalink raw reply	[flat|nested] 25+ messages in thread
* Re: So what is wrong with v3 C++
@ 2001-06-28 23:31 Michael Elizabeth Chastain
  2001-06-29  8:59 ` Daniel Berlin
  0 siblings, 1 reply; 25+ messages in thread
From: Michael Elizabeth Chastain @ 2001-06-28 23:31 UTC (permalink / raw)
  To: dan; +Cc: gdb

Dan Berlin writes:
> 1. Template functions (names or types) have return types encoded,
>    with the exceptions listed below.

Okay, we must comply with the ABI, then.

> You seem to want to get rid of return types from mangled names for
> templates. This ain't gonna ever happen. It's done on purpose, it's
> not an accident.

No, first I want to know what the spec requires.  The ABI spec wants the
information to be present in the mangled name.  Now follow the information
flow:

  mangled name -> demangled name (demangler)
  demangled name -> user visible and user matchable names (gdb)

I accept the ABI spec, and I'm comfortable with the demangler preserving
all the information including the return type.

We still have to figure out what to do if the user types:

  (gdb) break add_two_values

... when add_two_values is a template.

One option is to propagate this "return type in the name" all the way
through to the user, and mention it in the documentation.  So the
user really would have to type:

  (gdb) break 'int add_two_values<int,int>TAB

> LD, c++filt, nm, objdump, etc all use it.
> GDB seems to *depend* on it more, but this is not a good thing. We
> depend on mangled names too much.

nm, objdump, and c++filt just use demangling in their output.
As far as I know, ld operates the same way.  Does it ever demangle a name
and use the result for anything except error printing?

gdb is the only tool I know where people type in names and the tool
has to match against demangled forms.

If you are suggesting that the demangler should return a nice tree
of information, instead of gdb doing its own re-parsing, I'm in favor
of that.

> I've already rewritten the dwarf2 reader, including the scope work.
> There would be little point in JimB rewriting it again.

I saw the patch.

Do you have any test results, or plans for getting it tested?

Michael


^ permalink raw reply	[flat|nested] 25+ messages in thread
* Re: So what is wrong with v3 C++
@ 2001-06-28 18:12 Michael Elizabeth Chastain
  2001-06-28 19:06 ` Daniel Berlin
  0 siblings, 1 reply; 25+ messages in thread
From: Michael Elizabeth Chastain @ 2001-06-28 18:12 UTC (permalink / raw)
  To: ac131313, gdb

Here are the open PR's:

  gdb/7   cout << 1 doesn't work for c++
  gdb/18  gdb can't parse "info func operator*" or "info func operator\*"
  gdb/19  gdb v3 demangler fails on hairyfunc5 hairyfunc6 hairyfunc7
  gdb/27  ptype shows duplicate constructors and destructors
  gdb/33  name matching on template names is sensitive to white space
  gdb/34  g++ v3 functions show as "inheritance2() ()"
  gdb/39  C++ constructors show bogus return type
  gdb/40  C++ template functions have return types in their names
  gdb/41  testsuite/gdb.c++/demangle.exp needs v3 coverage
  gdb/57  nested classes incorrectly printing
  gdb/59  static members in a base class confuse gdb
  gdb/60  GDB has problems with C++ symbols

As I've talked about with JimB, PR gdb/27 requires new design in gdb.
The issue is that gcc takes one source function (a constructor or a
destructor) and emits two or three object code functions for it.  This
is new in g++ v3, and as far as I know, gdb has never had machinery to
handle anything like this.  All the rest of the PR's are simply bugs.

Some of the template stuff and namespace stuff may require new design.
Probably every case that is broken in v3 was already broken in v2.

Pointers-to-members probably don't work.  There is a test script
gdb.c++/member-ptr.exp that is disabled with the following comment:

  # Nearly all of these tests fail when compiled with G++, so just give up
  # until GDB gets enhanced. -sts 1999-06-22

Here are the bugs that I haven't filed PR's on yet.  I'll just bite the
bullet and file some PR's tonight.

  function call with reference parameter
  fails in gdb.c++/classes.exp
  fails in both v2.95.3 and v3pre

    When the test script calls a function by hand, and the function
    has a reference parameter, the inferior program gets a SIGSEGV.

  user accesses ambiguous base
  fails in gdb.c++/inherit.exp
  fails in both v2.95.3 and v3pre

    The program under test has a non-virtual base class which appears
    several times (B:A and C:A and D:B,C so D has two A's).  The debugger
    when the user references a member such as "d::a", gdb should say
    that this is ambiguous.  Instead, gdb uses the first one that it
    finds.

  gdb value for some arguments at beginning of function
  fails in gdb.c++/overload.exp
  passes in v2.95.3, fails in v3pre

    Argument values are incorrect when calling a function with an
    arg of type short, unsigned short, long, or unsigned long.

  user sets breakpoint on template class ctor/dtor
  fails in gdb.c++/templates.exp
  results lost for v.29.3, fails in v3pre

    The test script attempts to set breakpoints on "T5<int>::T5"
    and "T5<int>::~T5".  gdb fails to find these functions.

> My second question.  How many of these bugs can be fixed without 
> rewriting the dwarf2 reader?  My understanding is that both the virtual 
> functions and the thunks bugs can.

I think so too.  There's a big issue with finding and using the virtual
base pointers properly.  As I understand it, Jim's going to rewrite this
code.  Then if the code has problems, we will:

  . check the assembly code of the program-under-test against the
    Intel spec.  If the assembly code does not conform, file an
    upstream PR against gcc.

  . if the assembly code does conform, debug the new v3 code that
    implements stuff like baseclass_offset.

Another way to look it: I don't think any of the *new* v3 bugs are in
the dwarf2 reader.

Michael


^ permalink raw reply	[flat|nested] 25+ messages in thread
* So what is wrong with v3 C++
@ 2001-06-28 16:28 Andrew Cagney
  2001-06-28 18:59 ` Daniel Berlin
  2001-06-29 13:40 ` Jim Blandy
  0 siblings, 2 replies; 25+ messages in thread
From: Andrew Cagney @ 2001-06-28 16:28 UTC (permalink / raw)
  To: GDB Discussion

So,

[Perhaphs I should write a book about how I'm a reformed C++ programmer 
... :-)]

At the risk of ``playing manager'', I'd like to try to understand 
exactly what the problems with GDB v3.0 are.  If nothing else, I, or 
someone else, will need to document these as known bugs in the 5.1 
release notes.  Further, since C++ no longer has a maintainer, I think 
that now is probably a good time to take stock.


Anyway, to this end, I had a face to face discussion with Jim Blandy 
(Don and a few others were present and were contibuting, unfortunatly, 
neither DanB nor Michael C were around).

In that discussion, my attention was drawn to the following v3 C++ problems:


> - Dwarf 2 reader: fix constructor stuff
>   ( http://sources.redhat.com/ml/gdb/2001-06/msg00096.html )


While this has been discussed to death and causes many many failures and 
a fix involves changes to the dwarf2 reader.  I'm left wondering if:

	o	it really needs a dwarf2 rewrite

	o	compared to some of the other
		bugs, it is really that urgent

Personally, I'd be more worried about being able to single step and 
print variables correctly.



> - Virtual base classes, and their virtual functions


This, I understand is more serious.  GDB does need to be able to print 
out virtual base classes, their functions and so on.  I understand that, 
at present, it prints out bogus information.

Going by what Jim indicated, though, this in theory just involves more 
foot leather - finding the time to fill in the missing cases.  I suspect 
that who ever does do this will need very thick soles on their shoes.


> - Skipping vtable thunks, if necessary


I don't know if this was ever discussed on this list.  As I understand 
it, v3 virtual function is sometimes called via a ``thunk''.  A 
``thunk'' pulls a rabbit out of a hat (finds the correct object to pass 
to the real function) and then passes control to the real function.

At present, if GDB stepped into a thunk it would find no line info, 
treat it like a library and just skip it - oops, step into virtual 
functions via thunks doesn't work.

One proposed solution is to mimic / generalize the shared library 
mechanism so that GDB will single step through it to the real function.

I think this bug is pretty serious since, GDB will, randomly loose 
control over the target.  I certainly think it is more serious than the 
constructor problem.


> - Breakpoint work?


This one I don't remember.  There was a question if, given an arbitrary 
C++ expression, GDB could find and set a breakpoint on the correct function.


> - decode_line_1


This one has been discussed to death.  The current decode_line_1 is 
un-maintainable.  However, people, are largely living with it.


So my first question.  Are there any other serious v3 bugs?  MichaelC, 
you're probably most familar with the testsuite and what it is reporting 
as broken.

My second question.  How many of these bugs can be fixed without 
rewriting the dwarf2 reader?  My understanding is that both the virtual 
functions and the thunks bugs can.

enjoy,
	Andrew




^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2001-07-04  9:22 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-06-28 20:42 So what is wrong with v3 C++ Michael Elizabeth Chastain
2001-06-28 20:44 ` Christopher Faylor
2001-06-28 23:10   ` Daniel Berlin
2001-06-28 23:08 ` Daniel Berlin
2001-06-29  0:29 ` Tom Tromey
  -- strict thread matches above, loose matches on Subject: below --
2001-07-02 14:54 Benjamin Kosnik
2001-06-29 11:57 Benjamin Kosnik
2001-07-02 20:28 ` Per Bothner
2001-06-29 10:28 Michael Elizabeth Chastain
2001-06-29 11:40 ` Daniel Berlin
2001-06-29  0:56 Michael Elizabeth Chastain
2001-06-28 23:50 Michael Elizabeth Chastain
2001-06-29  8:59 ` Daniel Berlin
2001-06-28 23:31 Michael Elizabeth Chastain
2001-06-29  8:59 ` Daniel Berlin
2001-06-28 18:12 Michael Elizabeth Chastain
2001-06-28 19:06 ` Daniel Berlin
2001-06-28 16:28 Andrew Cagney
2001-06-28 18:59 ` Daniel Berlin
2001-06-29 13:40 ` Jim Blandy
2001-06-29 23:15   ` Daniel Berlin
2001-06-30 10:06     ` Jim Blandy
2001-06-30 12:30       ` Daniel Berlin
2001-07-02  9:01         ` Jim Blandy
2001-07-04  9:22   ` Andrew Cagney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox