Merge pull request #1291 from skidau/debugger-step-out

Dolphin debugger enhancements
This commit is contained in:
skidau
2014-10-28 12:53:22 +11:00
35 changed files with 1050 additions and 70 deletions

View File

@ -113,6 +113,19 @@ void BreakPoints::Clear()
m_BreakPoints.clear();
}
void BreakPoints::ClearAllTemporary()
{
for (const TBreakPoint& bp : m_BreakPoints)
{
if (bp.bTemporary)
{
if (jit)
jit->GetBlockCache()->InvalidateICache(bp.iAddress, 4, true);
Remove(bp.iAddress);
}
}
}
MemChecks::TMemChecksStr MemChecks::GetStrings() const
{
TMemChecksStr mcs;
@ -204,3 +217,87 @@ void TMemCheck::Action(DebugInterface *debug_interface, u32 iValue, u32 addr, bo
debug_interface->BreakNow();
}
}
const bool Watches::IsAddressWatch(u32 _iAddress)
{
for (const TWatch& bp : m_Watches)
if (bp.iAddress == _iAddress)
return true;
return false;
}
Watches::TWatchesStr Watches::GetStrings() const
{
TWatchesStr bps;
for (const TWatch& bp : m_Watches)
{
std::stringstream ss;
ss << std::hex << bp.iAddress << " " << bp.name;
bps.push_back(ss.str());
}
return bps;
}
void Watches::AddFromStrings(const TWatchesStr& bpstrs)
{
for (const std::string& bpstr : bpstrs)
{
TWatch bp;
std::stringstream ss;
ss << std::hex << bpstr;
ss >> bp.iAddress;
ss >> std::ws;
getline(ss, bp.name);
Add(bp);
}
}
void Watches::Add(const TWatch& bp)
{
if (!IsAddressWatch(bp.iAddress))
{
m_Watches.push_back(bp);
}
}
void Watches::Add(u32 em_address)
{
if (!IsAddressWatch(em_address)) // only add new addresses
{
TWatch pt; // breakpoint settings
pt.bOn = true;
pt.iAddress = em_address;
m_Watches.push_back(pt);
}
}
void Watches::Update(int count, u32 em_address)
{
m_Watches.at(count).iAddress = em_address;
}
void Watches::UpdateName(int count, const std::string name)
{
m_Watches.at(count).name = name;
}
void Watches::Remove(u32 em_address)
{
for (auto i = m_Watches.begin(); i != m_Watches.end(); ++i)
{
if (i->iAddress == em_address)
{
m_Watches.erase(i);
return;
}
}
}
void Watches::Clear()
{
m_Watches.clear();
}

View File

@ -44,6 +44,13 @@ struct TMemCheck
bool write, int size, u32 pc);
};
struct TWatch
{
std::string name = "";
u32 iAddress;
bool bOn;
};
// Code breakpoints.
class BreakPoints
{
@ -67,6 +74,7 @@ public:
// Remove Breakpoint
void Remove(u32 _iAddress);
void Clear();
void ClearAllTemporary();
void DeleteByAddress(u32 _Address);
@ -98,3 +106,33 @@ public:
void Clear() { m_MemChecks.clear(); }
};
class Watches
{
public:
typedef std::vector<TWatch> TWatches;
typedef std::vector<std::string> TWatchesStr;
const TWatches& GetWatches() { return m_Watches; }
TWatchesStr GetStrings() const;
void AddFromStrings(const TWatchesStr& bps);
const bool IsAddressWatch(u32 _iAddress);
// Add BreakPoint
void Add(u32 em_address);
void Add(const TWatch& bp);
void Update(int count, u32 em_address);
void UpdateName(int count, const std::string name);
// Remove Breakpoint
void Remove(u32 _iAddress);
void Clear();
void DeleteByAddress(u32 _Address);
private:
TWatches m_Watches;
};

View File

@ -18,6 +18,7 @@ public:
virtual void ClearBreakpoint(unsigned int /*address*/){}
virtual void ClearAllBreakpoints() {}
virtual void ToggleBreakpoint(unsigned int /*address*/){}
virtual void AddWatch(unsigned int /*address*/){}
virtual void ClearAllMemChecks() {}
virtual bool IsMemCheck(unsigned int /*address*/) {return false;}
virtual void ToggleMemCheck(unsigned int /*address*/){}