diff --git a/src/apps/debugger/controllers/TeamDebugger.cpp b/src/apps/debugger/controllers/TeamDebugger.cpp index 133a3955b8..620eca5e6c 100644 --- a/src/apps/debugger/controllers/TeamDebugger.cpp +++ b/src/apps/debugger/controllers/TeamDebugger.cpp @@ -2122,6 +2122,7 @@ TeamDebugger::_LoadSettings() BReference breakpointReference(breakpoint, true); breakpoint->SetHidden(breakpointSetting->IsHidden()); + breakpoint->SetCondition(breakpointSetting->Condition()); // install it fBreakpointManager->InstallUserBreakpoint(breakpoint, diff --git a/src/apps/debugger/model/UserBreakpoint.cpp b/src/apps/debugger/model/UserBreakpoint.cpp index 996eb6e666..c2c288e2be 100644 --- a/src/apps/debugger/model/UserBreakpoint.cpp +++ b/src/apps/debugger/model/UserBreakpoint.cpp @@ -1,6 +1,6 @@ /* * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. - * Copyright 2013, Rene Gollent, rene@gollent.com. + * Copyright 2013-2014, Rene Gollent, rene@gollent.com. * Distributed under the terms of the MIT License. */ @@ -101,7 +101,8 @@ UserBreakpoint::UserBreakpoint(const UserBreakpointLocation& location) fLocation(location), fValid(false), fEnabled(false), - fHidden(false) + fHidden(false), + fConditionExpression() { } @@ -169,3 +170,10 @@ UserBreakpoint::SetHidden(bool hidden) { fHidden = hidden; } + + +void +UserBreakpoint::SetCondition(const BString& conditionExpression) +{ + fConditionExpression = conditionExpression; +} diff --git a/src/apps/debugger/model/UserBreakpoint.h b/src/apps/debugger/model/UserBreakpoint.h index cf4cfe3286..84969b6f8b 100644 --- a/src/apps/debugger/model/UserBreakpoint.h +++ b/src/apps/debugger/model/UserBreakpoint.h @@ -1,6 +1,6 @@ /* * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. - * Copyright 2013, Rene Gollent, rene@gollent.com. + * Copyright 2013-2014, Rene Gollent, rene@gollent.com. * Distributed under the terms of the MIT License. */ #ifndef USER_BREAKPOINT_H @@ -12,6 +12,7 @@ #include #include "SourceLocation.h" +#include "String.h" #include "Types.h" @@ -104,6 +105,13 @@ public: bool IsHidden() const { return fHidden; } void SetHidden(bool hidden); + bool HasCondition() const + { return !fConditionExpression.IsEmpty(); } + const BString& Condition() const + { return fConditionExpression; } + void SetCondition( + const BString& conditionExpression); + private: typedef BObjectList InstanceList; @@ -113,6 +121,7 @@ private: bool fValid; bool fEnabled; bool fHidden; + BString fConditionExpression; }; diff --git a/src/apps/debugger/settings/BreakpointSetting.cpp b/src/apps/debugger/settings/BreakpointSetting.cpp index 03ade77aa7..6ad3db18f5 100644 --- a/src/apps/debugger/settings/BreakpointSetting.cpp +++ b/src/apps/debugger/settings/BreakpointSetting.cpp @@ -1,6 +1,6 @@ /* * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. - * Copyright 2013, Rene Gollent, rene@gollent.com. + * Copyright 2013-2014, Rene Gollent, rene@gollent.com. * Distributed under the terms of the MIT License. */ @@ -22,7 +22,8 @@ BreakpointSetting::BreakpointSetting() fSourceLocation(), fRelativeAddress(0), fEnabled(false), - fHidden(false) + fHidden(false), + fConditionExpression() { } @@ -34,7 +35,8 @@ BreakpointSetting::BreakpointSetting(const BreakpointSetting& other) fSourceLocation(other.fSourceLocation), fRelativeAddress(other.fRelativeAddress), fEnabled(other.fEnabled), - fHidden(other.fHidden) + fHidden(other.fHidden), + fConditionExpression(other.fConditionExpression) { if (fFunctionID != NULL) fFunctionID->AcquireReference(); @@ -49,7 +51,7 @@ BreakpointSetting::~BreakpointSetting() status_t BreakpointSetting::SetTo(const UserBreakpointLocation& location, bool enabled, - bool hidden) + bool hidden, const BString& conditionExpression) { _Unset(); @@ -64,6 +66,7 @@ BreakpointSetting::SetTo(const UserBreakpointLocation& location, bool enabled, fRelativeAddress = location.RelativeAddress(); fEnabled = enabled; fHidden = hidden; + fConditionExpression = conditionExpression; return B_OK; } @@ -100,6 +103,9 @@ BreakpointSetting::SetTo(const BMessage& archive) if (archive.FindBool("hidden", &fHidden) != B_OK) fHidden = false; + if (archive.FindString("condition", &fConditionExpression) != B_OK) + fConditionExpression.Truncate(0); + return B_OK; } @@ -122,7 +128,9 @@ BreakpointSetting::WriteTo(BMessage& archive) const || (error = archive.AddUInt64("relativeAddress", fRelativeAddress)) != B_OK || (error = archive.AddBool("enabled", fEnabled)) != B_OK - || (error = archive.AddBool("hidden", fHidden)) != B_OK) { + || (error = archive.AddBool("hidden", fHidden)) != B_OK + || (error = archive.AddString("condition", fConditionExpression)) + != B_OK) { return error; } @@ -147,6 +155,7 @@ BreakpointSetting::operator=(const BreakpointSetting& other) fRelativeAddress = other.fRelativeAddress; fEnabled = other.fEnabled; fHidden = other.fHidden; + fConditionExpression = other.fConditionExpression; return *this; } @@ -164,4 +173,5 @@ BreakpointSetting::_Unset() fSourceLocation = SourceLocation(); fRelativeAddress = 0; fEnabled = false; + fConditionExpression.Truncate(0); } diff --git a/src/apps/debugger/settings/BreakpointSetting.h b/src/apps/debugger/settings/BreakpointSetting.h index 90d0a03449..9ea54d2ac2 100644 --- a/src/apps/debugger/settings/BreakpointSetting.h +++ b/src/apps/debugger/settings/BreakpointSetting.h @@ -1,6 +1,6 @@ /* * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. - * Copyright 2013, Rene Gollent, rene@gollent.com. + * Copyright 2013-2014, Rene Gollent, rene@gollent.com. * Distributed under the terms of the MIT License. */ #ifndef BREAKPOINT_SETTING_H @@ -28,7 +28,8 @@ public: ~BreakpointSetting(); status_t SetTo(const UserBreakpointLocation& location, - bool enabled, bool hidden); + bool enabled, bool hidden, + const BString& conditionExpression); status_t SetTo(const BMessage& archive); status_t WriteTo(BMessage& archive) const; @@ -42,6 +43,9 @@ public: bool IsEnabled() const { return fEnabled; } bool IsHidden() const { return fHidden; } + const BString& Condition() const + { return fConditionExpression; } + BreakpointSetting& operator=(const BreakpointSetting& other); private: @@ -54,6 +58,7 @@ private: target_addr_t fRelativeAddress; bool fEnabled; bool fHidden; + BString fConditionExpression; }; diff --git a/src/apps/debugger/settings/TeamSettings.cpp b/src/apps/debugger/settings/TeamSettings.cpp index 99c38a0be8..b77224fc07 100644 --- a/src/apps/debugger/settings/TeamSettings.cpp +++ b/src/apps/debugger/settings/TeamSettings.cpp @@ -64,7 +64,8 @@ TeamSettings::SetTo(Team* team) return B_NO_MEMORY; status_t error = breakpointSetting->SetTo(breakpoint->Location(), - breakpoint->IsEnabled(), breakpoint->IsHidden()); + breakpoint->IsEnabled(), breakpoint->IsHidden(), + breakpoint->Condition()); if (error == B_OK && !fBreakpoints.AddItem(breakpointSetting)) error = B_NO_MEMORY; if (error != B_OK) {