From b9461dc8cdbc0402a29cade82863cc5fcf84a816 Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Sat, 15 Jun 2013 14:45:16 -0400 Subject: [PATCH] Add hidden attribute to UserBreakpoint. Marks a breakpoint as one that should not be exposed in the UI's normal breakpoint management interface. Adjust settings management to preserve/restore appropriately. --- src/apps/debugger/model/UserBreakpoint.cpp | 11 ++++++++++- src/apps/debugger/model/UserBreakpoint.h | 5 +++++ .../debugger/settings/BreakpointSetting.cpp | 18 ++++++++++++++---- src/apps/debugger/settings/BreakpointSetting.h | 5 ++++- src/apps/debugger/settings/TeamSettings.cpp | 3 ++- 5 files changed, 35 insertions(+), 7 deletions(-) diff --git a/src/apps/debugger/model/UserBreakpoint.cpp b/src/apps/debugger/model/UserBreakpoint.cpp index 0fa577931b..996eb6e666 100644 --- a/src/apps/debugger/model/UserBreakpoint.cpp +++ b/src/apps/debugger/model/UserBreakpoint.cpp @@ -1,5 +1,6 @@ /* * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. + * Copyright 2013, Rene Gollent, rene@gollent.com. * Distributed under the terms of the MIT License. */ @@ -99,7 +100,8 @@ UserBreakpoint::UserBreakpoint(const UserBreakpointLocation& location) : fLocation(location), fValid(false), - fEnabled(false) + fEnabled(false), + fHidden(false) { } @@ -160,3 +162,10 @@ UserBreakpoint::SetEnabled(bool enabled) { fEnabled = enabled; } + + +void +UserBreakpoint::SetHidden(bool hidden) +{ + fHidden = hidden; +} diff --git a/src/apps/debugger/model/UserBreakpoint.h b/src/apps/debugger/model/UserBreakpoint.h index 43f23fcc03..cf4cfe3286 100644 --- a/src/apps/debugger/model/UserBreakpoint.h +++ b/src/apps/debugger/model/UserBreakpoint.h @@ -1,5 +1,6 @@ /* * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. + * Copyright 2013, Rene Gollent, rene@gollent.com. * Distributed under the terms of the MIT License. */ #ifndef USER_BREAKPOINT_H @@ -100,6 +101,9 @@ public: void SetEnabled(bool enabled); // BreakpointManager only + bool IsHidden() const { return fHidden; } + void SetHidden(bool hidden); + private: typedef BObjectList InstanceList; @@ -108,6 +112,7 @@ private: InstanceList fInstances; bool fValid; bool fEnabled; + bool fHidden; }; diff --git a/src/apps/debugger/settings/BreakpointSetting.cpp b/src/apps/debugger/settings/BreakpointSetting.cpp index ca960f34d3..03ade77aa7 100644 --- a/src/apps/debugger/settings/BreakpointSetting.cpp +++ b/src/apps/debugger/settings/BreakpointSetting.cpp @@ -1,5 +1,6 @@ /* * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. + * Copyright 2013, Rene Gollent, rene@gollent.com. * Distributed under the terms of the MIT License. */ @@ -20,7 +21,8 @@ BreakpointSetting::BreakpointSetting() fSourceFile(), fSourceLocation(), fRelativeAddress(0), - fEnabled(false) + fEnabled(false), + fHidden(false) { } @@ -31,7 +33,8 @@ BreakpointSetting::BreakpointSetting(const BreakpointSetting& other) fSourceFile(other.fSourceFile), fSourceLocation(other.fSourceLocation), fRelativeAddress(other.fRelativeAddress), - fEnabled(other.fEnabled) + fEnabled(other.fEnabled), + fHidden(other.fHidden) { if (fFunctionID != NULL) fFunctionID->AcquireReference(); @@ -45,7 +48,8 @@ BreakpointSetting::~BreakpointSetting() status_t -BreakpointSetting::SetTo(const UserBreakpointLocation& location, bool enabled) +BreakpointSetting::SetTo(const UserBreakpointLocation& location, bool enabled, + bool hidden) { _Unset(); @@ -59,6 +63,7 @@ BreakpointSetting::SetTo(const UserBreakpointLocation& location, bool enabled) fSourceLocation = location.GetSourceLocation(); fRelativeAddress = location.RelativeAddress(); fEnabled = enabled; + fHidden = hidden; return B_OK; } @@ -92,6 +97,9 @@ BreakpointSetting::SetTo(const BMessage& archive) if (archive.FindBool("enabled", &fEnabled) != B_OK) fEnabled = false; + if (archive.FindBool("hidden", &fHidden) != B_OK) + fHidden = false; + return B_OK; } @@ -113,7 +121,8 @@ BreakpointSetting::WriteTo(BMessage& archive) const != B_OK || (error = archive.AddUInt64("relativeAddress", fRelativeAddress)) != B_OK - || (error = archive.AddBool("enabled", fEnabled)) != B_OK) { + || (error = archive.AddBool("enabled", fEnabled)) != B_OK + || (error = archive.AddBool("hidden", fHidden)) != B_OK) { return error; } @@ -137,6 +146,7 @@ BreakpointSetting::operator=(const BreakpointSetting& other) fSourceLocation = other.fSourceLocation; fRelativeAddress = other.fRelativeAddress; fEnabled = other.fEnabled; + fHidden = other.fHidden; return *this; } diff --git a/src/apps/debugger/settings/BreakpointSetting.h b/src/apps/debugger/settings/BreakpointSetting.h index 964a0e552f..90d0a03449 100644 --- a/src/apps/debugger/settings/BreakpointSetting.h +++ b/src/apps/debugger/settings/BreakpointSetting.h @@ -1,5 +1,6 @@ /* * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. + * Copyright 2013, Rene Gollent, rene@gollent.com. * Distributed under the terms of the MIT License. */ #ifndef BREAKPOINT_SETTING_H @@ -27,7 +28,7 @@ public: ~BreakpointSetting(); status_t SetTo(const UserBreakpointLocation& location, - bool enabled); + bool enabled, bool hidden); status_t SetTo(const BMessage& archive); status_t WriteTo(BMessage& archive) const; @@ -39,6 +40,7 @@ public: { return fRelativeAddress; } bool IsEnabled() const { return fEnabled; } + bool IsHidden() const { return fHidden; } BreakpointSetting& operator=(const BreakpointSetting& other); @@ -51,6 +53,7 @@ private: SourceLocation fSourceLocation; target_addr_t fRelativeAddress; bool fEnabled; + bool fHidden; }; diff --git a/src/apps/debugger/settings/TeamSettings.cpp b/src/apps/debugger/settings/TeamSettings.cpp index 605202dcf8..cf3154151c 100644 --- a/src/apps/debugger/settings/TeamSettings.cpp +++ b/src/apps/debugger/settings/TeamSettings.cpp @@ -1,5 +1,6 @@ /* * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. + * Copyright 2013, Rene Gollent, rene@gollent.com. * Distributed under the terms of the MIT License. */ @@ -61,7 +62,7 @@ TeamSettings::SetTo(Team* team) return B_NO_MEMORY; status_t error = breakpointSetting->SetTo(breakpoint->Location(), - breakpoint->IsEnabled()); + breakpoint->IsEnabled(), breakpoint->IsHidden()); if (error == B_OK && !fBreakpoints.AddItem(breakpointSetting)) error = B_NO_MEMORY; if (error != B_OK) {