various small fixes

This commit is contained in:
mrexodia 2016-01-05 04:33:22 +01:00
parent 94809cb4e9
commit 7d45916c96
8 changed files with 30 additions and 24 deletions

View File

@ -37,7 +37,7 @@ namespace GleeBug
BYTE DR7_SIZE[HWBP_COUNT];
};
static inline ptr dr7_ptr(const DR7 & dr7)
static ptr dr7_ptr(const DR7 & dr7)
{
ptr result = 0;
if (BITGET(dr7.DR7_MODE[0], 0))
@ -91,7 +91,7 @@ namespace GleeBug
return result;
}
static inline DR7 ptr_dr7(ptr dr7)
static DR7 ptr_dr7(ptr dr7)
{
DR7 result;
memset(&result, 0, sizeof(DR7));
@ -146,7 +146,7 @@ namespace GleeBug
return result;
}
static inline DR7_SIZE size_dr7(HardwareSize size)
static DR7_SIZE size_dr7(HardwareSize size)
{
switch (size)
{
@ -165,7 +165,7 @@ namespace GleeBug
}
}
static inline DR7_TYPE type_dr7(HardwareType type)
static DR7_TYPE type_dr7(HardwareType type)
{
switch (type)
{

View File

@ -47,7 +47,7 @@ namespace GleeBug
\param b Second range.
\return True if a comes before b, false otherwise.
*/
inline bool operator()(const Range & a, const Range & b) const //a before b?
bool operator()(const Range & a, const Range & b) const //a before b?
{
return a.second < b.first;
}

View File

@ -9,6 +9,11 @@ namespace GleeBug
{
}
BufferFile::~BufferFile()
{
BufferFile::Close();
}
bool BufferFile::Open()
{
return true;

View File

@ -9,34 +9,35 @@ namespace GleeBug
{
public:
BufferFile(void* data, uint32 size);
~BufferFile();
/**
\brief Opens an existing file.
\return true if the file was opened successfully, false otherwise.
*/
virtual bool Open() override;
bool Open() override;
/**
\brief Creates a new file.
\param overwrite (Optional) true to overwrite, false to preserve fail if the file already exists.
\return true if the file was created, false otherwise.
*/
virtual bool Create(bool overwrite = true) override;
bool Create(bool overwrite = true) override;
/**
\brief Check if there is an open/created file.
*/
virtual bool IsOpen() const override;
bool IsOpen() const override;
/**
\brief Closes the file.
*/
virtual void Close() override;
void Close() override;
/**
\brief Gets the size of the file.
*/
virtual uint32 GetSize() const override;
uint32 GetSize() const override;
/**
\brief Reads from the open file.
@ -46,7 +47,7 @@ namespace GleeBug
\param [out] bytesRead (Optional) If set, returns the number of bytes read (even on failure).
\return true if the read was fully successful, false otherwise.
*/
virtual bool Read(uint32 offset, void* data, uint32 size, uint32* bytesRead = nullptr) const override;
bool Read(uint32 offset, void* data, uint32 size, uint32* bytesRead = nullptr) const override;
/**
\brief Writes to the open file.
@ -56,7 +57,7 @@ namespace GleeBug
\param [out] bytesWritten (Optional) If set, returns the number of bytes written (even on failure)
\return true if the write was fully successful, false otherwise.
*/
virtual bool Write(uint32 offset, const void* data, uint32 size, uint32* bytesWritten = nullptr) override;
bool Write(uint32 offset, const void* data, uint32 size, uint32* bytesWritten = nullptr) override;
private:
void* mData;

View File

@ -11,7 +11,7 @@ namespace GleeBug
File::~File()
{
Close();
File::Close();
}
bool File::Open()

View File

@ -16,11 +16,11 @@ protected:
printf("Entry breakpoint deleted!\n");
else
printf("Failed to delete entry breakpoint...\n");
mThread->StepInto(std::bind([this]()
mThread->StepInto([this]()
{
printf("Step after entry breakpoint! GIP: 0x%p\n",
mRegisters->Gip());
}));
});
}
void cbEntryHardwareBreakpoint(const BreakpointInfo & info)
@ -31,11 +31,11 @@ protected:
printf("Entry hardware breakpoint deleted!\n");
else
printf("Failed to delete entry hardware breakpoint...\n");
mThread->StepInto(std::bind([this]()
mThread->StepInto([this]()
{
printf("Step after entry hardware breakpoint! GIP: 0x%p\n",
mRegisters->Gip());
}));
});
}
void cbStepSystem()

View File

@ -4,4 +4,4 @@
GleeBug is a **Debugging Framework for Windows** aimed at making debugging enjoyable. It should be complete and easy to use. Feel free to clone and send a pull request or report a bug!
Notice that the project is currently very volatile so for this reason pull requests with new features might be rejected if I feel like they don't fit the future codebase.
Notice that the project is currently very volatile so for this reason pull requests with new features might be rejected if I feel like they don't fit the current codebase. If you plan on adding major features, please consider consulting me (mrexodia) so there isn't any time wasted.

View File

@ -425,7 +425,7 @@ public:
bool DeleteHardwareBreakPoint(DWORD IndexOfRegister)
{
if (!mProcess || IndexOfRegister < 0 || IndexOfRegister > 3)
if (!mProcess || IndexOfRegister > 3)
return false;
auto address = mProcess->hardwareBreakpoints[IndexOfRegister].address;
return mProcess->DeleteHardwareBreakpoint(address);
@ -524,7 +524,7 @@ protected:
}
private: //functions
static inline Registers::R registerFromDword(DWORD IndexOfRegister)
static Registers::R registerFromDword(DWORD IndexOfRegister)
{
switch (IndexOfRegister)
{
@ -571,19 +571,19 @@ private: //functions
}
}
inline ThreadInfo* threadFromHandle(HANDLE hThread) const
ThreadInfo* threadFromHandle(HANDLE hThread) const
{
//TODO: properly implement this
return mThread;
}
inline ProcessInfo* processFromHandle(HANDLE hProcess) const
ProcessInfo* processFromHandle(HANDLE hProcess) const
{
//TODO: properly implement this
return mProcess;
}
static inline HardwareType hwtypeFromTitan(DWORD type)
static HardwareType hwtypeFromTitan(DWORD type)
{
switch (type)
{
@ -598,7 +598,7 @@ private: //functions
}
}
static inline HardwareSize hwsizeFromTitan(DWORD size)
static HardwareSize hwsizeFromTitan(DWORD size)
{
switch (size)
{