00001
00002
00003 #ifndef jdb_trace_h
00004 #define jdb_trace_h
00005
00006 #include "l4_types.h"
00007
00008
00009
00010
00011
00012
00013 class Sys_ipc_frame;
00014 typedef struct
00015 {
00016 Address lo, hi;
00017 } Addr_range;
00018
00019 class Jdb_ipc_trace
00020 {
00021 private:
00022 static int _other_thread;
00023 static Global_id _thread;
00024 static GThread_num _gthread;
00025 static int _other_task;
00026 static Task_num _task;
00027 static int _snd_only;
00028 static int _log;
00029 static int _log_to_buf;
00030 static int _log_result;
00031 static int _trace;
00032 static int _slow_ipc;
00033 static int _cpath;
00034 static int _cshortcut;
00035 friend class Jdb_set_trace;
00036
00037 public:
00038 static inline int log();
00039
00040 static inline int log_buf();
00041
00042 static inline int log_result();
00043
00044 static inline int check_restriction(Global_id id, Task_num task, Sys_ipc_frame *ipc_regs, Task_num dst_task);
00045
00046 static void clear_restriction();
00047
00048 static void show();
00049 };
00050
00051 class Jdb_pf_trace
00052 {
00053 private:
00054 static int _other_thread;
00055 static Global_id _thread;
00056 static GThread_num _gthread;
00057 static Addr_range _addr;
00058 static int _log;
00059 static int _log_to_buf;
00060 friend class Jdb_set_trace;
00061
00062 public:
00063 static inline int log();
00064
00065 static inline int log_buf();
00066
00067 static inline int check_restriction(Global_id id, Address pfa);
00068
00069 static void show();
00070
00071 static void clear_restriction();
00072 };
00073
00074 class Jdb_unmap_trace
00075 {
00076 private:
00077 static int _other_thread;
00078 static Global_id _thread;
00079 static GThread_num _gthread;
00080 static Addr_range _addr;
00081 static int _log;
00082 static int _log_to_buf;
00083 friend class Jdb_set_trace;
00084
00085 public:
00086 static inline int log_buf();
00087
00088 static inline int check_restriction(Global_id id, Address addr);
00089
00090 static void show();
00091
00092 static void clear_restriction();
00093 };
00094
00095 class Jdb_nextper_trace
00096 {
00097 private:
00098 static int _log;
00099 friend class Jdb_set_trace;
00100
00101 public:
00102 static inline int log();
00103
00104 static void show();
00105 };
00106
00107
00108
00109
00110
00111
00112 #include <cstdio>
00113 #include "entry_frame.h"
00114
00115
00116
00117
00118
00119
00120
00121 inline int Jdb_ipc_trace::log() { return _log; }
00122
00123 inline int Jdb_ipc_trace::log_buf() { return _log_to_buf; }
00124
00125 inline int Jdb_ipc_trace::log_result() { return _log_result; }
00126
00127
00128
00129 inline int
00130 Jdb_ipc_trace::check_restriction(Global_id id,
00131 Task_num task,
00132 Sys_ipc_frame *ipc_regs,
00133 Task_num dst_task)
00134 {
00135 return ( ((_gthread == (GThread_num)-1)
00136 || ((_other_thread) ^ (_gthread == id.gthread()))
00137 )
00138 && ((!_snd_only || ipc_regs->has_snd()))
00139 && ((_task == (Task_num)-1)
00140 || ((_other_task)
00141 ^ ((_task == task) || (_task == dst_task))))
00142 );
00143 }
00144
00145
00146 inline int Jdb_pf_trace::log() { return _log; }
00147
00148 inline int Jdb_pf_trace::log_buf() { return _log_to_buf; }
00149
00150
00151
00152 inline int
00153 Jdb_pf_trace::check_restriction(Global_id id, Address pfa)
00154 {
00155 return ( (((_gthread == (GThread_num)-1)
00156 || ((_other_thread) ^ (_gthread == id.gthread()))))
00157 && (!(_addr.lo | _addr.hi)
00158 || (_addr.lo <= _addr.hi && pfa >= _addr.lo && pfa <= _addr.hi)
00159 || (_addr.lo > _addr.hi && pfa < _addr.hi && pfa > _addr.lo)));
00160 }
00161
00162
00163 inline int Jdb_unmap_trace::log_buf() { return _log_to_buf; }
00164
00165
00166
00167 inline int
00168 Jdb_unmap_trace::check_restriction(Global_id id, Address addr)
00169 {
00170 return ( (((_gthread == (GThread_num)-1)
00171 || ((_other_thread) ^ (_gthread == id.gthread()))))
00172 && (!(_addr.lo | _addr.hi)
00173 || (_addr.lo <= _addr.hi && addr >= _addr.lo && addr <= _addr.hi)
00174 || (_addr.lo > _addr.hi && addr < _addr.hi && addr > _addr.lo)
00175 ));
00176 }
00177
00178
00179 inline int Jdb_nextper_trace::log() { return _log; }
00180
00181 #endif // jdb_trace_h