[Bug] Cannot step into SEH __except handler.
In Visual Studio 2022, if I put a breakpoint inside page_fault_handler(DWORD exception_code) it gets hit after first hitting the ptr[0] = 0; exception.
In Raddbg, if I put a breakpoint inside of page_fault_handler(DWORD exception_code) it never gets hit because I cannot continue after the exception at ptr[0] = 0
Here are two videos showing the problem: Visual studio working https://www.youtube.com/watch?v=io9ahgyJfM0 Raddbg not working https://www.youtube.com/watch?v=cuCGhRjYJjg
Minimal repo code. main.c
#include <Windows.h>
#include <stdio.h>
#define PAGE_SIZE 4096 // Assuming typical page size
#define PAGE_LIMIT 2 // Limit to trigger the exception after 2 pages
static void* base_address;
// Exception handler to commit memory pages
int __stdcall page_fault_handler(DWORD exception_code) {
printf("Page fault detected. Committing a page...\n");
VirtualAlloc(base_address, PAGE_SIZE, MEM_COMMIT, PAGE_READWRITE);
return EXCEPTION_CONTINUE_EXECUTION;
}
int main() {
// Reserve memory for PAGE_LIMIT pages
base_address = VirtualAlloc(NULL, PAGE_LIMIT * PAGE_SIZE, MEM_RESERVE, PAGE_NOACCESS);
__try {
// Trigger an access violation by writing to uncommitted memory
volatile char* ptr = (char*)base_address;
// This write should trigger page_fault_handler(DWORD exception_code).
// In Visual studio 2022, if I put a breakpoint in the page_fault_handler(DWORD exception_code)
// function then it gets hit. In Raddbg, I cannot continue past the exception.
ptr[0] = 0;
}
__except (page_fault_handler(GetExceptionCode())) {
printf("Exception handler failed to commit page.\n");
return 1;
}
printf("Page successfully committed and written to.\n");
VirtualFree(base_address, 0, MEM_RELEASE);
return 0;
}
I try to be as clear as possible in my bug reports so please let me know if there is anything I could add. Also please let me know if I am simply "holding it wrong".
I am loving the debugger so far, this is just one issue I have hit.