public inbox for archer-commits@sourceware.org help / color / mirror / Atom feed
From: jkratoch@sourceware.org To: archer-commits@sourceware.org Subject: [SCM] archer-jankratochvil-type-refcount: Fix stale references to already freed `struct type's on [vla]+[python]. Date: Sat, 28 Feb 2009 19:22:00 -0000 [thread overview] Message-ID: <20090228192255.16709.qmail@sourceware.org> (raw) The branch, archer-jankratochvil-type-refcount has been updated via acd14fd258b498d2faa5dc34751c43da5c8e476f (commit) from 6565d504ae7decaa9065580ea9cb9b039f1b3b05 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- ----------------------------------------------------------------------- Summary of changes: gdb/gdbtypes.c | 34 ++++++++++++---------------------- 1 files changed, 12 insertions(+), 22 deletions(-) First 500 lines of diff: diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index bd77774..45266ba 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -3348,16 +3348,14 @@ type_incref (struct type *type) } /* A traverse callback for type_refc_table which removes any entry - whose reference count pointer is REFC. REFC may be NULL to delete all the - unused entries - use such cleanup only in the GDB idle state as GDB code - does not necessarily reference county TYPEs during its processing. */ + whose reference count is zero (unused entry). */ static int -type_refc_remove (void **slot, void *refc) +type_refc_remove (void **slot, void *unused) { struct type_refc_entry *entry = *slot; - if (entry->refc == refc || (refc == NULL && *entry->refc == 0)) + if (*entry->refc == 0) { delete_type (entry->type); @@ -3368,8 +3366,10 @@ type_refc_remove (void **slot, void *refc) return 1; } -/* Decrement the reference count for TYPE. If TYPE has no more - references, delete it. */ +/* Decrement the reference count for TYPE. Even if TYPE has no more + references still do not delete it as callers may hold pointers to types + dynamically generated by check_typedef where type_incref is never called. + Always rely on the free_all_types garbage collector. */ void type_decref (struct type *type) @@ -3382,24 +3382,14 @@ type_decref (struct type *type) entry.type = type; found = htab_find (type_refc_table, &entry); gdb_assert (found); + gdb_assert (found->refc > 0); --*(found->refc); - if (*(found->refc) == 0) - { - void *refc = found->refc; - - /* Clear all table entries referring to this count. CHECK: Should not be - the deletion delayed till free_all_types? */ - delete_type_begin (); - htab_traverse (type_refc_table, type_refc_remove, refc); - delete_type_finish (); - - /* Delete the reference count itself. */ - xfree (refc); - } } -/* Free all the types that have been allocated (except for those released). - Called after each command, successful or not. */ +/* Free all the types that have been allocated and that are not used according + to type_refc_entry->refc. Called after each command, successful or not. + Use this cleanup only in the GDB idle state as GDB code does not necessarily + use type_incref / type_decref during temporary use of types. */ void free_all_types (void) hooks/post-receive -- Repository for Project Archer.
reply other threads:[~2009-02-28 19:22 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20090228192255.16709.qmail@sourceware.org \ --to=jkratoch@sourceware.org \ --cc=archer-commits@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: linkBe 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).