{"id":13846358,"url":"https://github.com/notfoundry/ppstep","last_synced_at":"2025-07-12T07:32:34.563Z","repository":{"id":45430881,"uuid":"321183798","full_name":"notfoundry/ppstep","owner":"notfoundry","description":"Interactive C/C++ preprocessor macro debugger","archived":false,"fork":false,"pushed_at":"2020-12-18T16:56:05.000Z","size":79,"stargazers_count":101,"open_issues_count":0,"forks_count":6,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-02-17T10:36:34.535Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","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/notfoundry.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}},"created_at":"2020-12-13T23:41:08.000Z","updated_at":"2024-02-15T02:04:40.000Z","dependencies_parsed_at":"2022-09-02T20:50:47.323Z","dependency_job_id":null,"html_url":"https://github.com/notfoundry/ppstep","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/notfoundry%2Fppstep","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/notfoundry%2Fppstep/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/notfoundry%2Fppstep/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/notfoundry%2Fppstep/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/notfoundry","download_url":"https://codeload.github.com/notfoundry/ppstep/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225807261,"owners_count":17527221,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2024-08-04T18:00:30.958Z","updated_at":"2024-11-21T21:30:25.887Z","avatar_url":"https://github.com/notfoundry.png","language":"C++","funding_links":[],"categories":["Debuggers"],"sub_categories":[],"readme":"# ppstep\nThe C and C++ preprocessors are famous for allowing users to write opaque, hard-to-follow code through macros. These downsides are tolerated because macros also allow code to have a high level of abstraction, which can reduce software complexity and improve developer productivity. Doing the good parts takes dicipline; eliminating the bad parts takes refactoring, and importantly, debugging. PPstep is the debugger that macro writers can use to do that.\n\n\u003cimg src=\"https://raw.githubusercontent.com/notfoundry/ppstep/master/assets/demo.svg\"/\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ci\u003epreprocessing a sequence into a tuple, visualized!\u003c/i\u003e\n\u003c/p\u003e\n\n## Features\n- Visually single-step through macro expansion and rescanning until preprocessing is complete\n- Set breakpoints on macros for specific preprocessing events, and continue preprocessing between them\n- Show backtrace of pending macro expansions, and forward-trace of future macro rescans\n- #define/#undef macros mid-preprocessing, and interactively expand macros at any time\n- **TODO:** Reverse stepping to rewind preprocssing and view steps from an earlier point\n- **TODO:** visualizing #if/#elif/#else branches to explore conditional compilation\n\n## Building\n1. `git clone` this repository to get the source code\n2. make sure you have a C++17-supported compiler (GCC 5+, Clang 5+, etc.)\n2. build a relatively up-to-date [Boost](https://www.boost.org/users/download/), or install it from your package manager of choice\n3. `cd ppstep \u0026\u0026 cmake . \u0026\u0026 make` to build the `ppstep` binary\n\n## Usage\nTo try it out, run `ppstep your-source-file.c`. `ppstep` supports common preprocessor flags like --include/-I to add include directories, --define/-D to define macros, and --undefine/-U to undefine macros, if you need to do any of those things too.\n\n#### The Prompt\nYou should see a prompt that looks like `pp\u003e`. From here, you can step forward through preprocessing steps using the `step` or `s` commands, and see visually what each step does. You will notice that the prompt will have a suffix added to it to show what the current preprocessing step is, such as `called`, `expanded`, `rescanned`, or `lexed`. Newly-encountered macro calls, finished macro expansions, and finished macro rescans are each color-coded in the visual output so you can see where changes were made. When you are done, you can use the `quit` or `q` commands to exit the prompt.\n\nWhile stepping, if you want to see the history of pending macro expansions, you can use the `backtrace` or `bt` commands. You can also look into the future to see what the anticipated macro rescans will be by using the `forwardtrace` or `ft` commands.\n\n#### Breakpoints\nIf there is a specific macro and preprocessing step that you are interested in visualizing, you can set a breakpoint on that macro using the `break` or `b` commands. To break when a specific macro is called, for example, you could enter `break call YOUR_MACRO` or `bc YOUR MACRO`. Similarly to break when that macro is finished expanding, you could enter `break expand YOUR_MACRO` or `be YOUR_MACRO`. To continue preprocessing until one of these breakpoints is hit (or preprocessing is finished), use the `continue` or `c` commands.\n\nDeleting a breakpoint has a similar syntax to setting them: the complements to `break call YOUR_MACRO` or `bc YOUR_MACRO` are `delete call YOUR_MACRO` or `dc YOUR_MACRO`.\n\n#### Interactive Evaluation\nIf you choose to, you can also use preprocessor directives mid-preprocessing. For example, you could say `#define NEW_MACRO(x) x` to create a function-like macro named `NEW_MACRO` in real-time. `#include` and `#undef` also work as expected (though undefining a macro in the process of being expanded without then re-defining another macro under that name can have terrible consequences!) Macros can also be expanded mid-preprocessing with the `expand` or `e` commands. For example, `expand NEW_MACRO(1)` would open a nested prompt allowing you to step through each of the expansion stages of `NEW_MACRO`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnotfoundry%2Fppstep","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnotfoundry%2Fppstep","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnotfoundry%2Fppstep/lists"}