Skip to content

Instantly share code, notes, and snippets.

@seandenigris
Created December 5, 2011 18:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seandenigris/1434683 to your computer and use it in GitHub Desktop.
Save seandenigris/1434683 to your computer and use it in GitHub Desktop.
Cog VM (Squeak/Pharo Smalltalk) Hack: Skip Message Send (C part)
/* Skip over specified selector from the VM. Useful for when an error is preventing your image from starting. See http://forum.world.st/Fwd-Oops-I-put-a-halt-in-a-startup-method-td3800729.html for details */
char* realSelector = GIV(messageSelector) + BaseHeaderSize;
char* selectorToSkip = "restoreFrom:";
int selectorLength = lengthOf(messageSelector);
int sameSize = selectorLength == strlen(selectorToSkip);
int matches = strncmp(realSelector, selectorToSkip, selectorLength) == 0;
if (sameSize && matches) {
printf("Skipping ");
printActivationNameForSelectorstartClass(GIV(messageSelector), GIV(lkupClass));
printf("\n");
}
else {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment