On Time RTOS-32 Documentation
Welcome
RTTarget-32
RTTarget-32 Programming Manual
RTTarget-32 Reference Manual
Introduction
RTTarget-32 Configuration
Screen I/O
Interrupt Handling
Port I/O
System Functions
Function RTReboot
Function RTHalt
Function RTHaltCPL3
Function RTWait
Function RTLocateSection
Function RTSectionName
Function RTCallRing0
Function RTRaiseCPUException
Function RTSetTlsSlots
Function RTSetFlsSlots
Function RTCallDebugger
Function RTHandleInfo
Function RTSetExitHandler
Function RTSetFileApisTo
Function RTSetVersionExA
Function RTSetDLLNameTranslation
Program Loading
Memory Mapping and Management
Real-Time Clock and CMOS RAM
Keyboard
Mouse and Touch Screen Driver
Parallel Port Printer
Serial Port I/O
PCI BIOS
Plug-and-Play BIOS
PC Cards (PCMCIA)
MetaWINDOW Initialization
Run-Time System Support
System Management BIOS (SMBIOS)
Advanced Programmable Interrupt Controller (APIC)
Multiprocessor Management
Spinlocks
Advanced Configuration and Power Interface (ACPI) Tables
Extended RAM Management
RTVmf-32
RTRth-32
RTKernel-32
RTFiles-32
RTIP-32
RTPEG-32
RTUSB-32
|
Function RTCallDebugger
Function RTCallDebugger allows an application to communicate with the Debug Monitor:
int RTCallDebugger(DWORD Command, DWORD P1, DWORD P2);
ParametersCommandA value specifying the action to be performed by the Debug Monitor. See below for all supported values.
P1Parameter 1. The interpretation of this value depends on Command.
P2Parameter 2. The interpretation of this value depends on Command.
return valuethe function return value is Command dependent.
The following Commands are supported:
Command |
Function |
RT_DBG_MONITOR |
Debug Monitor installation check. P1 and P2 are not used and should be set to 0. If the program is running under the Debug Monitor, the function will return a value less than 0 and greater/equal zero otherwise. |
RT_DBG_CALLRESET |
Parameter P1 specifies the address of a function the Debug Monitor should call when an application is abandoned (e.g. restarted) without having run to completion. Such a Debug Reset function can be used to bring the application to a state where it can be restarted. In particular for applications using shared IRQs, a Debug Reset function must be used to disable interrupt generation on all hardware on shared IRQs. For example, applications can install exit handlers using atexit() and then install exit() as the Debug Reset function. Parameter P2 is ignored. The function return value is undefined. |
RT_DBG_BREAK_CB |
Parameter P1 specifies the address of a callback function the Debug Monitor should call when it suspends or resumes the application. The callback must have a single int parameter and use __cdecl calling conventions. On program suspend, the parameter is set to RTT_MON_BREAK; on resume, it is RTT_MON_CONTINUE. The callback is invoked with interrupts disabled and it may not enable interrupts, not even temporarily. When P1 is NULL, the callback is removed. Suspend/resume events typically occur when the program encounters a breakpoint, but all calls to function RTCallDebugger() also suspend and then resume the program. The same applies to screen output redirected to the host.
Care must be taken to execute no code in the callback which might invoke the Monitor again, causing an infinite recursion. For example, the callback must not execute any code which could contain yet another breakpoint (in other words, you cannot debug such a callback). It must also not invoke printf() or any other screen I/O function which could be redirected to the host using RTSetDisplayHandler.
|
Example:
static void DbgHook(int Code)
{
switch (Code)
{
case RTT_MON_BREAK:
// the program has been suspended
break;
case RTT_MON_CONTINUE:
// the program will now continue
break;
default:
RTDisplayString("unknown debug hook code");
}
}
...
// make sure everything gets shut down properly
// even if we get restarted by the debugger
RTCallDebugger(RT_DBG_CALLRESET, (DWORD)exit, 0);
// have the Monitor call function DbgHook every time
// the program is suspended or continued:
RTCallDebugger(RT_DBG_BREAK_CB, (DWORD)DbgHook, 0);
Function RTSetFlsSlots
Function RTHandleInfo
|