Skip to content

Capesolo update#124

Merged
kevoreilly merged 13 commits intokevoreilly:capemonfrom
enzok:capesolo-update
Feb 19, 2026
Merged

Capesolo update#124
kevoreilly merged 13 commits intokevoreilly:capemonfrom
enzok:capesolo-update

Conversation

@enzok
Copy link
Copy Markdown
Contributor

@enzok enzok commented Feb 19, 2026

No description provided.

enzok and others added 12 commits December 17, 2025 09:29
Introduce `_pipe_sprintf` for formatted string output and
`InteractiveBreakpointCallback` for handling interactive
breakpoints. Update `SetConfigBP` and `SetInitialBreakpoints`
to conditionally use the new callback based on configuration,
enhancing breakpoint functionality for interactive debugging.
Moved the declaration of the function pointer
_NtQueryInformationThread from static to non-static,
allowing broader access outside the current translation unit.
Moved the declaration of the function pointer
_NtQueryInformationThread from static to non-static,
allowing broader access outside the current translation unit.
Implemented a PostBuildEvent in `capemon.vcxproj` and `loader.vcxproj` to copy DLLs to a specified directory upon a "Release" build. Removed `undoc_defs.h` from `capemon.vcxproj.filters`, indicating its exclusion from the project. This change standardizes the post-build behavior across both projects.
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @enzok, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the debugging capabilities by introducing 'CAPEsolo', a new interactive debugger. This debugger provides a rich set of commands for real-time process inspection and manipulation, integrating deeply with the existing tracing and breakpoint infrastructure. The changes enable a more dynamic and granular control over the monitored process, allowing for advanced analysis and intervention during execution.

Highlights

  • New Interactive Debugger (CAPEsolo): Introduced a comprehensive interactive debugger module, CAPE/Solo.c, which enables dynamic debugging capabilities through a named pipe interface.
  • Extensive Debugger Commands: Implemented a wide array of debugger commands, including instruction page retrieval, memory map viewing, register manipulation, step-in/over/out, memory dumping, stack viewing, breakpoint management, flag modification, thread/module listing, export enumeration, and byte patching.
  • Integration with Existing Breakpoint Mechanism: Modified CAPE/Trace.c to conditionally use the new interactive debugger's callback for breakpoints when the idbg configuration option is enabled, allowing seamless transition between standard and interactive debugging.
  • UTHASH Library Inclusion: Added the uthash library (CAPE/uthash.h) to efficiently manage the command map for the interactive debugger, providing fast lookup for command handlers.
  • New Configuration Option: Added a new configuration option, idbg, to config.h and config.c, allowing users to enable or disable the interactive debugger functionality.
  • Build System Updates: Updated Visual Studio project files (.vcxproj and .vcxproj.filters) to include the new Solo.c and uthash.h files, and added post-build events for release configurations to copy DLLs.
Changelog
  • CAPE/Solo.c
    • Added a new source file implementing the core logic for the CAPEsolo interactive debugger, including command parsing and execution.
  • CAPE/Trace.c
    • Updated breakpoint setting functions (SetConfigBP, SetInitialBreakpoints) to optionally use the InteractiveBreakpointCallback based on the g_config.idbg flag.
    • Declared InteractiveBreakpointCallback as an external function.
  • CAPE/uthash.h
    • Added the uthash library header file, providing a generic hash table implementation used for command mapping.
  • capemon.vcxproj
    • Included CAPE\Solo.c and CAPE\uthash.h in the project compilation.
    • Added a post-build event to copy DLLs for release configurations.
  • capemon.vcxproj.filters
    • Added CAPE\Solo.c and CAPE\uthash.h to the 'Source Files\CAPE' and 'Header Files\CAPE' filters, respectively.
  • config.c
    • Added logic to parse the new 'idbg' configuration option from the configuration file.
  • config.h
    • Added the idbg integer field to the _g_config structure to control the interactive debugger.
  • loader/loader/loader.vcxproj
    • Added a post-build event to copy DLLs for release configurations.
  • misc.c
    • Modified the declaration of pNtQueryInformationThread from static to external to allow access from other modules.
Activity
  • This is a new pull request, and no activity has been recorded yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new interactive debugger feature called 'Capesolo'. The changes include a large new file Solo.c with the core debugger logic, integration into the existing tracing functionality, and new configuration options. My review focuses on the new Solo.c file, where I've identified several issues including a critical bug in register manipulation, potential thread-safety problems with static buffers, missing error handling for memory allocation, and use of unsafe functions. I've provided suggestions to address these issues to improve the robustness and correctness of the new feature.

Comment thread CAPE/Solo.c
Comment thread CAPE/Solo.c
va_start(args, lpOutputString);

CHAR DebuggerLine[BUFFER_SIZE];
static CHAR DebuggerCommand[BUFFER_SIZE];
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The function returns a pointer to a static buffer (DebuggerCommand). This is not thread-safe. If this function is called from multiple threads, it can lead to race conditions where one thread's data is overwritten by another's. Furthermore, even in a single-threaded context, a call like printf("%s %s", InteractiveDebuggerPipe("a"), InteractiveDebuggerPipe("b")) will produce incorrect output because the second call overwrites the buffer before printf can read the result of the first call. Consider making the caller provide the buffer or allocating a new buffer on the heap for each call (and documenting that the caller must free it).

Comment thread CAPE/Solo.c

char* OutputRegisters(PCONTEXT Context)
{
static char OutputBuffer[OUTPUT_BUFFER_SIZE];
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The function returns a pointer to a static buffer (OutputBuffer). This is not thread-safe and can lead to race conditions if called from multiple threads. It also suffers from issues with nested calls in expressions, e.g., in a printf statement. The buffer from the first call would be overwritten by the second call before being printed. Consider having the caller provide a buffer or allocating memory dynamically.

Comment thread CAPE/Solo.c
Comment thread CAPE/Solo.c
Comment on lines +149 to +152
if (!CmdData)
{
return InteractiveDebuggerPipe("Memory allocation failed for command data.\n");
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This check if (!CmdData) is redundant and the error message is misleading. If the if condition on line 142 is met, Sep is not NULL, so CmdData = Sep + 1 will also not be NULL. The error message "Memory allocation failed for command data" is incorrect as no memory is allocated here. This block should be removed to improve code clarity and correctness.

Comment thread CAPE/Solo.c
Comment thread CAPE/Solo.c
@kevoreilly kevoreilly merged commit d5ec276 into kevoreilly:capemon Feb 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants