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.
This commit is contained in:
Rene Gollent
2013-06-15 14:51:17 -04:00
parent 41bf99064c
commit b9461dc8cd
5 changed files with 35 additions and 7 deletions
+10 -1
View File
@@ -1,5 +1,6 @@
/* /*
* Copyright 2009, Ingo Weinhold, [email protected]. * Copyright 2009, Ingo Weinhold, [email protected].
* Copyright 2013, Rene Gollent, [email protected].
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
@@ -99,7 +100,8 @@ UserBreakpoint::UserBreakpoint(const UserBreakpointLocation& location)
: :
fLocation(location), fLocation(location),
fValid(false), fValid(false),
fEnabled(false) fEnabled(false),
fHidden(false)
{ {
} }
@@ -160,3 +162,10 @@ UserBreakpoint::SetEnabled(bool enabled)
{ {
fEnabled = enabled; fEnabled = enabled;
} }
void
UserBreakpoint::SetHidden(bool hidden)
{
fHidden = hidden;
}
+5
View File
@@ -1,5 +1,6 @@
/* /*
* Copyright 2009, Ingo Weinhold, [email protected]. * Copyright 2009, Ingo Weinhold, [email protected].
* Copyright 2013, Rene Gollent, [email protected].
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
#ifndef USER_BREAKPOINT_H #ifndef USER_BREAKPOINT_H
@@ -100,6 +101,9 @@ public:
void SetEnabled(bool enabled); void SetEnabled(bool enabled);
// BreakpointManager only // BreakpointManager only
bool IsHidden() const { return fHidden; }
void SetHidden(bool hidden);
private: private:
typedef BObjectList<UserBreakpointInstance> InstanceList; typedef BObjectList<UserBreakpointInstance> InstanceList;
@@ -108,6 +112,7 @@ private:
InstanceList fInstances; InstanceList fInstances;
bool fValid; bool fValid;
bool fEnabled; bool fEnabled;
bool fHidden;
}; };
@@ -1,5 +1,6 @@
/* /*
* Copyright 2009, Ingo Weinhold, [email protected]. * Copyright 2009, Ingo Weinhold, [email protected].
* Copyright 2013, Rene Gollent, [email protected].
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
@@ -20,7 +21,8 @@ BreakpointSetting::BreakpointSetting()
fSourceFile(), fSourceFile(),
fSourceLocation(), fSourceLocation(),
fRelativeAddress(0), fRelativeAddress(0),
fEnabled(false) fEnabled(false),
fHidden(false)
{ {
} }
@@ -31,7 +33,8 @@ BreakpointSetting::BreakpointSetting(const BreakpointSetting& other)
fSourceFile(other.fSourceFile), fSourceFile(other.fSourceFile),
fSourceLocation(other.fSourceLocation), fSourceLocation(other.fSourceLocation),
fRelativeAddress(other.fRelativeAddress), fRelativeAddress(other.fRelativeAddress),
fEnabled(other.fEnabled) fEnabled(other.fEnabled),
fHidden(other.fHidden)
{ {
if (fFunctionID != NULL) if (fFunctionID != NULL)
fFunctionID->AcquireReference(); fFunctionID->AcquireReference();
@@ -45,7 +48,8 @@ BreakpointSetting::~BreakpointSetting()
status_t status_t
BreakpointSetting::SetTo(const UserBreakpointLocation& location, bool enabled) BreakpointSetting::SetTo(const UserBreakpointLocation& location, bool enabled,
bool hidden)
{ {
_Unset(); _Unset();
@@ -59,6 +63,7 @@ BreakpointSetting::SetTo(const UserBreakpointLocation& location, bool enabled)
fSourceLocation = location.GetSourceLocation(); fSourceLocation = location.GetSourceLocation();
fRelativeAddress = location.RelativeAddress(); fRelativeAddress = location.RelativeAddress();
fEnabled = enabled; fEnabled = enabled;
fHidden = hidden;
return B_OK; return B_OK;
} }
@@ -92,6 +97,9 @@ BreakpointSetting::SetTo(const BMessage& archive)
if (archive.FindBool("enabled", &fEnabled) != B_OK) if (archive.FindBool("enabled", &fEnabled) != B_OK)
fEnabled = false; fEnabled = false;
if (archive.FindBool("hidden", &fHidden) != B_OK)
fHidden = false;
return B_OK; return B_OK;
} }
@@ -113,7 +121,8 @@ BreakpointSetting::WriteTo(BMessage& archive) const
!= B_OK != B_OK
|| (error = archive.AddUInt64("relativeAddress", fRelativeAddress)) || (error = archive.AddUInt64("relativeAddress", fRelativeAddress))
!= B_OK != 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; return error;
} }
@@ -137,6 +146,7 @@ BreakpointSetting::operator=(const BreakpointSetting& other)
fSourceLocation = other.fSourceLocation; fSourceLocation = other.fSourceLocation;
fRelativeAddress = other.fRelativeAddress; fRelativeAddress = other.fRelativeAddress;
fEnabled = other.fEnabled; fEnabled = other.fEnabled;
fHidden = other.fHidden;
return *this; return *this;
} }
@@ -1,5 +1,6 @@
/* /*
* Copyright 2009, Ingo Weinhold, [email protected]. * Copyright 2009, Ingo Weinhold, [email protected].
* Copyright 2013, Rene Gollent, [email protected].
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
#ifndef BREAKPOINT_SETTING_H #ifndef BREAKPOINT_SETTING_H
@@ -27,7 +28,7 @@ public:
~BreakpointSetting(); ~BreakpointSetting();
status_t SetTo(const UserBreakpointLocation& location, status_t SetTo(const UserBreakpointLocation& location,
bool enabled); bool enabled, bool hidden);
status_t SetTo(const BMessage& archive); status_t SetTo(const BMessage& archive);
status_t WriteTo(BMessage& archive) const; status_t WriteTo(BMessage& archive) const;
@@ -39,6 +40,7 @@ public:
{ return fRelativeAddress; } { return fRelativeAddress; }
bool IsEnabled() const { return fEnabled; } bool IsEnabled() const { return fEnabled; }
bool IsHidden() const { return fHidden; }
BreakpointSetting& operator=(const BreakpointSetting& other); BreakpointSetting& operator=(const BreakpointSetting& other);
@@ -51,6 +53,7 @@ private:
SourceLocation fSourceLocation; SourceLocation fSourceLocation;
target_addr_t fRelativeAddress; target_addr_t fRelativeAddress;
bool fEnabled; bool fEnabled;
bool fHidden;
}; };
+2 -1
View File
@@ -1,5 +1,6 @@
/* /*
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
* Copyright 2013, Rene Gollent, rene@gollent.com.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
@@ -61,7 +62,7 @@ TeamSettings::SetTo(Team* team)
return B_NO_MEMORY; return B_NO_MEMORY;
status_t error = breakpointSetting->SetTo(breakpoint->Location(), status_t error = breakpointSetting->SetTo(breakpoint->Location(),
breakpoint->IsEnabled()); breakpoint->IsEnabled(), breakpoint->IsHidden());
if (error == B_OK && !fBreakpoints.AddItem(breakpointSetting)) if (error == B_OK && !fBreakpoints.AddItem(breakpointSetting))
error = B_NO_MEMORY; error = B_NO_MEMORY;
if (error != B_OK) { if (error != B_OK) {