I have a small command line application named "debugger" which acts as a debugger for a process A. Now this application works fine with x86 and x64. Now I have to migrate this "debugger" to ARM64 architecture. What this debugger very briefly does is attach breakpoints aka writes instruction int3(0xcc) to the start of functions it finds in the map file of the Process A. Now whenever I try to run my application via this "debugger" app I am able to set breakpoints but the app continuously gets "access_violation". My hunch is that for ARM64 architecture the instruction "0xcc" which I am writing to the start of the functions is causing the access_violation. Now I have two questions:
- Is "0xcc" valid instruction for putting breakpoint in ARM64?
- Can writing "0xcc" in ARM64 cause access_violation?
Please provide links for your answers as well.
Edit 2: Used "BRK" instead of "0xcc"
int BP_INSTRUCTION_OPCODE_ARM = 0x000020D4; void * baseAddress = "Some Value"; mProcessHandle = "ProcessHandle"; SIZE_T NumBytesWritten; ::WriteProcessMemory(mProcessHandle, baseAddress, (void*)BP_INSTRUCTION_OPCODE_ARM, sizeof(int), &NumBytesWritten);
This did not work for me… Am I doing something wrong here?
Source: Windows Questions C++