public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: oliver.kellogg@t-online.de (Oliver Kellogg)
To: Andrew Haley <aph@redhat.com>
Cc: gcc@gcc.gnu.org
Subject: Re: Trace crash in gargabe collector to the code at fault?
Date: Fri, 28 Aug 2009 18:04:00 -0000	[thread overview]
Message-ID: <1251440738.14118.23.camel@tidbit.site> (raw)
In-Reply-To: <4A8705E9.4020303@redhat.com>

It turned out to be the following:

In multi source compile mode, I ggc_free() the data in dwarf2out.c after
code generation for a file is done. (I found that I need this because
otherwise the assembly code generated for file_2 to file_N of a compile
job will carry leftovers from the code generated for file_1.)

This includes freeing the comp_unit_die. However, struct tree_type
(tree.h) contains a union tree_type_symtab which has a member `die', and
this may point to the comp_unit_die.

gigi (ada/gcc-interface/trans.c) does not ggc_free the trees it
allocates, therefore these trees continue to be alive even when the
comp_unit_die was freed. So I guess I need to set TYPE_SYMTAB_DIE(t) to
NULL on all nodes before freeing comp_unit_die. To be verified now.

Thanks again Andrew.

Oliver


On Sat, 2009-08-15 at 20:00 +0100, Andrew Haley wrote:
> Oliver Kellogg wrote:
> > On Fri, 2009-08-14 at 10:41 +0100, Andrew Haley wrote:
> >>> I am stuck here, i.e. I don't know how to find the code
> >>> that is
> >>> at fault.
> >>> Is there some way to trace a pointer entered in
> >>> G.free_object_list
> >>> back to its origin in the code?
> >> The usual way to find this is to use a gdb watchpoint.  Find what object is
> >> being freed, put a breakpoing on ggc_alloc_stat at the point the object is
> >> created, and then put a watchpoint on the word that is being corrupted.
> >>
> >> Andrew.
> > 
> > Thanks.
> > I tried as follows:
> 
> That's not gonna work.
> 
> Put a breakpoint at the end of ggc_alloc_stat.  It'll have to be a
> conditional breakpoint on the address of the node that's being corrupted.
> 
> When the object is created, add the watchpoint.
> 
> Andrew.

  reply	other threads:[~2009-08-28  6:17 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-14 13:12 okellogg
2009-08-14 14:05 ` Andrew Haley
2009-08-14 19:28   ` Tom Tromey
2009-08-15 23:25   ` Oliver Kellogg
2009-08-16 10:51     ` Andrew Haley
2009-08-28 18:04       ` Oliver Kellogg [this message]
2009-08-28 21:12         ` Ian Lance Taylor
2009-08-31  4:57           ` Oliver Kellogg
2009-08-31 14:41             ` Tom Tromey

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=1251440738.14118.23.camel@tidbit.site \
    --to=oliver.kellogg@t-online.de \
    --cc=aph@redhat.com \
    --cc=gcc@gcc.gnu.org \
    --cc=okellogg@users.sourceforge.net \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).