Revert preservation of watchpoints in settings.

This commit is contained in:
Rene Gollent 2012-11-07 15:26:18 +01:00
parent 12c53499e7
commit 0ba9bff27d
6 changed files with 1 additions and 246 deletions

View File

@ -150,7 +150,6 @@ Application Debugger :
TeamSettings.cpp
TeamUiSettings.cpp
TeamUiSettingsFactory.cpp
WatchpointSetting.cpp
# settings/generic
Setting.cpp

View File

@ -46,7 +46,7 @@
#include "ValueNodeContainer.h"
#include "Variable.h"
#include "WatchpointManager.h"
#include "WatchpointSetting.h"
// #pragma mark - ImageHandler
@ -1583,21 +1583,6 @@ TeamDebugger::_LoadSettings()
breakpointSetting->IsEnabled());
}
// create the saved watchpoints;
for (int32 i = 0; const WatchpointSetting* watchpointSetting
= fTeamSettings.WatchpointAt(i); i++) {
Watchpoint* watchpoint = new(std::nothrow) Watchpoint(
watchpointSetting->Address(), watchpointSetting->Type(),
watchpointSetting->Length());
if (watchpoint == NULL)
return;
BReference<Watchpoint> watchpointReference(watchpoint, true);
// install it
fWatchpointManager->InstallWatchpoint(watchpoint,
watchpointSetting->IsEnabled());
}
const TeamUiSettings* uiSettings = fTeamSettings.UiSettingFor(
fUserInterface->ID());
if (uiSettings != NULL)

View File

@ -18,7 +18,6 @@
#include "TeamUiSettings.h"
#include "TeamUiSettingsFactory.h"
#include "UserBreakpoint.h"
#include "WatchpointSetting.h"
TeamSettings::TeamSettings()
@ -71,23 +70,6 @@ TeamSettings::SetTo(Team* team)
}
}
// add watchpoints
for (int32 i = 0; Watchpoint* watchpoint = team->WatchpointAt(i); i++) {
WatchpointSetting* watchpointSetting
= new(std::nothrow) WatchpointSetting;
if (watchpointSetting == NULL)
return B_NO_MEMORY;
status_t error = watchpointSetting->SetTo(*watchpoint,
watchpoint->IsEnabled());
if (error == B_OK && !fWatchpoints.AddItem(watchpointSetting))
error = B_NO_MEMORY;
if (error != B_OK) {
delete watchpointSetting;
return error;
}
}
return B_OK;
}
@ -119,24 +101,6 @@ TeamSettings::SetTo(const BMessage& archive)
}
}
// add watchpoints
for (int32 i = 0; archive.FindMessage("watchpoints", i, &childArchive)
== B_OK; i++) {
WatchpointSetting* watchpointSetting
= new(std::nothrow) WatchpointSetting;
if (watchpointSetting == NULL)
return B_NO_MEMORY;
error = watchpointSetting->SetTo(childArchive);
if (error == B_OK && !fWatchpoints.AddItem(watchpointSetting))
error = B_NO_MEMORY;
if (error != B_OK) {
delete watchpointSetting;
return error;
}
}
// add UI settings
for (int32 i = 0; archive.FindMessage("uisettings", i, &childArchive)
== B_OK; i++) {
@ -173,17 +137,6 @@ TeamSettings::WriteTo(BMessage& archive) const
return error;
}
for (int32 i = 0; WatchpointSetting* watchpoint = fWatchpoints.ItemAt(i);
i++) {
error = watchpoint->WriteTo(childArchive);
if (error != B_OK)
return error;
error = archive.AddMessage("watchpoints", &childArchive);
if (error != B_OK)
return error;
}
for (int32 i = 0; TeamUiSettings* uiSetting = fUiSettings.ItemAt(i);
i++) {
error = uiSetting->WriteTo(childArchive);
@ -213,20 +166,6 @@ TeamSettings::BreakpointAt(int32 index) const
}
int32
TeamSettings::CountWatchpoints() const
{
return fWatchpoints.CountItems();
}
const WatchpointSetting*
TeamSettings::WatchpointAt(int32 index) const
{
return fWatchpoints.ItemAt(index);
}
int32
TeamSettings::CountUiSettings() const
{
@ -284,16 +223,6 @@ TeamSettings::operator=(const TeamSettings& other)
}
}
for (int32 i = 0; WatchpointSetting* watchpoint
= other.fWatchpoints.ItemAt(i); i++) {
WatchpointSetting* clonedWatchpoint
= new WatchpointSetting(*watchpoint);
if (!fWatchpoints.AddItem(clonedWatchpoint)) {
delete clonedWatchpoint;
throw std::bad_alloc();
}
}
for (int32 i = 0; TeamUiSettings* uiSetting
= other.fUiSettings.ItemAt(i); i++) {
TeamUiSettings* clonedSetting
@ -316,16 +245,10 @@ TeamSettings::_Unset()
delete breakpoint;
}
for (int32 i = 0; WatchpointSetting* watchpoint = fWatchpoints.ItemAt(i);
i++) {
delete watchpoint;
}
for (int32 i = 0; TeamUiSettings* uiSetting = fUiSettings.ItemAt(i); i++)
delete uiSetting;
fBreakpoints.MakeEmpty();
fWatchpoints.MakeEmpty();
fUiSettings.MakeEmpty();
fTeamName.Truncate(0);

View File

@ -15,7 +15,6 @@ class BMessage;
class Team;
class BreakpointSetting;
class TeamUiSettings;
class WatchpointSetting;
class TeamSettings {
@ -34,9 +33,6 @@ public:
int32 CountBreakpoints() const;
const BreakpointSetting* BreakpointAt(int32 index) const;
int32 CountWatchpoints() const;
const WatchpointSetting* WatchpointAt(int32 index) const;
int32 CountUiSettings() const;
const TeamUiSettings* UiSettingAt(int32 index) const;
const TeamUiSettings* UiSettingFor(const char* id) const;
@ -48,14 +44,12 @@ public:
private:
typedef BObjectList<BreakpointSetting> BreakpointList;
typedef BObjectList<TeamUiSettings> UiSettingsList;
typedef BObjectList<WatchpointSetting> WatchpointList;
private:
void _Unset();
private:
BreakpointList fBreakpoints;
WatchpointList fWatchpoints;
UiSettingsList fUiSettings;
BString fTeamName;
};

View File

@ -1,100 +0,0 @@
/*
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
* Copyright 2012, Rene Gollent, rene@gollent.com.
* Distributed under the terms of the MIT License.
*/
#include "WatchpointSetting.h"
#include <Message.h>
#include "Watchpoint.h"
WatchpointSetting::WatchpointSetting()
:
fAddress(0),
fType(0),
fLength(0),
fEnabled(false)
{
}
WatchpointSetting::WatchpointSetting(const WatchpointSetting& other)
:
fAddress(other.fAddress),
fType(other.fType),
fLength(other.fLength),
fEnabled(other.fEnabled)
{
}
WatchpointSetting::~WatchpointSetting()
{
}
status_t
WatchpointSetting::SetTo(const Watchpoint& watchpoint, bool enabled)
{
fAddress = watchpoint.Address();
fType = watchpoint.Type();
fLength = watchpoint.Length();
fEnabled = enabled;
return B_OK;
}
status_t
WatchpointSetting::SetTo(const BMessage& archive)
{
if (archive.FindUInt64("address", &fAddress) != B_OK)
fAddress = 0;
if (archive.FindUInt32("type", &fType) != B_OK)
fType = 0;
if (archive.FindInt32("length", &fLength) != B_OK)
fLength = 0;
if (archive.FindBool("enabled", &fEnabled) != B_OK)
fEnabled = false;
return B_OK;
}
status_t
WatchpointSetting::WriteTo(BMessage& archive) const
{
archive.MakeEmpty();
status_t error;
if ((error = archive.AddUInt64("address", fAddress)) != B_OK
|| (error = archive.AddUInt32("type", fType)) != B_OK
|| (error = archive.AddInt32("length", fLength)) != B_OK
|| (error = archive.AddBool("enabled", fEnabled)) != B_OK) {
return error;
}
return B_OK;
}
WatchpointSetting&
WatchpointSetting::operator=(const WatchpointSetting& other)
{
if (this == &other)
return *this;
fAddress = other.fAddress;
fType = other.fType;
fLength = other.fLength;
fEnabled = other.fEnabled;
return *this;
}

View File

@ -1,46 +0,0 @@
/*
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
* Copyright 2012, Rene Gollent, rene@gollent.com.
* Distributed under the terms of the MIT License.
*/
#ifndef WATCHPOINT_SETTING_H
#define WATCHPOINT_SETTING_H
#include <String.h>
#include "types/Types.h"
class BMessage;
class Watchpoint;
class WatchpointSetting {
public:
WatchpointSetting();
WatchpointSetting(
const WatchpointSetting& other);
~WatchpointSetting();
status_t SetTo(const Watchpoint& watchpoint,
bool enabled);
status_t SetTo(const BMessage& archive);
status_t WriteTo(BMessage& archive) const;
target_addr_t Address() const { return fAddress; }
uint32 Type() const { return fType; }
int32 Length() const { return fLength; }
bool IsEnabled() const { return fEnabled; }
WatchpointSetting& operator=(const WatchpointSetting& other);
private:
target_addr_t fAddress;
uint32 fType;
int32 fLength;
bool fEnabled;
};
#endif // BREAKPOINT_SETTING_H