mirror of
https://github.com/reactos/sysreg2.git
synced 2024-11-26 21:00:27 +00:00
[SYSREG2] In case of a timeout, break into debugger
This new feature will help debugging timeouts occuring during tests by forcing a break into the debugger. Afterwards, the VM is restarted, as previously done. This could be generalized to other cases.
This commit is contained in:
parent
6b68b7dfba
commit
a428bc25ec
22
console.c
22
console.c
@ -27,6 +27,7 @@ int ProcessDebugData(const char* tty, int timeout, int stage )
|
||||
bool AlreadyBooted = false;
|
||||
bool Prompt = false;
|
||||
bool CheckpointReached = false;
|
||||
bool BrokeToDebugger = false;
|
||||
|
||||
/* Initialize CacheBuffer with an empty string */
|
||||
*CacheBuffer = 0;
|
||||
@ -100,10 +101,17 @@ int ProcessDebugData(const char* tty, int timeout, int stage )
|
||||
}
|
||||
else if (got == 0)
|
||||
{
|
||||
/* timeout */
|
||||
/* timeout - only break once then, quit */
|
||||
SysregPrintf("timeout\n");
|
||||
Ret = EXIT_CONTINUE;
|
||||
goto cleanup;
|
||||
if (!BreakToDebugger() || BrokeToDebugger)
|
||||
{
|
||||
Ret = EXIT_CONTINUE;
|
||||
goto cleanup;
|
||||
}
|
||||
else
|
||||
{
|
||||
BrokeToDebugger = true;
|
||||
}
|
||||
}
|
||||
|
||||
/* Check for global timeout */
|
||||
@ -213,7 +221,10 @@ int ProcessDebugData(const char* tty, int timeout, int stage )
|
||||
goto cleanup;
|
||||
}
|
||||
else
|
||||
{
|
||||
AlreadyBooted = true;
|
||||
BrokeToDebugger = false;
|
||||
}
|
||||
}
|
||||
|
||||
/* Detect whether the same line appears over and over again.
|
||||
@ -276,7 +287,10 @@ int ProcessDebugData(const char* tty, int timeout, int stage )
|
||||
{
|
||||
++Cont;
|
||||
|
||||
if (Cont <= AppSettings.MaxConts)
|
||||
/* We won't cont if we reached max tries, or if we manually
|
||||
* broke to debugger (timeout?)
|
||||
*/
|
||||
if (Cont <= AppSettings.MaxConts && !BrokeToDebugger)
|
||||
{
|
||||
KdbgHit = 0;
|
||||
|
||||
|
16
libvirt.cpp
16
libvirt.cpp
@ -204,3 +204,19 @@ bool LibVirt::IsConnected() const
|
||||
{
|
||||
return (vConn != NULL);
|
||||
}
|
||||
|
||||
bool LibVirt::BreakToDebugger() const
|
||||
{
|
||||
int ret;
|
||||
unsigned int keycodes[2];
|
||||
|
||||
/* If VM not running, do nothing */
|
||||
if (vDom == NULL)
|
||||
return false;
|
||||
|
||||
/* Otherwise, send tab + k */
|
||||
keycodes[0] = 0x9; /* TAB */
|
||||
keycodes[1] = 0x4B; /* K */
|
||||
ret = virDomainSendKey(vDom, VIR_KEYCODE_SET_WIN32, 10, &keycodes[0], 2, 0);
|
||||
return (ret == 0);
|
||||
}
|
||||
|
@ -25,6 +25,7 @@ public:
|
||||
virtual void ShutdownMachine() = 0;
|
||||
virtual void CloseSerialPort() = 0;
|
||||
virtual bool IsConnected() const = 0;
|
||||
virtual bool BreakToDebugger() const = 0;
|
||||
|
||||
virtual ~Machine() {};
|
||||
};
|
||||
@ -43,6 +44,7 @@ public:
|
||||
virtual void ShutdownMachine();
|
||||
virtual void CloseSerialPort();
|
||||
virtual bool IsConnected() const;
|
||||
virtual bool BreakToDebugger() const;
|
||||
|
||||
protected:
|
||||
virConnectPtr vConn;
|
||||
|
1
sysreg.h
1
sysreg.h
@ -113,6 +113,7 @@ bool ResolveAddressFromFile(char* Buffer, size_t BufferSize, const char* Data);
|
||||
extern const char* OutputPath;
|
||||
extern Settings AppSettings;
|
||||
extern ModuleListEntry* ModuleList;
|
||||
bool BreakToDebugger(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
15
virt.cpp
15
virt.cpp
@ -14,6 +14,20 @@ const char DefaultOutputPath[] = "output-i386";
|
||||
const char* OutputPath;
|
||||
Settings AppSettings;
|
||||
ModuleListEntry* ModuleList;
|
||||
Machine * TestMachine = 0;
|
||||
|
||||
/* Wrapper for C code */
|
||||
bool BreakToDebugger(void)
|
||||
{
|
||||
/* We need a machine started */
|
||||
if (TestMachine == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Call the C++ method */
|
||||
return TestMachine->BreakToDebugger();
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
@ -21,7 +35,6 @@ int main(int argc, char **argv)
|
||||
char console[50];
|
||||
unsigned int Retries;
|
||||
unsigned int Stage;
|
||||
Machine * TestMachine = 0;
|
||||
|
||||
/* Get the output path to the built ReactOS files */
|
||||
OutputPath = getenv("ROS_OUTPUT");
|
||||
|
Loading…
Reference in New Issue
Block a user