Logo Search packages:      
Sourcecode: bcov version File versions  Download package

Debugger.hpp

#ifndef H_Debugger
#define H_Debugger
//---------------------------------------------------------------------------
#include <map>
#include <vector>
#include <string>
//---------------------------------------------------------------------------
/// Interface for the debugger
00009 class Debugger
{
   public:
   /// Breakpoint information
00013    class BreakpointInfo {
      private:
      /// The original code
00016       unsigned char oldCode;

      friend class Debugger;

      public:
      /// Hit count
00022       unsigned hits;
   };
   /// Possible events
00025    enum Event { Error, Exit, Trap };

   private:
   /// The child
00029    long child;
   /// The currently active child (can be different when threaded)
00031    long activeChild;

   public:
   /// Constructor
   Debugger();
   /// Destructor
   ~Debugger();

   /// Load a program
   bool load(const std::string& executable,const std::vector<std::string>& arguments);
   /// Close the debugger
   bool close();

   /// Set breakpoints
   bool setBreakpoints(std::map<void*,BreakpointInfo>& addresses);
   /// Remove breakpoints
   bool removeBreakpoints(std::map<void*,BreakpointInfo>& addresses);
   /// Remove the breakpoint we just hit and adjust IP
   void eliminateHitBreakpoint(BreakpointInfo& i);
   /// Run the program
   Event run();
   /// Get the current IP
   void* getIP();
   /// Get the current IP if we executed a trap instruction
   void* getIPBeforeTrap();
};
//---------------------------------------------------------------------------
#endif

Generated by  Doxygen 1.6.0   Back to index