Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Thomas Richter <thor@mail.math.tu-berlin.de>
To: Daniel Jacobowitz <drow@false.org>
Cc: gdb-patches@sourceware.org, gdb@sourceware.org
Subject: Re: C++ support improvement patch
Date: Mon, 23 Jan 2006 15:00:00 -0000	[thread overview]
Message-ID: <200601231459.k0NExoA9009812@mersenne.math.TU-Berlin.DE> (raw)
In-Reply-To: <20060123141344.GA13883@nevyn.them.org>

Hi Daniel,

> Thanks for the patch.  There's a lot of bits that just change formatting
> or comments; it's making it a little hard for me to work out what
> changes do what.

I think parts of the comments are useful to understand what's going
on here. The most sensitive part is in symtab.c.

> > o) GDB finds now members within the multiple-inheritance hierarchy of
> > a class. That is, if "this" points to a class "Foo" inherited from
> > "Bar" and "Baz", and "Baz" contains a member "me", then "print me"
> > will succeed now. gdb 6.4 and before just returned an "unknown symbol"
> > here, erraneously. This is because it was confused by a "class typedef"
> > g++ inserted here for subclasses in the dwarf-2 symbol table, which is
> > now cleverly avoided. The patch then, however, needs to be clever to
> > resolve expressions like this->Subclass::member, which - after a bit
> > of work - now works nicely as it should. It seems to me that it worked
> > more or less by accident before (Subclass was resolved as the constructor
> > name, not as the class name.)
> 
> Can you give a testcase for this problem?  It should already work,
> and if it doesn't I want to know why!

It doesn't. Sorry, the code where it doesn't is part of a larger code
project I wouldn't really be able to send (and you wouldn't be willing
to check, either ;-), but I'll see whether I'll be able to setup a minimal
testcase.

> Also, what version of GCC were you testing against?

That's g++ 3.4.4, the g++ in Debian stable.

> > o) For TAB-expansion, it removes the ":" as word-delimiter for
> > readline, thus allowing to find names in namespaces. The current
> > behaivour here is completely unusable for C++. The patch could
> > be better, though, it should read template argument delimiters < >
> > and function argument delimiters ( ) as "quotation characters",
> > though it doesn't. Though it's a huge improvement compared to
> > previous versions where TAB expansion was just not usable for C++.
> 
> This isn't the right fix, though.  Someone posted (Pierre Muller, a
> long time ago - April 2002!) an initial patch to make tab completion
> context sensitive (for Pascal) - tab complete to the colon, type the
> colon, and then tab complete structure members after the colon.
> 
> It isn't suitable as-is and no one ever had time to go back and improve
> it but that's what ought to be done.

Thanks for letting me know that this is being worked on. I agree that
the given patch is pretty much a "hands on" approach. If there's a better
way to do it, please do. Otherwise, the patch is "better than nothing".

> > o) GDB now avoids to set multiple breakpoints to the same location.
> > This goes in conjunction with another bug, namely that of being unable
> > to find constructors of multiply-inherited classes. Without the current
> > patch, setting a breakpoint for a constructor results in multiple breakpoint
> > locations found, all of them identical, and none of them actually 
> > beeing breaked on. With the patch applied, GDB at least finds only one
> > of the locations (good), but still doesn't break there (bad). This bug
> > seems partially caused by g++ not emmiting mangled names for constructors.
> 
> Would be better not to return duplicates, instead of not putting
> duplicates on the list... we know exactly why this happens.  It's
> all part of the multiple constructors issue that you mentioned below,
> and you can find more information about this in the gdb@ list archives.

Could you provide a reference, please? Currently, the found symbols are
identically (in fact, it's even the same structure using the same pointer),
so I don't quite see what's the benefit as there's no chance of telling
them apart later. I get two breakpoints at the same location (then, breaking
nothing). In the long run, though, I agree and the problem should be fixed,
not the symptom.

> > o) GDB does no longer print the character and the value for integer values
> > of size one. It only prints the character. The reason for this is that
> > with the ddd frontend, ddd parses the output of "info breakpoints" to
> > set or reset breakpoints (e.g. when moving them in the sources). Without
> > the patch, the syntax of the output is no longer valid, and is not parsable
> > by gdb again.
> 
> This is what GDB has always done.  I admit it's strange in expressions.
> What I'd like to see would be only the value in expression printouts,
> without changing the (useful) output of "print 'c'".

Thus, a similar patch applied higher in the calling chain, within
"info"?

> > i) gdb relies on the "MIPS linkage name" of members, though according to
> > the g++ folks it should not,
> 
> I have patches to remove this dependence that I will be revisiting in
> 2006.

I personally wouldn't care unless I would be able to set breakpoints. (-;

> > ii) g++ may create separate constructors depending on whehter the class is
> > constructed by itself, or as part of a subclass. gdb seems to be unaware
> > of this. I've no idea how to resolve this.
> 
> As I mentioned above, please see the GDB list archives.  It was just
> discussed again recently and I have some hope that 2006 will see a
> solution.

That would be great!

So long, and thanks for the comments.

Thomas Richter


  parent reply	other threads:[~2006-01-23 15:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-23  9:50 Thomas Richter
2006-01-23 14:13 ` Daniel Jacobowitz
2006-01-23 14:57   ` David Ayers
2006-01-23 15:00   ` Thomas Richter [this message]
2006-01-23 15:05     ` Daniel Jacobowitz

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=200601231459.k0NExoA9009812@mersenne.math.TU-Berlin.DE \
    --to=thor@mail.math.tu-berlin.de \
    --cc=drow@false.org \
    --cc=gdb-patches@sourceware.org \
    --cc=gdb@sourceware.org \
    /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