base: distinct TRACED from ATTACHED trace subjects

This patch makes the trace-subject state as reflected to the trace
monitor more accurate.

Until now, a subject could be in UNTRACED or TRACED state. In reality,
however, there exists an intermediate state after the trace monitor
called 'trace' for the subject but before the subject locally activated
the tracing (done when passing a trace point). This intermediate state
was reflected as UNTRACED. Consequently, threads that never pass a trace
point (e.g., just waiting for I/O) would remain to appear as UNTRACED
even after enabling its tracing by the trace monitor. This is confusing.

This patch replaces the former UNTRACED and TRACED states by three
distinct states:

  UNATTACHED  prior any call of 'trace'
  ATTACHED    after a trace monitor called 'trace'
              but before the tracing is active
  TRACE       tracing is active

Fixes #4447
This commit is contained in:
Norman Feske
2022-03-11 14:06:16 +01:00
committed by Christian Helmuth
parent f3984ba5a9
commit be0a1742ac
3 changed files with 30 additions and 37 deletions

View File

@@ -107,17 +107,18 @@ class Genode::Trace::Subject_info
{
public:
enum State { INVALID, UNTRACED, TRACED, FOREIGN, ERROR, DEAD };
enum State { INVALID, UNATTACHED, ATTACHED, TRACED, FOREIGN, ERROR, DEAD };
static char const *state_name(State state)
{
switch (state) {
case INVALID: return "INVALID";
case UNTRACED: return "UNTRACED";
case TRACED: return "TRACED";
case FOREIGN: return "FOREIGN";
case ERROR: return "ERROR";
case DEAD: return "DEAD";
case INVALID: return "INVALID";
case UNATTACHED: return "UNATTACHED";
case ATTACHED: return "ATTACHED";
case TRACED: return "TRACED";
case FOREIGN: return "FOREIGN";
case ERROR: return "ERROR";
case DEAD: return "DEAD";
}
return "INVALID";
}