From: Tom Tromey <tromey@redhat.com>
To: Mathieu Lacage <mathieu.lacage@gmail.com>
Cc: gdb@sourceware.org
Subject: Re: gdb crash: double free with free_objfile
Date: Fri, 05 Feb 2010 15:40:00 -0000 [thread overview]
Message-ID: <m3bpg3het5.fsf@fleche.redhat.com> (raw)
In-Reply-To: <74fef6df1002050423j71fcba21sd62fe421cf14adac@mail.gmail.com> (Mathieu Lacage's message of "Fri, 5 Feb 2010 13:23:36 +0100")
>>>>> "Mathieu" == Mathieu Lacage <mathieu.lacage@gmail.com> writes:
Mathieu> a. make the duplicate entries point to private duplicates of
Mathieu> struct objfile *
Mathieu> b. make the duplicate entries point to a shared struct objfile and
Mathieu> add refcounting or some means to detect when the struct objfile is
Mathieu> shared.
Mathieu> I could implement a. by removing the for loop at the top of
Mathieu> symbol_add_stub but I suspect that there is a good reason for its
Mathieu> presence and that removing it would create some waste of memory in
Mathieu> other cases so, it's probably not a good idea to do this.
Mathieu> I am not totally sure that b. is correct to do. i.e., I _think_ (but I
Mathieu> am not sure) that the content of struct objfile is not dependent upon
Mathieu> the base address of the corresponding binary so I _think_ that it
Mathieu> should be safe to reuse the same one between two so_list entries
Mathieu> loaded at different base addresses. Am I wrong ? If so, my only option
Mathieu> is a but I the proposed 'fix' described above is probably not good. Is
Mathieu> there anyone with a better suggestion ?
Nope, right now objfile has the base address baked in to many things,
e.g. symbol addresses or psymtabs_addrmap. I think we'd like to change
this, so that we can share objfiles between inferiors, but nobody has
tried to do that yet. I don't know how hard this would be.
Your quickest route is probably a form of (a) -- change symbol_add_stub
to check both the file name and the base address.
Tom
next prev parent reply other threads:[~2010-02-05 15:40 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-05 12:23 Mathieu Lacage
2010-02-05 15:40 ` Tom Tromey [this message]
2010-06-23 15:15 ` Mathieu Lacage
2010-06-29 11:57 ` Mathieu Lacage
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=m3bpg3het5.fsf@fleche.redhat.com \
--to=tromey@redhat.com \
--cc=gdb@sourceware.org \
--cc=mathieu.lacage@gmail.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).