On 10/12/2010 09:57 AM, Nived wrote: > > This might be a silly question, but i was wondering what exactly the role of > OpenOCD is in debugging. I mean the internal functioning. I am assuming it > acts like a mediator and just enables debugging on a remote device. But i am > still not clear how this is done. Can anyone shed some light on this please ? > Ex When a break point is set at the gdb, does OpenOCD store this somewhere and > check if the particular symbol has been reached on the remote device or does > it do something a lot simpler like, tells gdb which instruction is running and > let gdb decide if the instruction is of interest. > > OpenOCD controls and manages the hardware debug interface to a target. Traditionally, the interface is JTAG, though support is being added for new interfaces like SWD (serial wire debug). Gdb has no knowledge of the specifics of the remote target. OpenOCD functions as a gdb server, receiving and acting on higher level user commands (e.g., breakpoint), and alerting gdb to the occurrence of events (e.g., halting).
Using breakpoints as an example... both gdb and OpenOCD store and manage breakpoints. But OpenOCD does what is necessary to ensure that the target halts when execution reaches the breakpoint. The details are target specific, but generally speaking, breakpoints can be classified as either "hardware" or "software". For software breakpoints, the instruction at the breakpoint address is subsituted with the target processor breakpoint instruction. Hardware breakpoints use a mechanism provided by the debug hardware on the target processor, if any, to the same end. Hardware breakpoints are handy in cases where the code can not be patched with the breakpoint instruction, such as when the code is running out of ROM, or has not yet been loaded into memory. Note that OpenOCD can be used stand-alone; i.e., without gdb, though its telnet port. This is handly for low-level debugging. Hope this helps, Mike _______________________________________________ Openocd-development mailing list [email protected] https://lists.berlios.de/mailman/listinfo/openocd-development
