Main Page | Modules | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

jdb_bp.h

Go to the documentation of this file.
00001 // AUTOMATICALLY GENERATED -- DO NOT EDIT!         -*- c++ -*-
00002 
00003 #ifndef jdb_bp_h
00004 #define jdb_bp_h
00005 
00006 #include "initcalls.h"
00007 #include "l4_types.h"
00008 
00009 //
00010 // INTERFACE definition follows 
00011 //
00012 
00013 
00014 class Thread;
00015 
00016 class Breakpoint
00017 {
00018 public:
00019   enum Mode { INSTRUCTION=0, WRITE=1, PORTIO=2, ACCESS=3 };
00020   enum Log  { BREAK=0, LOG=1 };
00021 
00022 private:
00023   typedef struct 
00024     {
00025       int other;
00026       GThread_num thread; 
00027     } Bp_thread_res;
00028 
00029   typedef struct
00030     {
00031       int other;
00032       Task_num task;
00033     } Bp_task_res;
00034 
00035   typedef struct 
00036     {
00037       char reg;
00038       Address y, z;
00039     } Bp_reg_res;
00040 
00041   typedef struct 
00042     {
00043       unsigned char len;
00044       Address addr;
00045       Address y, z;
00046     } Bp_mem_res;
00047 
00048   typedef struct 
00049     {
00050       Bp_thread_res thread;
00051       Bp_task_res   task;
00052       Bp_reg_res    reg;
00053       Bp_mem_res    mem;
00054     } Restriction;
00055 
00056   Address      addr;
00057   Unsigned8    len;
00058   Address_type user;
00059   Mode         mode;
00060   Log          log;
00061   Restriction  restrict;
00062   static char const * const mode_names[4];
00063 
00064 public:  
00065   Breakpoint();
00066   
00067   inline void kill();
00068   
00069   inline int unused();
00070   
00071   inline int break_at_instruction();
00072   
00073   inline int match_addr(Address virt, Mode m);
00074   
00075   inline void set_logmode(char m);
00076   
00077   inline int is_break();
00078   
00079   inline void restrict_task(int other, Task_num task);
00080   
00081   inline void restrict_thread(int other, GThread_num thread);
00082   
00083   inline void restrict_register(char reg, Mword y, Mword z);
00084   
00085   inline void restrict_memory(Mword addr, Mword len, Mword y, Mword z);
00086   
00087   inline void clear_restriction();
00088   
00089   void show();
00090   
00091   // return TRUE  if the breakpoint does NOT match
00092   // return FALSE if all restrictions do match
00093   int restricted(Thread *t);
00094   
00095   int test_break(Thread *t, char *errbuf, size_t bufsize);
00096   
00097   // Create log entry if breakpoint matches
00098   void test_log(Thread *t);
00099   
00100   inline void set(Address _addr, Mword _len, Mode _mode, Log _log);
00101 };
00102 
00103 class Jdb_bp 
00104 {
00105 public:
00106   static int            global_breakpoints();
00107   static void           init_arch();
00108 
00109 private:
00110   static void           at_jdb_enter();
00111   static void           at_jdb_leave();
00112   static Breakpoint     bps[4];
00113 private:
00114 
00115 private:
00116   static int            Jdb_bp::test_sstep();
00117   static int            Jdb_bp::test_break(char *errbuf, size_t bufsize);
00118   static int            Jdb_bp::test_other(char *errbuf, size_t bufsize);
00119   static int            Jdb_bp::test_log_only();
00120   static Mword          dr7;
00121 
00122 public:  
00123   static FIASCO_INIT void init();
00124   
00125   static int set_breakpoint(int num, Address addr, Mword len, Breakpoint::Mode mode, Breakpoint::Log log, Task_num task);
00126   
00127   static void clr_breakpoint(int num);
00128   
00129   static inline void logmode_breakpoint(int num, char mode);
00130   
00131   static int first_unused();
00132   
00133   // Return 1 if a breakpoint hits
00134   static int test_break(Mword dr6, char *errbuf, size_t bufsize);
00135   
00136   // Create log entry if breakpoint matches.
00137   // Return 1 if debugger should stop
00138   static void test_log(Mword &dr6);
00139   
00140   static Mword test_match(Address addr, Breakpoint::Mode mode);
00141   
00142   static inline void restrict_task(int num, int other, Task_num task);
00143   
00144   static inline void restrict_thread(int num, int other, GThread_num thread);
00145   
00146   static inline void restrict_register(int num, char reg, Mword y, Mword z);
00147   
00148   static inline void restrict_memory(int num, Mword addr, Mword len, Mword y, Mword z);
00149   
00150   static inline void clear_restriction(int num);
00151   
00152   static void list();
00153   
00154   static Mword get_dr(Mword i);
00155 
00156 private:  
00157   static inline void clr_dr7(int num, Mword &dr7);
00158   
00159   static inline void set_dr7(int num, Mword len, Breakpoint::Mode mode, Mword &dr7);
00160   
00161   static int set_debug_address_register(int num, Mword addr, Mword len, Breakpoint::Mode mode, Task_num /* task */);
00162   
00163   static void clr_debug_address_register(int num);
00164 };
00165 
00166 #define write_debug_register(num, val) \
00167     asm volatile("movl %0, %%db" #num ";" : /* no output */ : "r" (val))
00168 
00169 #define read_debug_register(num) \
00170     ({Mword val; asm volatile("movl %%db" #num ",%0;" : "=r"(val)); val;})
00171 
00172 // external callable
00173 int jdb_instruction_bp_at_addr(Address addr);
00174 
00175 //
00176 // IMPLEMENTATION includes follow (for use by inline functions)
00177 //
00178 
00179 
00180 #include "kmem.h"
00181 
00182 //
00183 // IMPLEMENTATION of inline functions (and needed classes)
00184 //
00185 
00186 
00187 
00188 
00189 inline void
00190 Breakpoint::restrict_task(int other, Task_num task)
00191 {
00192   restrict.task.other = other;
00193   restrict.task.task  = task;
00194 }
00195 
00196 
00197 
00198 inline void
00199 Breakpoint::set(Address _addr, Mword _len, Mode _mode, Log _log)
00200 {
00201   addr = _addr;
00202   mode = _mode;
00203   user = Kmem::is_kmem_page_fault(_addr, 0) ? ADDR_KERNEL : ADDR_USER;
00204   log  = _log;
00205   len  = _len;
00206 }
00207 
00208 #endif // jdb_bp_h

Generated on Mon Sep 26 14:20:10 2005 for Fiasco by  doxygen 1.4.2