Debugger: Split into core library and application.
- Add subfolder src/kits/debugger which contains the debugger's core functionality and lower layers. Correspondingly add headers/private/debugger for shared headers to be used by clients such as the Debugger application and eventual remote_debug_server. Adjust various files to account for differences as a result of the split and moves. - Add libdebugger.so to minimal Jamfile.
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright 2009, Ingo Weinhold, [email protected].
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef LOCATABLE_DIRECTORY_H
|
||||
#define LOCATABLE_DIRECTORY_H
|
||||
|
||||
#include "LocatableEntry.h"
|
||||
|
||||
|
||||
class LocatableDirectory : public LocatableEntry {
|
||||
public:
|
||||
LocatableDirectory(LocatableEntryOwner* owner,
|
||||
LocatableDirectory* parent,
|
||||
const BString& path);
|
||||
~LocatableDirectory();
|
||||
|
||||
virtual const char* Name() const;
|
||||
const char* Path() const;
|
||||
void GetPath(BString& _path) const;
|
||||
|
||||
// mutable (requires locking)
|
||||
virtual bool GetLocatedPath(BString& _path) const;
|
||||
virtual void SetLocatedPath(const BString& path,
|
||||
bool implicit);
|
||||
|
||||
void AddEntry(LocatableEntry* entry);
|
||||
void RemoveEntry(LocatableEntry* entry);
|
||||
const LocatableEntryList& Entries() const { return fEntries; }
|
||||
|
||||
private:
|
||||
BString fPath;
|
||||
BString fLocatedPath;
|
||||
LocatableEntryList fEntries;
|
||||
};
|
||||
|
||||
|
||||
#endif // LOCATABLE_DIRECTORY_H
|
||||
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* Copyright 2009, Ingo Weinhold, [email protected].
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef LOCATABLE_ENTRY_H
|
||||
#define LOCATABLE_ENTRY_H
|
||||
|
||||
#include <String.h>
|
||||
|
||||
#include <Referenceable.h>
|
||||
#include <util/DoublyLinkedList.h>
|
||||
#include <util/OpenHashTable.h>
|
||||
|
||||
|
||||
enum locatable_entry_state {
|
||||
LOCATABLE_ENTRY_UNLOCATED,
|
||||
LOCATABLE_ENTRY_LOCATED_IMPLICITLY,
|
||||
LOCATABLE_ENTRY_LOCATED_EXPLICITLY
|
||||
};
|
||||
|
||||
|
||||
class LocatableDirectory;
|
||||
class LocatableEntry;
|
||||
|
||||
|
||||
class LocatableEntryOwner {
|
||||
public:
|
||||
virtual ~LocatableEntryOwner();
|
||||
|
||||
virtual bool Lock() = 0;
|
||||
virtual void Unlock() = 0;
|
||||
|
||||
virtual void LocatableEntryUnused(LocatableEntry* entry) = 0;
|
||||
};
|
||||
|
||||
|
||||
class LocatableEntry : public BReferenceable,
|
||||
public DoublyLinkedListLinkImpl<LocatableEntry> {
|
||||
public:
|
||||
LocatableEntry(LocatableEntryOwner* owner,
|
||||
LocatableDirectory* parent);
|
||||
~LocatableEntry();
|
||||
|
||||
LocatableDirectory* Parent() const { return fParent; }
|
||||
virtual const char* Name() const = 0;
|
||||
|
||||
// mutable (requires locking)
|
||||
locatable_entry_state State() const { return fState; }
|
||||
virtual bool GetLocatedPath(BString& _path) const = 0;
|
||||
virtual void SetLocatedPath(const BString& path,
|
||||
bool implicit) = 0;
|
||||
|
||||
protected:
|
||||
virtual void LastReferenceReleased();
|
||||
|
||||
protected:
|
||||
LocatableEntryOwner* fOwner;
|
||||
LocatableDirectory* fParent;
|
||||
locatable_entry_state fState;
|
||||
|
||||
public:
|
||||
LocatableEntry* fNext;
|
||||
};
|
||||
|
||||
|
||||
typedef DoublyLinkedList<LocatableEntry> LocatableEntryList;
|
||||
|
||||
|
||||
#endif // LOCATABLE_ENTRY_H
|
||||
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Copyright 2009, Ingo Weinhold, [email protected].
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef LOCATABLE_FILE_H
|
||||
#define LOCATABLE_FILE_H
|
||||
|
||||
#include <ObjectList.h>
|
||||
|
||||
#include "LocatableEntry.h"
|
||||
|
||||
|
||||
class LocatableFile : public LocatableEntry {
|
||||
public:
|
||||
class Listener;
|
||||
|
||||
public:
|
||||
LocatableFile(LocatableEntryOwner* owner,
|
||||
LocatableDirectory* directory,
|
||||
const BString& name);
|
||||
~LocatableFile();
|
||||
|
||||
virtual const char* Name() const;
|
||||
void GetPath(BString& _path) const;
|
||||
|
||||
// mutable (requires/does locking)
|
||||
virtual bool GetLocatedPath(BString& _path) const;
|
||||
virtual void SetLocatedPath(const BString& path,
|
||||
bool implicit);
|
||||
|
||||
bool AddListener(Listener* listener);
|
||||
void RemoveListener(Listener* listener);
|
||||
|
||||
private:
|
||||
typedef BObjectList<Listener> ListenerList;
|
||||
|
||||
private:
|
||||
void _NotifyListeners();
|
||||
|
||||
private:
|
||||
BString fName;
|
||||
BString fLocatedPath;
|
||||
ListenerList fListeners;
|
||||
};
|
||||
|
||||
|
||||
class LocatableFile::Listener {
|
||||
public:
|
||||
virtual ~Listener();
|
||||
|
||||
virtual void LocatableFileChanged(LocatableFile* file) = 0;
|
||||
// called with lock held
|
||||
};
|
||||
|
||||
|
||||
#endif // LOCATABLE_FILE_H
|
||||
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright 2009, Ingo Weinhold, [email protected].
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef SOURCE_FILE_H
|
||||
#define SOURCE_FILE_H
|
||||
|
||||
#include <Referenceable.h>
|
||||
|
||||
|
||||
class SourceFile;
|
||||
|
||||
|
||||
class SourceFileOwner {
|
||||
public:
|
||||
virtual ~SourceFileOwner();
|
||||
|
||||
virtual void SourceFileUnused(SourceFile* sourceFile) = 0;
|
||||
virtual void SourceFileDeleted(SourceFile* sourceFile) = 0;
|
||||
};
|
||||
|
||||
|
||||
|
||||
class SourceFile : public BReferenceable {
|
||||
public:
|
||||
SourceFile(SourceFileOwner* owner);
|
||||
~SourceFile();
|
||||
|
||||
status_t Init(const char* path);
|
||||
|
||||
int32 CountLines() const;
|
||||
const char* LineAt(int32 index) const;
|
||||
int32 LineLengthAt(int32 index) const;
|
||||
|
||||
protected:
|
||||
virtual void LastReferenceReleased();
|
||||
|
||||
private:
|
||||
SourceFileOwner* fOwner;
|
||||
char* fFileContent;
|
||||
int32* fLineOffsets;
|
||||
int32 fLineCount;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif // SOURCE_FILE_H
|
||||
Reference in New Issue
Block a user