Hi everyone,
I was just wondering if anyone could point me to details about the debugserver
built to run when debugging an x64 app on arm64?
I saw Jason post a tidbit here** and went to poke around the lldb
source tree to see if I could get some pointers for a small hobby project of my own, but, it looks like there isn’t much referring to either Rosetta, or “running in translation”. There was some in DNB.cpp
and debugserver.cpp
, but, seemed to be mostly checks to launch the special debugserver
. I’m going to do a more thorough review, but, wanted to ask here before I did.
My interest is largely for a toy debugger I’m working on. I recently upgraded to a new M2 Air, and was going to set about updating the project to work on arm64, but, thought I’d first check to see if I could do x86_64 development on here (and just break out the ancient Intel laptop for validation.)
Anyway, long story short, it doesn’t seem to work at all running under Rosetta2, specifically, writing memory to insert the INT3 trap instruction. All the calls appear successful, but, when executing the program, none of the traps seem to have actually been written (though, reading back the memory, does show them).
I did notice that I never got the Task Permission pop-up (or don’t remember seeing it) you get when trying to get a task from a PID for the first time.
I also noted that if I emit an INT3 with inline assembly when building the inferior, that does get hit. So possibly it’s a JIT issue in the Rosetta translation layer? Or maybe my vm write isn’t being committed somehow for some reason?
I have minimal repro, if that would help. If so, I could put it up on Github, or zip it here possibly? Let me know, and I’ll pop back in to provide that.
** How does LLDB filter out Rosetta threads in x86_64 targets on Apple Silicon? - #3 by jasonmolenda