[svn:parrot] r48011 - branches/gsoc_instrument/src/dynpmc
khairul at svn.parrot.org
khairul at svn.parrot.org
Mon Jul 5 16:35:34 UTC 2010
Author: khairul
Date: Mon Jul 5 16:35:33 2010
New Revision: 48011
URL: https://trac.parrot.org/parrot/changeset/48011
Log:
Added method to remove vtable hooks.
Modified:
branches/gsoc_instrument/src/dynpmc/instrumentvtable.pmc
Modified: branches/gsoc_instrument/src/dynpmc/instrumentvtable.pmc
==============================================================================
--- branches/gsoc_instrument/src/dynpmc/instrumentvtable.pmc Mon Jul 5 15:36:03 2010 (r48010)
+++ branches/gsoc_instrument/src/dynpmc/instrumentvtable.pmc Mon Jul 5 16:35:33 2010 (r48011)
@@ -314,6 +314,27 @@
*instr = stub;
}
+ METHOD remove_vtable_hook(STRING *vtable_str) {
+ Parrot_InstrumentVtable_attributes * const attr = PARROT_INSTRUMENTVTABLE(SELF);
+ STRING *key;
+ char *con_string;
+ size_t **instr, *orig;
+
+ /* Convert vtable_str to a constant STRING so that it can be used as a key. */
+ con_string = Parrot_str_to_cstring(INTERP, vtable_str);
+ key = CONST_STRING(INTERP, con_string);
+ Parrot_free_cstring(con_string);
+
+ /* Modify the entry. */
+ instr = (size_t **) parrot_hash_get(INTERP, attr->instrumented_hash, key);
+ orig = (size_t *) parrot_hash_get(INTERP, attr->original_hash, key);
+ if (instr == NULL || orig == NULL) {
+ Parrot_ex_throw_from_c_args(INTERP, NULL, 1,
+ "Unknown VTABLE entry: %Ss", vtable_str);
+ }
+ *instr = orig;
+ }
+
}
/*
More information about the parrot-commits
mailing list