This commit shows how LLDB python plug-in could look like.
Such an approach allows users to use LLDB for OS kernel debugging, for doing that they only need to implement two interfaces: OperatingSystemInterface and OSThread. As an example, this patch contains zephyr.py file with simple plug-in implementation for Zephyr OS, OS-specific files could live in OS' repository and evolve alongside it.
In the future, arch-specific code, e.g. arc.py, can be eliminated since LLDB already implements that functionality.
Remaining code can be upstreamed to LLDB with or without significant changes, the main idea of the review is to discuss these changes and the overall approach.
We really shouldn't be using the "lldb.debugger" in the script, we would want this to be supplied to a function call. Top level code isn't always a great idea. If you import this module before the process is loaded "plugin.process.icd.hardware.registers" might not be available.