public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* I would like to contribute
@ 2000-06-29 16:35 Regan Russell
  2000-06-30  0:10 ` Martin v. Loewis
  0 siblings, 1 reply; 3+ messages in thread
From: Regan Russell @ 2000-06-29 16:35 UTC (permalink / raw)
  To: gcc

Hi, I would like to contribute to gcc.
I would like you to suggest a small project
otherwise, I will look for the simplest
problem in the bug list and investigate it.

Regan Russell BSc (Comp Sci)
www.users.bigpond.net.au/rrussell
regan_russell@hotmail.com
rrussell@c2.telstra-mm.net.au

________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com

^ permalink raw reply	[flat|nested] 3+ messages in thread
* Re: I would like to contribute
@ 2000-06-30 11:50 Russell Browne
  0 siblings, 0 replies; 3+ messages in thread
From: Russell Browne @ 2000-06-30 11:50 UTC (permalink / raw)
  To: regan_russell, gcc

Regan Russell wrote:
	
> Hi, I would like to contribute to gcc.
> I would like you to suggest a small project
> otherwise, I will look for the simplest
> problem in the bug list and investigate it.
	
Here is a suggestion I have contemplated making for several years.

When a C++ destructor is called, the destructor sets the vtable for
the object under destruction to the vtable for the destructor's class,
so that any virtual function calls go to that class's function rather
than that for a subclass that has now been destroyed.

This can be useful information when debugging if one is using a debugger
such as GDB or UPS that shows the vtable symbolically; if the vtable
shows that the class for an object is the base class of what it
ought to be the most likely cause is that you are looking at an object
that has been destroyed.  But this debugging trick does not work if the
object you are looking at is already supposed to be of either the base class
or a subclass.

Now my suggestion:  When compiled with debugging and without optimization,
the final step in a destructor for a base class, or for a class whose base
class does not have virtual functions, should be to set the vtable to a
distinctive value.  Possible values might be 0, 0xdeadbeaf, or to a symbol
that demangles to something like "destoyed object vtable".  If the last
approach, which I like best, is taken, implement such a vtable with the
first 100 or so entries going to a function that prints a message to
stderr and aborts.

Russ Browne
Applied MicroSystems Corp.

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

end of thread, other threads:[~2000-06-30 11:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-06-29 16:35 I would like to contribute Regan Russell
2000-06-30  0:10 ` Martin v. Loewis
2000-06-30 11:50 Russell Browne

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).