/* * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. * Distributed under the terms of the MIT License. */ #ifndef FUNCTION_DEBUG_INFO_H #define FUNCTION_DEBUG_INFO_H #include #include #include "ArchitectureTypes.h" #include "SourceLocation.h" enum function_source_state { FUNCTION_SOURCE_NOT_LOADED, FUNCTION_SOURCE_LOADING, FUNCTION_SOURCE_LOADED, FUNCTION_SOURCE_UNAVAILABLE }; class DebugInfo; class SourceCode; class FunctionDebugInfo : public Referenceable { public: class Listener; public: FunctionDebugInfo(); virtual ~FunctionDebugInfo(); virtual DebugInfo* GetDebugInfo() const = 0; virtual target_addr_t Address() const = 0; virtual target_size_t Size() const = 0; virtual const char* Name() const = 0; virtual const char* PrettyName() const = 0; virtual const char* SourceFileName() const = 0; virtual SourceLocation SourceStartLocation() const = 0; virtual SourceLocation SourceEndLocation() const = 0; // mutable attributes follow (locking required) SourceCode* GetSourceCode() const { return fSourceCode; } function_source_state SourceCodeState() const { return fSourceCodeState; } void SetSourceCode(SourceCode* source, function_source_state state); void AddListener(Listener* listener); void RemoveListener(Listener* listener); private: typedef DoublyLinkedList ListenerList; private: // mutable SourceCode* fSourceCode; function_source_state fSourceCodeState; ListenerList fListeners; }; class FunctionDebugInfo::Listener : public DoublyLinkedListLinkImpl { public: virtual ~Listener(); virtual void FunctionSourceCodeChanged( FunctionDebugInfo* function); // called with lock held }; #endif // FUNCTION_DEBUG_INFO_H