From 0ba9bff27d88633aa0f9a6477342aa79fccbf4f7 Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Wed, 7 Nov 2012 15:26:18 +0100 Subject: [PATCH] Revert preservation of watchpoints in settings. --- src/apps/debugger/Jamfile | 1 - src/apps/debugger/TeamDebugger.cpp | 17 +-- src/apps/debugger/settings/TeamSettings.cpp | 77 -------------- src/apps/debugger/settings/TeamSettings.h | 6 -- .../debugger/settings/WatchpointSetting.cpp | 100 ------------------ .../debugger/settings/WatchpointSetting.h | 46 -------- 6 files changed, 1 insertion(+), 246 deletions(-) delete mode 100644 src/apps/debugger/settings/WatchpointSetting.cpp delete mode 100644 src/apps/debugger/settings/WatchpointSetting.h diff --git a/src/apps/debugger/Jamfile b/src/apps/debugger/Jamfile index 167979b6e7..7ee2bf140b 100644 --- a/src/apps/debugger/Jamfile +++ b/src/apps/debugger/Jamfile @@ -150,7 +150,6 @@ Application Debugger : TeamSettings.cpp TeamUiSettings.cpp TeamUiSettingsFactory.cpp - WatchpointSetting.cpp # settings/generic Setting.cpp diff --git a/src/apps/debugger/TeamDebugger.cpp b/src/apps/debugger/TeamDebugger.cpp index 26378e1019..e316d8b7f8 100644 --- a/src/apps/debugger/TeamDebugger.cpp +++ b/src/apps/debugger/TeamDebugger.cpp @@ -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 watchpointReference(watchpoint, true); - - // install it - fWatchpointManager->InstallWatchpoint(watchpoint, - watchpointSetting->IsEnabled()); - } - const TeamUiSettings* uiSettings = fTeamSettings.UiSettingFor( fUserInterface->ID()); if (uiSettings != NULL) diff --git a/src/apps/debugger/settings/TeamSettings.cpp b/src/apps/debugger/settings/TeamSettings.cpp index c379f40054..605202dcf8 100644 --- a/src/apps/debugger/settings/TeamSettings.cpp +++ b/src/apps/debugger/settings/TeamSettings.cpp @@ -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); diff --git a/src/apps/debugger/settings/TeamSettings.h b/src/apps/debugger/settings/TeamSettings.h index 3bc74e3d87..f41f2bf8bd 100644 --- a/src/apps/debugger/settings/TeamSettings.h +++ b/src/apps/debugger/settings/TeamSettings.h @@ -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 BreakpointList; typedef BObjectList UiSettingsList; - typedef BObjectList WatchpointList; private: void _Unset(); private: BreakpointList fBreakpoints; - WatchpointList fWatchpoints; UiSettingsList fUiSettings; BString fTeamName; }; diff --git a/src/apps/debugger/settings/WatchpointSetting.cpp b/src/apps/debugger/settings/WatchpointSetting.cpp deleted file mode 100644 index 0872e148dd..0000000000 --- a/src/apps/debugger/settings/WatchpointSetting.cpp +++ /dev/null @@ -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 - -#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; -} diff --git a/src/apps/debugger/settings/WatchpointSetting.h b/src/apps/debugger/settings/WatchpointSetting.h deleted file mode 100644 index 14fd16ceb4..0000000000 --- a/src/apps/debugger/settings/WatchpointSetting.h +++ /dev/null @@ -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 - -#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