Semihosting is a mechanism by which some part of a standard C library call is implemented in the host debugger. The most common use of semihosting is to direct I/O thought the debugger to the host terminal or file system. A simple example of this is causing printf() to output to the debug console.
Semihosting works by having a function split between the host and target with a breakpoint mechanism coordinating and passing information between the two pieces.
For example in the case of printf(), the target firmware is responsible for copying the data to be printed into a designated place in memory or the register file. It then stops at a software breakpoint and waits for the debugger to complete the operation. The host debugger detects that the breakpoint has been hit and retrieves the data from the designated location. The host then completes the operation by displaying the information, and allows the target device to continue operation.
Since some of the functionality of a semihosted function resides inside the host debugger, the function can not operate without the debugger. For example, if printf() were to be run without a debugger connected, it would hit the breakpoint and wait for the hosted portion of the call to complete. Since no host exists the function would end up waiting forever.
Semihosting implementations are vendor specific and generally one vendors semihosting library will not work with another vendors debugger.
Redlib and Newlib come in both semihosted and nonhosted versions.
This is good to know.