{"id":15001650,"url":"https://github.com/scopeo-project/scopeo-instrumentation","last_synced_at":"2026-02-07T09:32:51.541Z","repository":{"id":224234871,"uuid":"762783236","full_name":"scopeo-project/scopeo-instrumentation","owner":"scopeo-project","description":"Instrumentation library to install indirection on AST nodes of chosen methods","archived":false,"fork":false,"pushed_at":"2025-04-28T23:08:15.000Z","size":155,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-05T06:31:39.195Z","etag":null,"topics":["debugging","instrumentation","pharo","pharo-smalltalk","smalltalk"],"latest_commit_sha":null,"homepage":"","language":"Smalltalk","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/scopeo-project.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-02-24T17:19:44.000Z","updated_at":"2025-04-28T23:08:19.000Z","dependencies_parsed_at":"2024-02-24T18:26:37.186Z","dependency_job_id":"a2951594-5438-465a-8e8b-668ebbc0c2af","html_url":"https://github.com/scopeo-project/scopeo-instrumentation","commit_stats":{"total_commits":18,"total_committers":1,"mean_commits":18.0,"dds":0.0,"last_synced_commit":"ef5928a208b7037bc92781dd4f177cc6b8778287"},"previous_names":["scopeo-project/scopeo-instrumentation"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/scopeo-project/scopeo-instrumentation","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scopeo-project%2Fscopeo-instrumentation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scopeo-project%2Fscopeo-instrumentation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scopeo-project%2Fscopeo-instrumentation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scopeo-project%2Fscopeo-instrumentation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/scopeo-project","download_url":"https://codeload.github.com/scopeo-project/scopeo-instrumentation/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scopeo-project%2Fscopeo-instrumentation/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29191407,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-07T07:37:03.739Z","status":"ssl_error","status_checked_at":"2026-02-07T07:37:03.029Z","response_time":63,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["debugging","instrumentation","pharo","pharo-smalltalk","smalltalk"],"created_at":"2024-09-24T18:04:29.781Z","updated_at":"2026-02-07T09:32:51.526Z","avatar_url":"https://github.com/scopeo-project.png","language":"Smalltalk","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Scopeo instrumentation\n\n![Unit tests badge](https://img.shields.io/github/actions/workflow/status/scopeo-project/scopeo-instrumentation/tests.yml?label=Unit%20tests\u0026branch=main)\n\nA library to install instrumentation on Pharo smalltalk methods.\n\n## How to install?\n\nOpen a playground and execute the following baseline:\n```st\nMetacello new\n  githubUser: 'scopeo-project' project: 'scopeo-instrumentation' \n  commitish: 'main' path: 'src';\n  baseline: 'ScopeoInstrumentation';\n  load\n```\n\n## How to use?\n\n### Create an instrumentation\n\nTo create the instrumentation, instantiate the `ScpMethodInstrumentation` class.  \n\nTo define the behavioral indirection to install in a given method use one of `ScpIndirection` subclasses:\n- `ScpMethodIndirection`: transfer the control of method execution. \n- `ScpAssigmentIndirection`: transfer the control of variable assignments.\n- `ScpMessageIndirection`: transfer the control of messages sending.\n\nAll of these classes expect following parameters:\n- `handler:` the object which is going to catch the control of the original execution.\n- `selector:` the selector of the *hook method* implemented by the `handler` to control the execution. \n- `arguments:` the arguments expected by the later *hook method*. \n  Please refer to the methods beginning with `generate` of the indirection classes to know which arguments are valid for your indirection. \n\n**Note:** since an indirection transfers the original behavior to the object of your choice, it is the responsibility of the latter object to perform the original behavior or not. I.e if an indirection is installed to trace all message sends, the handler code must log **and** perform the message send to ensure the execution is still correct. \nTo do so, use the argument `operation`, this will provide the handler with a block containing the operation to execute.\n\n#### Example\n```st\n| instrumentation |\n\ninstrumentation := ScpMethodInstrumentation new.\n\ninstrumentation addIndirection: (\n  ScpMessageIndirection new\n    handler: [ :operation :selector :receiver | \n      selector crTrace. \n      receiver crTrace.\n      operation value\n    ];\n    selector: #value:value:value:;\n    arguments: #( operation selector receiver );\n    yourself\n)\n```\n\n### Install an instrumentation\n\n#### Install\n\nIt is possible to instrument an anonymous method using the message `applyOn: aMethod`:\n\n```st\ninstrumented := instrumentation applyOn: aMethod\n```\n\nIf the method is attached to a class, its instrumentation version can be installed using the message `installOn: aMethod`:.\n\n```st\ninstrumented := instrumentation installOn: aMethod\n```\n\nOne instrumentation can be installed on several methods.  \nIn this case, each non-anonymous methods is going to be attached to the instrumentation.  \n\n#### Uninstall\n\nTo uninstall the instrumentation, use the `uninstall` message.  \nThis message will affect each method on which the instrumentation was installed.\n\n```st\ninstrumentation uninstall\n```\n\n#### Update\n\nThe instrumentation can be updated, for example to add a new indirection (removal not supported yet).\n\n```st\ninstrumentation addIndirection: (\n  ScpAssignmentIndirection new\n    handler: [ :operation :variable :newValue | \n      variable crTrace. \n      newValue crTrace.\n      operation value \n    ];\n    selector: #value:value:value:;\n    arguments: #( operation variable newValue );\n    yourself\n)\n```\n\nTo apply this new indirection to all the methods previously instrumented use the `reinstall` message.\n\n```st\ninstrumentation reinstall\n```\n\n## Troubleshoot\n\n### Known issues\n\n- The methods are recompiled when instrumented, therefore the debugger looses track of the executed bytecode and cannot highlight the currently executed node.\n\n### Possible issues\n\n- An instrumented method always returns the source code of its original method, in some cases it might not be the expected behavior. For example, in the inspector of such method, the source code, AST and bytecode don't match.\n- When the source code of an instrumented method is being edited, the new source code is automatically updated (only for non-anonymous methods). During development, I sometimes had troubles with that, the method was re-instrumented while I previously had uninstalled the instrumentation. To troubleshoot such issues, de-activate the method updater using like so: `ScpMethodUpdater stop`.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscopeo-project%2Fscopeo-instrumentation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fscopeo-project%2Fscopeo-instrumentation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscopeo-project%2Fscopeo-instrumentation/lists"}