1 /*
2    Copyright (C) 1998 T. Scott Dattalo
3 
4 This file is part of the libgpsim library of gpsim
5 
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
10 
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 Lesser General Public License for more details.
15 
16 You should have received a copy of the GNU Lesser General Public
17 License along with this library; if not, see
18 <http://www.gnu.org/licenses/lgpl-2.1.html>.
19 */
20 
21 
22 #ifndef  SRC_BREAKPOINTS_H_
23 #define  SRC_BREAKPOINTS_H_
24 
25 #include "../config.h"
26 
27 #include <glib.h>
28 #include <string>
29 #include "exports.h"
30 #include "trigger.h"
31 #include "pic-instructions.h"
32 #include "registers.h"
33 
34 #include "gpsim_object.h" // defines ObjectBreakTypes
35 
36 class Expression;
37 class Integer;
38 class Processor;
39 class Trace;
40 
41 //using namespace std;
42 
43 extern Integer *verbosity;  // in ../src/init.cc
44 
45 class TriggerGroup : public TriggerAction {
46 protected:
47   std::list<TriggerObject*> triggerList;
48 
~TriggerGroup()49   virtual ~TriggerGroup() {}
50 };
51 
52 
53 #define MAX_BREAKPOINTS 0x400
54 #define BREAKPOINT_MASK (MAX_BREAKPOINTS-1)
55 
56 class Breakpoint_Instruction : public AliasedInstruction, public TriggerObject {
57 public:
58   Breakpoint_Instruction(Processor *new_cpu,
59                          unsigned int new_address,
60                          unsigned int bp);
61   virtual ~Breakpoint_Instruction();
62 
63   unsigned int address;
64 
65   virtual bool set_break() override;
66   virtual Processor* get_cpu();
67   virtual void print() override;
68   virtual int  printTraced(Trace *pTrace, unsigned int tbi,
69                            char *pBuf, int szBuf) override;
70 
71   virtual void clear() override;
bpName()72   virtual char const * bpName() override
73   {
74     return "Execution";
75   }
76 
isa()77   virtual enum INSTRUCTION_TYPES isa()
78   {
79     return BREAKPOINT_INSTRUCTION;
80   }
81   virtual void execute() override;
isBase()82   virtual bool isBase() override
83   {
84     return false;
85   }
86   virtual bool eval_Expression();
87 };
88 
89 
90 class Notify_Instruction : public Breakpoint_Instruction {
91   TriggerObject *callback;
92 public:
93   Notify_Instruction(Processor *cpu,
94                      unsigned int address,
95                      unsigned int bp,
96                      TriggerObject *cb);
97   virtual ~Notify_Instruction();
98 
isa()99   virtual enum INSTRUCTION_TYPES isa() override
100   {
101     return NOTIFY_INSTRUCTION;
102   }
103   virtual void execute() override;
bpName()104   virtual char const * bpName() override
105   {
106     return "Notify Execution";
107   }
108 };
109 
110 
111 class Profile_Start_Instruction : public Notify_Instruction {
112 public:
113   Profile_Start_Instruction(Processor *cpu,
114                             unsigned int address,
115                             unsigned int bp,
116                             TriggerObject *cb);
117 
isa()118   virtual enum INSTRUCTION_TYPES isa() override
119   {
120     return PROFILE_START_INSTRUCTION;
121   }
bpName()122   virtual char const * bpName() override
123   {
124     return "Profile Start";
125   }
126 };
127 
128 
129 class Profile_Stop_Instruction : public Notify_Instruction {
130 public:
131   Profile_Stop_Instruction(Processor *cpu,
132                            unsigned int address,
133                            unsigned int bp,
134                            TriggerObject *cb);
135 
isa()136   virtual enum INSTRUCTION_TYPES isa() override
137   {
138     return PROFILE_STOP_INSTRUCTION;
139   }
bpName()140   virtual char const * bpName() override
141   {
142     return "Profile Stop";
143   }
144 };
145 
146 
147 //
148 // Assertions
149 //
150 // Assertions are like breakpoints except that they're conditional.
151 // For example, a user may wish to verify that the proper register
152 // bank is selected while a variable is accessed.
153 //
154 class RegisterAssertion : public Breakpoint_Instruction {
155 public:
156   unsigned int regAddress;
157   unsigned int regMask;
158   unsigned int regValue;
159   bool bPostAssertion; // True if assertion is checked after instruction simulates.
160   typedef bool (*PFNISASSERTIONCONDITION)(unsigned int uRegValue,
161                                           unsigned int uRegMask, unsigned int uRegTestValue);
162   PFNISASSERTIONCONDITION m_pfnIsAssertionBreak;
163 
164   enum {
165     eRAEquals,
166     eRANotEquals,
167     eRAGreaterThen,
168     eRALessThen,
169     eRAGreaterThenEquals,
170     eRALessThenEquals,
171   };
172 
173   static bool IsAssertionEqualsBreakCondition(unsigned int uRegValue,
174       unsigned int uRegMask, unsigned int uRegTestValue);
175   static bool IsAssertionNotEqualsBreakCondition(unsigned int uRegValue,
176       unsigned int uRegMask, unsigned int uRegTestValue);
177   static bool IsAssertionGreaterThenBreakCondition(unsigned int uRegValue,
178       unsigned int uRegMask, unsigned int uRegTestValue);
179   static bool IsAssertionLessThenBreakCondition(unsigned int uRegValue,
180       unsigned int uRegMask, unsigned int uRegTestValue);
181   static bool IsAssertionGreaterThenEqualsBreakCondition(unsigned int uRegValue,
182       unsigned int uRegMask, unsigned int uRegTestValue);
183   static bool IsAssertionLessThenEqualsBreakCondition(unsigned int uRegValue,
184       unsigned int uRegMask, unsigned int uRegTestValue);
185 
186   RegisterAssertion(Processor *new_cpu,
187                     unsigned int instAddress,
188                     unsigned int bp,
189                     unsigned int _regAddress,
190                     unsigned int _regMask,
191                     unsigned int _regValue,
192                     bool bPostAssertion = false
193                    );
194 
195   RegisterAssertion(Processor *new_cpu,
196                     unsigned int instAddress,
197                     unsigned int bp,
198                     unsigned int _regAddress,
199                     unsigned int _regMask,
200                     unsigned int _operator,
201                     unsigned int _regValue,
202                     bool bPostAssertion = false
203                    );
204   virtual ~RegisterAssertion();
205 
206   virtual void execute() override;
207   virtual void print() override;
208   virtual int  printTraced(Trace *pTrace, unsigned int tbi,
209                            char *pBuf, int szBuf) override;
bpName()210   virtual char const * bpName() override
211   {
212     return "Register Assertion";
213   }
214 };
215 
216 
217 class Breakpoints;
218 
219 #if defined(IN_MODULE) && defined(_WIN32)
220 // we are in a module: don't access the Breakpoints object directly!
221 LIBGPSIM_EXPORT Breakpoints & get_bp();
222 #else
223 // we are in gpsim: use of get_bp() is recommended,
224 // even if the bp object can be accessed directly.
225 extern Breakpoints bp;
226 
get_bp()227 inline Breakpoints &get_bp()
228 {
229   return bp;
230 }
231 #endif
232 
233 
234 class Breakpoints {
235 public:
236   enum BREAKPOINT_TYPES {
237     BREAK_DUMP_ALL            = 0,
238     BREAK_CLEAR               = 0,
239     BREAK_ON_EXECUTION        = 1 << 24,
240     BREAK_ON_REG_READ         = 2 << 24,
241     BREAK_ON_REG_WRITE        = 3 << 24,
242     BREAK_ON_REG_READ_VALUE   = 4 << 24,
243     BREAK_ON_REG_WRITE_VALUE  = 5 << 24,
244     BREAK_ON_INVALID_FR       = 6 << 24,
245     BREAK_ON_CYCLE            = 7 << 24,
246     BREAK_ON_WDT_TIMEOUT      = 8 << 24,
247     BREAK_ON_STK_OVERFLOW     = 9 << 24,
248     BREAK_ON_STK_UNDERFLOW    = 10 << 24,
249     NOTIFY_ON_EXECUTION       = 11 << 24,
250     PROFILE_START_NOTIFY_ON_EXECUTION = 12 << 24,
251     PROFILE_STOP_NOTIFY_ON_EXECUTION = 13 << 24,
252     NOTIFY_ON_REG_READ        = 14 << 24,
253     NOTIFY_ON_REG_WRITE       = 15 << 24,
254     NOTIFY_ON_REG_READ_VALUE  = 16 << 24,
255     NOTIFY_ON_REG_WRITE_VALUE = 17 << 24,
256     BREAK_ON_ASSERTION        = 18 << 24,
257     BREAK_MASK                = 0xff << 24
258   };
259 
260 #define  GLOBAL_CLEAR         0
261 #define  GLOBAL_STOP_RUNNING  (1<<0)
262 #define  GLOBAL_INTERRUPT     (1<<1)
263 #define  GLOBAL_SLEEP         (1<<2)
264 #define  GLOBAL_PM_WRITE      (1<<3)
265 #define  GLOBAL_SOCKET        (1<<4)
266 #define  GLOBAL_LOG	      (1<<5)
267 
268   struct BreakStatus {
269     BREAKPOINT_TYPES type;
270     Processor *cpu;
271     unsigned int arg1;
272     unsigned int arg2;
273     TriggerObject *bpo;
274   } break_status[MAX_BREAKPOINTS];
275 
276   int m_iMaxAllocated = 0;
277 
278   class iterator {
279   public:
iterator(int index)280     explicit iterator(int index) : iIndex(index) {}
281     int iIndex;
282     iterator & operator++(int)
283     {
284       iIndex++;
285       return *this;
286     }
287     BreakStatus * operator*()
288     {
289       return &get_bp().break_status[iIndex];
290     }
291     bool operator!=(iterator &it)
292     {
293       return iIndex != it.iIndex;
294     }
295   };
296 
begin()297   iterator begin()
298   {
299     return iterator(0);
300   }
301 
end()302   iterator end()
303   {
304     return iterator(m_iMaxAllocated);
305   }
306 
get(int index)307   BreakStatus *get(int index)
308   {
309     return (index >= 0 && index < MAX_BREAKPOINTS) ? &break_status[index] : nullptr;
310   }
311   int  global_break = 0;
312   bool m_bExitOnBreak = false;   // enabled from command line option
EnableExitOnBreak(bool bExitOnBreak)313   void EnableExitOnBreak(bool bExitOnBreak)
314   {
315     m_bExitOnBreak = bExitOnBreak;
316   }
317 
318   int breakpoint_number = 0, last_breakpoint = 0;
319 
320 
321   Breakpoints();
322   int set_breakpoint(BREAKPOINT_TYPES, Processor *,
323                      unsigned int,
324                      unsigned int,
325                      TriggerObject *f = nullptr);
326 
327   int set_breakpoint(TriggerObject *, Processor *, Expression *pExpr = nullptr);
328 
329   int set_execution_break(Processor *cpu, unsigned int address, Expression *pExpr = nullptr);
330   int set_notify_break(Processor *cpu,
331                        unsigned int address,
332                        TriggerObject *cb);
333   int set_profile_start_break(Processor *cpu,
334                               unsigned int address,
335                               TriggerObject *f1 = nullptr);
336   int set_profile_stop_break(Processor *cpu,
337                              unsigned int address,
338                              TriggerObject *f1 = nullptr);
339   int set_read_break(Processor *cpu, unsigned int register_number);
340   int set_write_break(Processor *cpu, unsigned int register_number);
341   int set_read_value_break(Processor *cpu,
342                            unsigned int register_number,
343                            unsigned int value,
344                            unsigned int mask = 0xff);
345   int set_write_value_break(Processor *cpu,
346                             unsigned int register_number,
347                             unsigned int value,
348                             unsigned int mask = 0xff);
349   int set_read_value_break(Processor *cpu,
350                            unsigned int register_number,
351                            unsigned int op,
352                            unsigned int value,
353                            unsigned int mask = 0xff);
354   int set_write_value_break(Processor *cpu,
355                             unsigned int register_number,
356                             unsigned int op,
357                             unsigned int value,
358                             unsigned int mask = 0xff);
359   int set_change_break(Processor *cpu, unsigned int register_number);
360   int set_break(gpsimObject::ObjectBreakTypes bt,
361                 gpsimObject::ObjectActionTypes at,
362                 Register *,
363                 Expression *pExpr = nullptr);
364 
365   int set_cycle_break(Processor *cpu,
366                       guint64 cycle,
367                       TriggerObject *f = nullptr);
368   int set_wdt_break(Processor *cpu);
369   int set_stk_overflow_break(Processor *cpu);
370   int set_stk_underflow_break(Processor *cpu);
371   int check_cycle_break(unsigned int abp);
372 
373   int set_notify_read(Processor *cpu, unsigned int register_number);
374   int set_notify_write(Processor *cpu, unsigned int register_number);
375   int set_notify_read_value(Processor *cpu,
376                             unsigned int register_number,
377                             unsigned int value,
378                             unsigned int mask = 0xff);
379   int set_notify_write_value(Processor *cpu,
380                              unsigned int register_number,
381                              unsigned int value,
382                              unsigned int mask = 0xff);
383   bool set_expression(unsigned bp_number, Expression *pExpr);
384 
clear_global()385   inline void clear_global()
386   {
387     global_break = GLOBAL_CLEAR;
388   }
set_logging()389   inline void set_logging()
390   {
391     global_break |= GLOBAL_LOG;
392   }
393   void halt();
have_halt()394   inline bool have_halt()
395   {
396     return ((global_break & GLOBAL_STOP_RUNNING) != 0);
397   }
clear_halt()398   inline void clear_halt()
399   {
400     global_break &= ~GLOBAL_STOP_RUNNING;
401   }
have_interrupt()402   inline bool have_interrupt()
403   {
404     return ((global_break & GLOBAL_INTERRUPT) != 0);
405   }
clear_interrupt()406   inline void clear_interrupt()
407   {
408     global_break &= ~GLOBAL_INTERRUPT;
409   }
set_interrupt()410   inline void set_interrupt()
411   {
412     global_break |= GLOBAL_INTERRUPT;
413   }
have_sleep()414   inline bool have_sleep()
415   {
416     return ((global_break & GLOBAL_SLEEP) != 0);
417   }
clear_sleep()418   inline void clear_sleep()
419   {
420     global_break &= ~GLOBAL_SLEEP;
421   }
set_sleep()422   inline void set_sleep()
423   {
424     global_break |= GLOBAL_SLEEP;
425   }
have_pm_write()426   inline bool have_pm_write()
427   {
428     return ((global_break & GLOBAL_PM_WRITE) != 0);
429   }
clear_pm_write()430   inline void clear_pm_write()
431   {
432     global_break &= ~GLOBAL_PM_WRITE;
433   }
set_pm_write()434   inline void set_pm_write()
435   {
436     global_break |= GLOBAL_PM_WRITE;
437   }
have_socket_break()438   inline bool have_socket_break()
439   {
440     return ((global_break & GLOBAL_SOCKET) != 0);
441   }
set_socket_break()442   inline void set_socket_break()
443   {
444     global_break |= GLOBAL_SOCKET;
445   }
clear_socket_break()446   inline void clear_socket_break()
447   {
448     global_break &= ~GLOBAL_SOCKET;
449   }
450 
451   bool dump1(unsigned int bp_num, int dump_type = BREAK_DUMP_ALL);
452   bool dump(TriggerObject *);
453   void dump(int dump_type = BREAK_DUMP_ALL);
454   void dump_traced(unsigned int b);
455   void clear(unsigned int b);
456   bool bIsValid(unsigned int b);
457   bool bIsClear(unsigned int b);
458   void set_message(unsigned int b, std::string &);
459   void clear_all(Processor *c);
460   void clear_all_set_by_user(Processor *c);
461   void clear_all_register(Processor *c, gint64  address = -1);
462   void initialize_breakpoints(unsigned int memory_size);
463   instruction *find_previous(Processor *cpu,
464                              unsigned int address,
465                              instruction *_this);
466   int find_free();
467 };
468 
469 
470 //
471 // BreakPointRegister
472 //
473 //  This class serves as the base class for register break point and logging
474 // classes. Register breakpoints are handled by replacing a register object
475 // with one of the breakpoint objects. The simulated pic code has no idea that
476 // breakpoints exist on a register. However, when the member functions of the
477 // a register are accessed, the breakpoint member functions of the classes
478 // described below are the ones actually invoked. Consequently, control of
479 // the simulation can be manipulated.
480 //
481 
482 class BreakpointRegister : public Register, public TriggerObject {
483 public:
484   // FIXME: why 2 constructors?
485   BreakpointRegister(Processor *, TriggerAction *, Register *);
486   BreakpointRegister(Processor *, TriggerAction *, int, int);
487   virtual ~BreakpointRegister();
488 
isa()489   virtual REGISTER_TYPES isa()
490   {
491     return BP_REGISTER;
492   }
493   virtual std::string &name() const;
494   virtual void put_value(unsigned int new_value);
495   virtual void put(unsigned int new_value);
496   virtual void putRV(RegisterValue rv);
497   virtual unsigned int get_value();
498   virtual RegisterValue getRV();
499   virtual RegisterValue getRVN();
500   virtual unsigned int get();
501   virtual Register *getReg();
502   virtual void setbit(unsigned int bit_number, bool new_value);
503   virtual bool get_bit(unsigned int bit_number);
504   virtual double get_bit_voltage(unsigned int bit_number);
505   virtual bool hasBreak();
506   virtual void update();
507   virtual void add_xref(void *an_xref);
508   virtual void remove_xref(void *an_xref);
509   void replace(Processor *_cpu, unsigned int reg);
510   virtual bool set_break();
511   unsigned int clear(unsigned int bp_num);
512   virtual void print() override;
513   virtual int  printTraced(Trace *pTrace, unsigned int tbi,
514                            char *pBuf, int szBuf) override;
515   virtual void invokeAction();
516   virtual void clear();
517   virtual void takeAction();
518 };
519 
520 
521 class BreakpointRegister_Value : public BreakpointRegister {
522 public:
523   unsigned int break_value, break_mask;
524   unsigned int m_uDefRegMask;
525   std::string m_sOperator;
526 
527   BreakpointRegister_Value(Processor *_cpu,
528                            int _repl,
529                            int bp,
530                            unsigned int bv,
531                            unsigned int _operator,
532                            unsigned int bm);
533 
534   virtual ~BreakpointRegister_Value();
535 
536   typedef bool (*PFNISBREAKCONDITION)(unsigned int uRegValue,
537                                       unsigned int uRegMask, unsigned int uRegTestValue);
538   PFNISBREAKCONDITION m_pfnIsBreak;
539 
540   enum BRV_Ops {
541     eBRInvalid,
542     eBREquals,
543     eBRNotEquals,
544     eBRGreaterThen,
545     eBRLessThen,
546     eBRGreaterThenEquals,
547     eBRLessThenEquals,
548   };
549 
550   static bool IsEqualsBreakCondition(unsigned int uRegValue,
551                                      unsigned int uRegMask, unsigned int uRegTestValue);
552   static bool IsNotEqualsBreakCondition(unsigned int uRegValue,
553                                         unsigned int uRegMask, unsigned int uRegTestValue);
554   static bool IsGreaterThenBreakCondition(unsigned int uRegValue,
555                                           unsigned int uRegMask, unsigned int uRegTestValue);
556   static bool IsLessThenBreakCondition(unsigned int uRegValue,
557                                        unsigned int uRegMask, unsigned int uRegTestValue);
558   static bool IsGreaterThenEqualsBreakCondition(unsigned int uRegValue,
559       unsigned int uRegMask, unsigned int uRegTestValue);
560   static bool IsLessThenEqualsBreakCondition(unsigned int uRegValue,
561       unsigned int uRegMask, unsigned int uRegTestValue);
562 
563   virtual void print() override;
564   virtual int  printTraced(Trace *pTrace, unsigned int tbi,
565                            char *pBuf, int szBuf) override;
566 };
567 
568 
569 class Break_register_read : public BreakpointRegister {
570 public:
571   Break_register_read(Processor *_cpu, int _repl, int bp);
572   virtual ~Break_register_read();
573 
574   virtual unsigned int get();
575   virtual RegisterValue getRV();
576   virtual RegisterValue getRVN();
577   virtual bool get_bit(unsigned int bit_number);
578   virtual double get_bit_voltage(unsigned int bit_number);
bpName()579   virtual char const * bpName()
580   {
581     return "register read";
582   }
583 
584   virtual int  printTraced(Trace *pTrace, unsigned int tbi,
585                            char *pBuf, int szBuf) override;
586   virtual void takeAction();
587 };
588 
589 
590 class Break_register_write : public BreakpointRegister {
591 public:
592   Break_register_write(Processor *_cpu, int _repl, int bp);
593   virtual ~Break_register_write();
594 
595   virtual void put(unsigned int new_value);
596   virtual void putRV(RegisterValue rv);
597   virtual void setbit(unsigned int bit_number, bool new_value);
bpName()598   virtual char const * bpName()
599   {
600     return "register write";
601   }
602 
603   virtual int  printTraced(Trace *pTrace, unsigned int tbi,
604                            char *pBuf, int szBuf) override;
605   virtual void takeAction();
606 };
607 
608 
609 class Break_register_change : public BreakpointRegister {
610 public:
611   Break_register_change(Processor *_cpu, int _repl, int bp);
612   virtual ~Break_register_change();
613 
614   virtual void put(unsigned int new_value);
615   virtual void putRV(RegisterValue rv);
616   virtual void setbit(unsigned int bit_number, bool new_value);
bpName()617   virtual char const * bpName()
618   {
619     return "register change";
620   }
621 
622   virtual int  printTraced(Trace *pTrace, unsigned int tbi,
623                            char *pBuf, int szBuf) override;
624   virtual void takeAction();
625 };
626 
627 
628 class Break_register_read_value : public BreakpointRegister_Value {
629 public:
630   Break_register_read_value(Processor *_cpu,
631                             int _repl,
632                             int bp,
633                             unsigned int bv,
634                             unsigned int _operator,
635                             unsigned int bm);
636   virtual ~Break_register_read_value();
637 
638   virtual unsigned int get();
639   virtual RegisterValue getRV();
640   virtual RegisterValue getRVN();
641   virtual bool get_bit(unsigned int bit_number);
642   virtual double get_bit_voltage(unsigned int bit_number);
bpName()643   virtual char const * bpName()
644   {
645     return "register read value";
646   }
647 
648   virtual int  printTraced(Trace *pTrace, unsigned int tbi,
649                            char *pBuf, int szBuf) override;
650   virtual void takeAction();
651 };
652 
653 
654 class Break_register_write_value : public BreakpointRegister_Value {
655 public:
656   Break_register_write_value(Processor *_cpu,
657                              int _repl,
658                              int bp,
659                              unsigned int bv,
660                              unsigned int _operator,
661                              unsigned int bm);
662   virtual ~Break_register_write_value();
663 
664   virtual void put(unsigned int new_value);
665   virtual void putRV(RegisterValue rv);
666   virtual void setbit(unsigned int bit_number, bool new_value);
bpName()667   virtual char const * bpName()
668   {
669     return "register write value";
670   }
671 
672   virtual int  printTraced(Trace *pTrace, unsigned int tbi,
673                            char *pBuf, int szBuf) override;
674   virtual void takeAction();
675 };
676 
677 
678 class CommandAssertion : public Breakpoint_Instruction {
679 public:
680   bool bPostAssertion; // True if assertion is checked after instruction simulates.
681 
682   CommandAssertion(Processor *new_cpu,
683                    unsigned int instAddress,
684                    unsigned int bp,
685                    const char *_command,
686                    bool bPostAssertion
687                   );
688   virtual ~CommandAssertion();
689 
690   virtual void execute() override;
691   virtual void print() override;
692   virtual int  printTraced(Trace *pTrace, unsigned int tbi,
693                            char *pBuf, int szBuf) override;
bpName()694   virtual char const * bpName() override
695   {
696     return "Register Assertion";
697   }
698 private:
699   char *command;
700 };
701 
702 
703 // FIXME -- the log classes need to be deprecated - use the action class to perform logging instead.
704 class Log_Register_Write : public Break_register_write {
705 public:
Log_Register_Write(Processor * _cpu,int _repl,int bp)706   Log_Register_Write(Processor *_cpu, int _repl, int bp):
707     Break_register_write(_cpu, _repl, bp) {}
bpName()708   virtual char const * bpName()
709   {
710     return "log register write";
711   }
712   virtual void takeAction();
713   virtual void put(unsigned int new_value);
714   virtual void setbit(unsigned int bit_number, bool new_value);
715 };
716 
717 
718 class Log_Register_Read : public Break_register_read {
719 public:
Log_Register_Read(Processor * _cpu,int _repl,int bp)720   Log_Register_Read(Processor *_cpu, int _repl, int bp):
721     Break_register_read(_cpu, _repl, bp) {}
bpName()722   virtual char const * bpName()
723   {
724     return "log register read";
725   }
726   virtual void takeAction();
727   virtual unsigned int get();
728   virtual RegisterValue getRV();
729   virtual RegisterValue getRVN();
730   virtual bool get_bit(unsigned int bit_number);
731 };
732 
733 
734 class Log_Register_Read_value : public  Break_register_read_value {
735 public:
Log_Register_Read_value(Processor * _cpu,int _repl,int bp,unsigned int bv,unsigned int _operator,unsigned int bm)736   Log_Register_Read_value(Processor *_cpu,
737                           int _repl,
738                           int bp,
739                           unsigned int bv,
740                           unsigned int _operator,
741                           unsigned int bm) :
742     Break_register_read_value(_cpu,  _repl, bp, bv, _operator, bm) {}
743 
bpName()744   virtual char const * bpName()
745   {
746     return "log register read value";
747   }
748   virtual void takeAction();
749 };
750 
751 
752 class Log_Register_Write_value : public Break_register_write_value {
753 public:
Log_Register_Write_value(Processor * _cpu,int _repl,int bp,unsigned int bv,unsigned int _operator,unsigned int bm)754   Log_Register_Write_value(Processor *_cpu,
755                            int _repl,
756                            int bp,
757                            unsigned int bv,
758                            unsigned int _operator,
759                            unsigned int bm) :
760     Break_register_write_value(_cpu,  _repl, bp, bv, _operator, bm) {}
761   virtual void takeAction();
762 };
763 
764 
765 #ifdef HAVE_GUI
766 class GuiCallBack: public TriggerObject {
767 public:
768   virtual void callback() override;
769 
770   gpointer gui_callback_data;  // Data to be passed back to the gui
771 
772   // A pointer to the gui call back function
773   void (*gui_callback)(gpointer gui_callback_data);
774   void set_break(int, void (*)(gpointer), gpointer);
775 
776   GuiCallBack();
777 };
778 #endif // HAVE_GUI
779 
780 
781 #endif   //  SRC_BREAKPOINTS_H_
782