diff options
Diffstat (limited to 'src/common/break_points.cpp')
| -rw-r--r-- | src/common/break_points.cpp | 57 |
1 files changed, 23 insertions, 34 deletions
diff --git a/src/common/break_points.cpp b/src/common/break_points.cpp index e7d0d3e43..03a19acba 100644 --- a/src/common/break_points.cpp +++ b/src/common/break_points.cpp | |||
| @@ -2,33 +2,29 @@ | |||
| 2 | // Licensed under GPLv2 or any later version | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include <algorithm> | ||
| 6 | #include <sstream> | ||
| 5 | #include "common/break_points.h" | 7 | #include "common/break_points.h" |
| 6 | #include "common/logging/log.h" | 8 | #include "common/logging/log.h" |
| 7 | 9 | ||
| 8 | #include <sstream> | 10 | bool BreakPoints::IsAddressBreakPoint(u32 iAddress) const { |
| 9 | #include <algorithm> | ||
| 10 | |||
| 11 | bool BreakPoints::IsAddressBreakPoint(u32 iAddress) const | ||
| 12 | { | ||
| 13 | auto cond = [&iAddress](const TBreakPoint& bp) { return bp.iAddress == iAddress; }; | 11 | auto cond = [&iAddress](const TBreakPoint& bp) { return bp.iAddress == iAddress; }; |
| 14 | auto it = std::find_if(m_BreakPoints.begin(), m_BreakPoints.end(), cond); | 12 | auto it = std::find_if(m_BreakPoints.begin(), m_BreakPoints.end(), cond); |
| 15 | return it != m_BreakPoints.end(); | 13 | return it != m_BreakPoints.end(); |
| 16 | } | 14 | } |
| 17 | 15 | ||
| 18 | bool BreakPoints::IsTempBreakPoint(u32 iAddress) const | 16 | bool BreakPoints::IsTempBreakPoint(u32 iAddress) const { |
| 19 | { | 17 | auto cond = [&iAddress](const TBreakPoint& bp) { |
| 20 | auto cond = [&iAddress](const TBreakPoint& bp) { return bp.iAddress == iAddress && bp.bTemporary; }; | 18 | return bp.iAddress == iAddress && bp.bTemporary; |
| 21 | auto it = std::find_if(m_BreakPoints.begin(), m_BreakPoints.end(), cond); | 19 | }; |
| 20 | auto it = std::find_if(m_BreakPoints.begin(), m_BreakPoints.end(), cond); | ||
| 22 | return it != m_BreakPoints.end(); | 21 | return it != m_BreakPoints.end(); |
| 23 | } | 22 | } |
| 24 | 23 | ||
| 25 | BreakPoints::TBreakPointsStr BreakPoints::GetStrings() const | 24 | BreakPoints::TBreakPointsStr BreakPoints::GetStrings() const { |
| 26 | { | ||
| 27 | TBreakPointsStr bps; | 25 | TBreakPointsStr bps; |
| 28 | for (auto breakpoint : m_BreakPoints) | 26 | for (auto breakpoint : m_BreakPoints) { |
| 29 | { | 27 | if (!breakpoint.bTemporary) { |
| 30 | if (!breakpoint.bTemporary) | ||
| 31 | { | ||
| 32 | std::stringstream bp; | 28 | std::stringstream bp; |
| 33 | bp << std::hex << breakpoint.iAddress << " " << (breakpoint.bOn ? "n" : ""); | 29 | bp << std::hex << breakpoint.iAddress << " " << (breakpoint.bOn ? "n" : ""); |
| 34 | bps.push_back(bp.str()); | 30 | bps.push_back(bp.str()); |
| @@ -38,10 +34,8 @@ BreakPoints::TBreakPointsStr BreakPoints::GetStrings() const | |||
| 38 | return bps; | 34 | return bps; |
| 39 | } | 35 | } |
| 40 | 36 | ||
| 41 | void BreakPoints::AddFromStrings(const TBreakPointsStr& bps) | 37 | void BreakPoints::AddFromStrings(const TBreakPointsStr& bps) { |
| 42 | { | 38 | for (auto bps_item : bps) { |
| 43 | for (auto bps_item : bps) | ||
| 44 | { | ||
| 45 | TBreakPoint bp; | 39 | TBreakPoint bp; |
| 46 | std::stringstream bpstr; | 40 | std::stringstream bpstr; |
| 47 | bpstr << std::hex << bps_item; | 41 | bpstr << std::hex << bps_item; |
| @@ -52,18 +46,15 @@ void BreakPoints::AddFromStrings(const TBreakPointsStr& bps) | |||
| 52 | } | 46 | } |
| 53 | } | 47 | } |
| 54 | 48 | ||
| 55 | void BreakPoints::Add(const TBreakPoint& bp) | 49 | void BreakPoints::Add(const TBreakPoint& bp) { |
| 56 | { | 50 | if (!IsAddressBreakPoint(bp.iAddress)) { |
| 57 | if (!IsAddressBreakPoint(bp.iAddress)) | ||
| 58 | { | ||
| 59 | m_BreakPoints.push_back(bp); | 51 | m_BreakPoints.push_back(bp); |
| 60 | //if (jit) | 52 | // if (jit) |
| 61 | // jit->GetBlockCache()->InvalidateICache(bp.iAddress, 4); | 53 | // jit->GetBlockCache()->InvalidateICache(bp.iAddress, 4); |
| 62 | } | 54 | } |
| 63 | } | 55 | } |
| 64 | 56 | ||
| 65 | void BreakPoints::Add(u32 em_address, bool temp) | 57 | void BreakPoints::Add(u32 em_address, bool temp) { |
| 66 | { | ||
| 67 | if (!IsAddressBreakPoint(em_address)) // only add new addresses | 58 | if (!IsAddressBreakPoint(em_address)) // only add new addresses |
| 68 | { | 59 | { |
| 69 | TBreakPoint pt; // breakpoint settings | 60 | TBreakPoint pt; // breakpoint settings |
| @@ -73,22 +64,20 @@ void BreakPoints::Add(u32 em_address, bool temp) | |||
| 73 | 64 | ||
| 74 | m_BreakPoints.push_back(pt); | 65 | m_BreakPoints.push_back(pt); |
| 75 | 66 | ||
| 76 | //if (jit) | 67 | // if (jit) |
| 77 | // jit->GetBlockCache()->InvalidateICache(em_address, 4); | 68 | // jit->GetBlockCache()->InvalidateICache(em_address, 4); |
| 78 | } | 69 | } |
| 79 | } | 70 | } |
| 80 | 71 | ||
| 81 | void BreakPoints::Remove(u32 em_address) | 72 | void BreakPoints::Remove(u32 em_address) { |
| 82 | { | ||
| 83 | auto cond = [&em_address](const TBreakPoint& bp) { return bp.iAddress == em_address; }; | 73 | auto cond = [&em_address](const TBreakPoint& bp) { return bp.iAddress == em_address; }; |
| 84 | auto it = std::find_if(m_BreakPoints.begin(), m_BreakPoints.end(), cond); | 74 | auto it = std::find_if(m_BreakPoints.begin(), m_BreakPoints.end(), cond); |
| 85 | if (it != m_BreakPoints.end()) | 75 | if (it != m_BreakPoints.end()) |
| 86 | m_BreakPoints.erase(it); | 76 | m_BreakPoints.erase(it); |
| 87 | } | 77 | } |
| 88 | 78 | ||
| 89 | void BreakPoints::Clear() | 79 | void BreakPoints::Clear() { |
| 90 | { | 80 | // if (jit) |
| 91 | //if (jit) | ||
| 92 | //{ | 81 | //{ |
| 93 | // std::for_each(m_BreakPoints.begin(), m_BreakPoints.end(), | 82 | // std::for_each(m_BreakPoints.begin(), m_BreakPoints.end(), |
| 94 | // [](const TBreakPoint& bp) | 83 | // [](const TBreakPoint& bp) |