Debugger: add settings manager for source location mappings.
- If it was necessary to help the debugger locate a particular source file due to it not being found on disk at the location specified in the debug information, the associated user-supplied path mappings are now saved and restored in the team settings. The file manager still needs a bit of extra work to apply these as files are added though.
This commit is contained in:
@@ -182,6 +182,7 @@ Application Debugger :
|
|||||||
BreakpointSetting.cpp
|
BreakpointSetting.cpp
|
||||||
GuiTeamUiSettings.cpp
|
GuiTeamUiSettings.cpp
|
||||||
SettingsManager.cpp
|
SettingsManager.cpp
|
||||||
|
TeamFileManagerSettings.cpp
|
||||||
TeamSettings.cpp
|
TeamSettings.cpp
|
||||||
TeamUiSettings.cpp
|
TeamUiSettings.cpp
|
||||||
TeamUiSettingsFactory.cpp
|
TeamUiSettingsFactory.cpp
|
||||||
|
|||||||
@@ -1991,6 +1991,8 @@ TeamDebugger::_LoadSettings()
|
|||||||
breakpointSetting->IsEnabled());
|
breakpointSetting->IsEnabled());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fFileManager->LoadLocationMappings(fTeamSettings.FileManagerSettings());
|
||||||
|
|
||||||
const TeamUiSettings* uiSettings = fTeamSettings.UiSettingFor(
|
const TeamUiSettings* uiSettings = fTeamSettings.UiSettingFor(
|
||||||
fUserInterface->ID());
|
fUserInterface->ID());
|
||||||
if (uiSettings != NULL)
|
if (uiSettings != NULL)
|
||||||
@@ -2022,6 +2024,8 @@ TeamDebugger::_SaveSettings()
|
|||||||
settings.AddUiSettings(clonedSettings);
|
settings.AddUiSettings(clonedSettings);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fFileManager->SaveLocationMappings(settings.FileManagerSettings());
|
||||||
locker.Unlock();
|
locker.Unlock();
|
||||||
|
|
||||||
// save the settings
|
// save the settings
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
|
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
|
||||||
* Copyright 2011-2012, Rene Gollent, rene@gollent.com.
|
* Copyright 2011-2013, Rene Gollent, rene@gollent.com.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -15,6 +15,7 @@
|
|||||||
#include "LocatableFile.h"
|
#include "LocatableFile.h"
|
||||||
#include "SourceFile.h"
|
#include "SourceFile.h"
|
||||||
#include "StringUtils.h"
|
#include "StringUtils.h"
|
||||||
|
#include "TeamFileManagerSettings.h"
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark - EntryPath
|
// #pragma mark - EntryPath
|
||||||
@@ -542,7 +543,8 @@ FileManager::FileManager()
|
|||||||
fLock("file manager"),
|
fLock("file manager"),
|
||||||
fTargetDomain(NULL),
|
fTargetDomain(NULL),
|
||||||
fSourceDomain(NULL),
|
fSourceDomain(NULL),
|
||||||
fSourceFiles(NULL)
|
fSourceFiles(NULL),
|
||||||
|
fLocationMappings()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -636,10 +638,18 @@ FileManager::GetSourceFile(const BString& path)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
FileManager::SourceEntryLocated(const BString& path, const BString& locatedPath)
|
FileManager::SourceEntryLocated(const BString& path,
|
||||||
|
const BString& locatedPath)
|
||||||
{
|
{
|
||||||
AutoLocker<FileManager> locker(this);
|
AutoLocker<FileManager> locker(this);
|
||||||
fSourceDomain->EntryLocated(path, locatedPath);
|
fSourceDomain->EntryLocated(path, locatedPath);
|
||||||
|
|
||||||
|
BMessage archivedMapping;
|
||||||
|
if (archivedMapping.AddString("source:path", path) == B_OK
|
||||||
|
&& archivedMapping.AddString("source:locatedpath", locatedPath)
|
||||||
|
== B_OK) {
|
||||||
|
fLocationMappings.AddMessage("source:mapping", &archivedMapping);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -687,6 +697,30 @@ FileManager::LoadSourceFile(LocatableFile* file, SourceFile*& _sourceFile)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
FileManager::LoadLocationMappings(TeamFileManagerSettings* settings)
|
||||||
|
{
|
||||||
|
for (int32 i = 0; i < settings->CountSourceMappings(); i++) {
|
||||||
|
BString sourcePath;
|
||||||
|
BString locatedPath;
|
||||||
|
|
||||||
|
if (settings->GetSourceMappingAt(i, sourcePath, locatedPath) != B_OK)
|
||||||
|
return B_NO_MEMORY;
|
||||||
|
|
||||||
|
SourceEntryLocated(sourcePath, locatedPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
return B_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
FileManager::SaveLocationMappings(TeamFileManagerSettings* settings)
|
||||||
|
{
|
||||||
|
return settings->SetTo(fLocationMappings);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
FileManager::SourceFileEntry*
|
FileManager::SourceFileEntry*
|
||||||
FileManager::_LookupSourceFile(const BString& path)
|
FileManager::_LookupSourceFile(const BString& path)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
/*
|
/*
|
||||||
* 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.
|
||||||
*/
|
*/
|
||||||
#ifndef FILE_MANAGER_H
|
#ifndef FILE_MANAGER_H
|
||||||
#define FILE_MANAGER_H
|
#define FILE_MANAGER_H
|
||||||
|
|
||||||
#include <Locker.h>
|
#include <Locker.h>
|
||||||
|
#include <Message.h>
|
||||||
#include <String.h>
|
#include <String.h>
|
||||||
|
|
||||||
#include <util/DoublyLinkedList.h>
|
#include <util/DoublyLinkedList.h>
|
||||||
@@ -15,6 +17,7 @@
|
|||||||
class LocatableEntry;
|
class LocatableEntry;
|
||||||
class LocatableFile;
|
class LocatableFile;
|
||||||
class SourceFile;
|
class SourceFile;
|
||||||
|
class TeamFileManagerSettings;
|
||||||
|
|
||||||
|
|
||||||
class FileManager {
|
class FileManager {
|
||||||
@@ -47,6 +50,11 @@ public:
|
|||||||
SourceFile*& _sourceFile);
|
SourceFile*& _sourceFile);
|
||||||
// returns a reference
|
// returns a reference
|
||||||
|
|
||||||
|
status_t LoadLocationMappings(TeamFileManagerSettings*
|
||||||
|
settings);
|
||||||
|
status_t SaveLocationMappings(TeamFileManagerSettings*
|
||||||
|
settings);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct EntryPath;
|
struct EntryPath;
|
||||||
struct EntryHashDefinition;
|
struct EntryHashDefinition;
|
||||||
@@ -70,6 +78,7 @@ private:
|
|||||||
Domain* fTargetDomain;
|
Domain* fTargetDomain;
|
||||||
Domain* fSourceDomain;
|
Domain* fSourceDomain;
|
||||||
SourceFileTable* fSourceFiles;
|
SourceFileTable* fSourceFiles;
|
||||||
|
BMessage fLocationMappings;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,128 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2013, Rene Gollent, rene@gollent.com.
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
#include "TeamFileManagerSettings.h"
|
||||||
|
|
||||||
|
TeamFileManagerSettings::TeamFileManagerSettings()
|
||||||
|
:
|
||||||
|
fValues()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
TeamFileManagerSettings::~TeamFileManagerSettings()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
TeamFileManagerSettings&
|
||||||
|
TeamFileManagerSettings::operator=(const TeamFileManagerSettings& other)
|
||||||
|
{
|
||||||
|
fValues = other.fValues;
|
||||||
|
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const char*
|
||||||
|
TeamFileManagerSettings::ID() const
|
||||||
|
{
|
||||||
|
return "FileManager";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
TeamFileManagerSettings::SetTo(const BMessage& archive)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
fValues = archive;
|
||||||
|
} catch (...) {
|
||||||
|
return B_NO_MEMORY;
|
||||||
|
}
|
||||||
|
|
||||||
|
return B_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
TeamFileManagerSettings::WriteTo(BMessage& archive) const
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
archive = fValues;
|
||||||
|
} catch (...) {
|
||||||
|
return B_NO_MEMORY;
|
||||||
|
}
|
||||||
|
|
||||||
|
return B_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int32
|
||||||
|
TeamFileManagerSettings::CountSourceMappings() const
|
||||||
|
{
|
||||||
|
type_code type;
|
||||||
|
int32 count = 0;
|
||||||
|
|
||||||
|
if (fValues.GetInfo("source:mapping", &type, &count) == B_OK)
|
||||||
|
return count;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
TeamFileManagerSettings::AddSourceMapping(const BString& sourcePath,
|
||||||
|
const BString& locatedPath)
|
||||||
|
{
|
||||||
|
BMessage mapping;
|
||||||
|
if (mapping.AddString("source:path", sourcePath) != B_OK
|
||||||
|
|| mapping.AddString("source:locatedpath", locatedPath) != B_OK
|
||||||
|
|| fValues.AddMessage("source:mapping", &mapping) != B_OK) {
|
||||||
|
return B_NO_MEMORY;
|
||||||
|
}
|
||||||
|
|
||||||
|
return B_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
TeamFileManagerSettings::RemoveSourceMappingAt(int32 index)
|
||||||
|
{
|
||||||
|
return fValues.RemoveData("mapping", index);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
TeamFileManagerSettings::GetSourceMappingAt(int32 index, BString& sourcePath,
|
||||||
|
BString& locatedPath)
|
||||||
|
{
|
||||||
|
BMessage mapping;
|
||||||
|
status_t error = fValues.FindMessage("mapping", index, &mapping);
|
||||||
|
if (error != B_OK)
|
||||||
|
return error;
|
||||||
|
|
||||||
|
error = mapping.FindString("source:path", &sourcePath);
|
||||||
|
if (error != B_OK)
|
||||||
|
return error;
|
||||||
|
|
||||||
|
return mapping.FindString("source:locatedpath", &locatedPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
TeamFileManagerSettings*
|
||||||
|
TeamFileManagerSettings::Clone() const
|
||||||
|
{
|
||||||
|
TeamFileManagerSettings* settings = new(std::nothrow)
|
||||||
|
TeamFileManagerSettings();
|
||||||
|
|
||||||
|
if (settings == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
if (settings->SetTo(fValues) != B_OK) {
|
||||||
|
delete settings;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return settings;
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2013, Rene Gollent, rene@gollent.com.
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*/
|
||||||
|
#ifndef TEAM_FILE_MANAGER_SETTINGS_H
|
||||||
|
#define TEAM_FILE_MANAGER_SETTINGS_H
|
||||||
|
|
||||||
|
#include <Message.h>
|
||||||
|
|
||||||
|
|
||||||
|
class TeamFileManagerSettings {
|
||||||
|
public:
|
||||||
|
TeamFileManagerSettings();
|
||||||
|
virtual ~TeamFileManagerSettings();
|
||||||
|
|
||||||
|
TeamFileManagerSettings&
|
||||||
|
operator=(
|
||||||
|
const TeamFileManagerSettings& other);
|
||||||
|
// throws std::bad_alloc;
|
||||||
|
|
||||||
|
const char* ID() const;
|
||||||
|
status_t SetTo(const BMessage& archive);
|
||||||
|
status_t WriteTo(BMessage& archive) const;
|
||||||
|
|
||||||
|
int32 CountSourceMappings() const;
|
||||||
|
status_t AddSourceMapping(const BString& sourcePath,
|
||||||
|
const BString& locatedPath);
|
||||||
|
status_t RemoveSourceMappingAt(int32 index);
|
||||||
|
status_t GetSourceMappingAt(int32 index,
|
||||||
|
BString& sourcePath, BString& locatedPath);
|
||||||
|
|
||||||
|
virtual TeamFileManagerSettings*
|
||||||
|
Clone() const;
|
||||||
|
// throws std::bad_alloc
|
||||||
|
|
||||||
|
private:
|
||||||
|
BMessage fValues;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif // TEAM_FILE_MANAGER_SETTINGS_H
|
||||||
@@ -16,6 +16,7 @@
|
|||||||
#include "ArchivingUtils.h"
|
#include "ArchivingUtils.h"
|
||||||
#include "BreakpointSetting.h"
|
#include "BreakpointSetting.h"
|
||||||
#include "Team.h"
|
#include "Team.h"
|
||||||
|
#include "TeamFileManagerSettings.h"
|
||||||
#include "TeamUiSettings.h"
|
#include "TeamUiSettings.h"
|
||||||
#include "TeamUiSettingsFactory.h"
|
#include "TeamUiSettingsFactory.h"
|
||||||
#include "UserBreakpoint.h"
|
#include "UserBreakpoint.h"
|
||||||
@@ -23,6 +24,7 @@
|
|||||||
|
|
||||||
TeamSettings::TeamSettings()
|
TeamSettings::TeamSettings()
|
||||||
{
|
{
|
||||||
|
fFileManagerSettings = new TeamFileManagerSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -115,6 +117,12 @@ TeamSettings::SetTo(const BMessage& archive)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (archive.FindMessage("filemanagersettings", &childArchive) == B_OK) {
|
||||||
|
error = fFileManagerSettings->SetTo(childArchive);
|
||||||
|
if (error != B_OK)
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -149,6 +157,14 @@ TeamSettings::WriteTo(BMessage& archive) const
|
|||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
error = fFileManagerSettings->WriteTo(childArchive);
|
||||||
|
if (error != B_OK)
|
||||||
|
return error;
|
||||||
|
|
||||||
|
error = archive.AddMessage("filemanagersettings", &childArchive);
|
||||||
|
if (error != B_OK)
|
||||||
|
return error;
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -234,10 +250,32 @@ TeamSettings::operator=(const TeamSettings& other)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*fFileManagerSettings = *other.fFileManagerSettings;
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
TeamFileManagerSettings*
|
||||||
|
TeamSettings::FileManagerSettings() const
|
||||||
|
{
|
||||||
|
return fFileManagerSettings;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
TeamSettings::SetFileManagerSettings(TeamFileManagerSettings* settings)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
*fFileManagerSettings = *settings;
|
||||||
|
} catch (...) {
|
||||||
|
return B_NO_MEMORY;
|
||||||
|
}
|
||||||
|
|
||||||
|
return B_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TeamSettings::_Unset()
|
TeamSettings::_Unset()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -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.
|
||||||
*/
|
*/
|
||||||
#ifndef TEAM_SETTINGS_H
|
#ifndef TEAM_SETTINGS_H
|
||||||
@@ -15,6 +16,7 @@ class BMessage;
|
|||||||
class Team;
|
class Team;
|
||||||
class BreakpointSetting;
|
class BreakpointSetting;
|
||||||
class TeamUiSettings;
|
class TeamUiSettings;
|
||||||
|
class TeamFileManagerSettings;
|
||||||
|
|
||||||
|
|
||||||
class TeamSettings {
|
class TeamSettings {
|
||||||
@@ -41,6 +43,11 @@ public:
|
|||||||
TeamSettings& operator=(const TeamSettings& other);
|
TeamSettings& operator=(const TeamSettings& other);
|
||||||
// throws std::bad_alloc
|
// throws std::bad_alloc
|
||||||
|
|
||||||
|
TeamFileManagerSettings*
|
||||||
|
FileManagerSettings() const;
|
||||||
|
status_t SetFileManagerSettings(
|
||||||
|
TeamFileManagerSettings* settings);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
typedef BObjectList<BreakpointSetting> BreakpointList;
|
typedef BObjectList<BreakpointSetting> BreakpointList;
|
||||||
typedef BObjectList<TeamUiSettings> UiSettingsList;
|
typedef BObjectList<TeamUiSettings> UiSettingsList;
|
||||||
@@ -51,6 +58,8 @@ private:
|
|||||||
private:
|
private:
|
||||||
BreakpointList fBreakpoints;
|
BreakpointList fBreakpoints;
|
||||||
UiSettingsList fUiSettings;
|
UiSettingsList fUiSettings;
|
||||||
|
TeamFileManagerSettings*
|
||||||
|
fFileManagerSettings;
|
||||||
BString fTeamName;
|
BString fTeamName;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user