00001
00002
00003 #ifndef jdb_thread_list_i_h
00004 #define jdb_thread_list_i_h
00005
00006 #include "jdb_thread_names.h"
00007
00008 #include <cstring>
00009 #include <cstdio>
00010 #include <limits.h>
00011
00012 #include "jdb.h"
00013 #include "jdb_core.h"
00014 #include "jdb_module.h"
00015 #include "jdb_screen.h"
00016 #include "kernel_console.h"
00017 #include "keycodes.h"
00018 #include "simpleio.h"
00019 #include "thread.h"
00020 #include "thread_state.h"
00021 #include "static_init.h"
00022
00023 class Jdb_list_threads : public Jdb_module
00024 {
00025 private:
00026 static char subcmd;
00027 static char long_output;
00028
00029 public:
00030 Jdb_list_threads();
00031
00032 Jdb_module::Action_code action(int cmd, void *&, char const *&, int &);
00033
00034 static void show_thread_list();
00035
00036 Jdb_module::Cmd const *const cmds() const;
00037
00038 int const num_cmds() const;
00039
00040 private:
00041 static void list_threads_show_thread(Thread *t);
00042
00043 static void show_header();
00044
00045 static void list_threads(Thread *t_start, char pr);
00046 };
00047
00048 class Jdb_thread_list
00049 {
00050 private:
00051 static int _mode;
00052 static int _count;
00053 static char _pr;
00054 static Thread *_t_head, *_t_start;
00055
00056 friend class _foo;
00057
00058 enum { LIST_UNSORTED, LIST_SORT_PRIO, LIST_SORT_TID };
00059
00060 public:
00061 static void init(char pr, Thread *t_head);
00062
00063
00064 static inline const char* const get_mode_str(void);
00065
00066
00067 static void switch_mode(void);
00068
00069
00070 static void set_start(Thread *t_start);
00071
00072
00073 static int line_back(void);
00074
00075
00076 static int line_forw(void);
00077
00078
00079 static int page_back(void);
00080
00081
00082 static int page_forw(void);
00083
00084
00085 static int goto_home(void);
00086
00087
00088 static int goto_end(void);
00089
00090
00091 static int lookup(Thread *t_search);
00092
00093
00094 static Thread* index(int y);
00095
00096
00097 static int page_show(void (*show)(Thread *t));
00098
00099
00100 static int complete_show(void (*show)(Thread *t));
00101
00102 private:
00103
00104 static int get_prio(Thread *t);
00105
00106
00107 static int get_tid(Thread *t);
00108
00109 static inline Thread* iter_prev(Thread *t);
00110
00111 static inline Thread* iter_next(Thread *t);
00112
00113
00114
00115
00116 static bool iter(int count, Thread **t_start, void (*iter)(Thread *t)=0);
00117 };
00118
00119 #endif // jdb_thread_list_i_h