-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CORE: Implement a generic external monitor framework in Xemu (initially used by MEGA65 emulation only though) #11
Comments
According to my current ideas only ... I think (after chatting on these with Paul as well) the best way would be to keep uart-mon interface fully compatible with the real M65 (ie, VHDL implementation of M65 in the FPGA) as m65dbg (and btw uart-monitor was "invented"!) was written for that, and not for Xemu (Xemu tries only implement this uart-mon interface of the board itself). So then m65dbg is really a dual purpose tool, to be able to support the real hardware, and the emulator too. It also requires to try to keep the features of the interface at the minimum as much as possible and implement advanced features (like disasm) on the level of the m65dbg tool itself (or possibly even in a library - libm65dbg - which can be used then by the m65dbg CLI tool, and maybe other future debugger projects with GUI interfaces, PC-based IDEs, or whatever). This basically means, that only the minimal set of features needed at the emulator (or the board/FPGA/VHDL) side, and implement as many features as possible on the m65dbg side then. Surely it's only an idea now. I've got a very neat piece of work as pull request #52 which made me think about the plans and older chats with developers on this topic, that's why I write these for now. |
Commit 3a85292 |
* works over TCP/IP, through network too, on windows too * works on windows too (not the UNIX domain socket old one), with winsock2 * auto detection of text mode (normal) and HTTP communication * runs in separate thread with msg queues to interact with the emulator * WORKS IN PROGRESS, it does not do too much currently!!
#143 was a step to the direction by providing a socketapi which can be used for this really old issue |
Some works on the current monitor (not this feature): #220 by Gurcei. |
Again a new beginning. Commit 7629a37 intends to create a cross-platform tcp/ip, thread based umon server solution based on xemu's socketapi abstraction. |
|
…o the hardware (particularly the extra map-mask bits in MAPL, MAPH)
@gurcei The plan for breakpoints API in general: CPU65 emulation core will get an opcode callback mechanism. Rules:
With this, the emulation target can choose its own way to implement breakpoint, based on Really this is kinda easy to implement, in fact, already done (but not committed yet). TODO:
NOTE: some may need to be careful not to confuse the breakpoint API with the "memwatch" API: the breakpoint API we're talking about here only deals with opcode fetches and NMI/IRQ acceptances. The "memwatch" API in the other hand can handle any kind of memory read and write operations to be intercepted. Also the breakpoint API can stop the CPU before the actual opcode, while the memwatch API - unfortunately - can only react when an opcode emulation already in progress, thus it's inconsistent somewhat what phase the opcode emulation we're in ... Because it can happen even many-many times within a single opcode (think about a 32 bit flat addressed 32 bit opcode ..., there is need to query BP for 4 bytes of read, then the target memory, not even counting the opcode and prefix fetches ...). |
To allow easier debugger implementation with breakpoints, and such, a new (optional to be used) mechanism is introduced. It allows the CPU65 emulation core to call target emulator defined functions on each op code executions (and in case of IRQ and NMI acceptance). The target emulator itself can decide what to do in the callbacks, it can simply return, or instructing the CPU emulation to be stopped (ie: breakpoint or step based opcode execution during debugging). NOTE: still, the target emulator's main loop must aware of this, the CPU65 core itself alone cannot stop the whole emulation in a sane way.
This quite big change rewrites the MEGA65 emulation memory decoder subsystem. Some of the reasons: * Create a new, not overcomplicated decoder which can be understood at all without major headache, and can be also faster as per #209 * Taking account some new findings about how C65 worked (both Xemu and MEGA65 was wrong here) and adopted since then by MEGA65 as per #378 * More about the future (not ready in this commit): allow functionality for debugger implementation "watchmem" which can monitor about every memory r/w events debugger want to check as per #11 This commit is quite big as was mentioned, and may introduce some regressions. So it's important to have feedback in those cases. Also it changes the behaviour of memory decoding (#378). The new decoder seems to be already faster than the old one and more easy to understand and maintain. Also there is some room for future improvements still in every areas, including optimizations. The "memwatch" part currently is not usable though, but the basis are there to be able to implement that at all (wouldn't be possible with the older scheme).
Preliminary initial work, reorganization of uartmon, moving things out from mega65.c to uart_monitor.c No functionality change yet! And not even tested yet ;)
Moving everything out of mega65.c which is uartmon into uart_monitor.c, well, at least allmost everything ... Still, no new feature is used from CPU65 emulation, just mainly reorganization of the source to look nicer for further hacking/developing.
Mega65 target got "UART monitor" for similar job as a real Mega65 has for. Note, that this feature would be useful for every targets for some form! So the monitor framework should be put into the common directory, also it would be cool to have Windows port, since currently it's UNIX only as it needs UNIX/POSIX related socket interface to be able to work.
The text was updated successfully, but these errors were encountered: