a9d53d9e7e
FunctionInstance: - Add new state FUNCTION_SOURCE_SUPPRESSED. This signals that the user explicitly forced disassembly to be loaded despite source code being available. LoadSourceCodeJob: - When forced to disassembly, use the above suppressed state accordingly. SourceView/TeamWindow/TeamDebugger: - Adjust to take new state into account as needed. TeamDebugInfo::GetActiveSourceCode: - When looking at a function to decide whether to return line information based on source or disassembly, first examine the source code state. If the source has never been loaded for that function, but we have it available, set it on the function at that point. This lazily addresses the fact that LoadSourceCodeJob is called on behalf of a specific function, and consequently only sets the source code onto that function, and not all others present in the same file. This allows us to differentiate between the case where a function doesn't have source code available at all, versus a function that has simply been forced to disassembly view at this point in time. The primary symptom of the above issue was that attempting to set a breakpoint outside of the currently active function, but within the same file would result in the breakpoints view indicating that the breakpoint was at line 0 rather than the appropriate line, and breakpoints would also not be drawn in the source view for such locations. Thanks to Humdinger for the heads up!
85 lines
2.3 KiB
C++
85 lines
2.3 KiB
C++
/*
|
|
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
|
|
* Copyright 2016, Rene Gollent, rene@gollent.com.
|
|
* Distributed under the terms of the MIT License.
|
|
*/
|
|
#ifndef FUNCTION_INSTANCE_H
|
|
#define FUNCTION_INSTANCE_H
|
|
|
|
#include <util/DoublyLinkedList.h>
|
|
|
|
#include "FunctionDebugInfo.h"
|
|
|
|
|
|
enum function_source_state {
|
|
FUNCTION_SOURCE_NOT_LOADED,
|
|
FUNCTION_SOURCE_LOADING,
|
|
FUNCTION_SOURCE_LOADED,
|
|
FUNCTION_SOURCE_UNAVAILABLE,
|
|
FUNCTION_SOURCE_SUPPRESSED
|
|
};
|
|
|
|
|
|
class DisassembledCode;
|
|
class Function;
|
|
class FunctionDebugInfo;
|
|
class FunctionID;
|
|
class ImageDebugInfo;
|
|
|
|
|
|
class FunctionInstance : public BReferenceable,
|
|
public DoublyLinkedListLinkImpl<FunctionInstance> {
|
|
public:
|
|
FunctionInstance(ImageDebugInfo* imageDebugInfo,
|
|
FunctionDebugInfo* functionDebugInfo);
|
|
~FunctionInstance();
|
|
|
|
ImageDebugInfo* GetImageDebugInfo() const
|
|
{ return fImageDebugInfo; }
|
|
Function* GetFunction() const
|
|
{ return fFunction; }
|
|
FunctionDebugInfo* GetFunctionDebugInfo() const
|
|
{ return fFunctionDebugInfo; }
|
|
|
|
target_addr_t Address() const
|
|
{ return fFunctionDebugInfo->Address(); }
|
|
target_size_t Size() const
|
|
{ return fFunctionDebugInfo->Size(); }
|
|
const BString& Name() const
|
|
{ return fFunctionDebugInfo->Name(); }
|
|
const BString& PrettyName() const
|
|
{ return fFunctionDebugInfo->PrettyName(); }
|
|
LocatableFile* SourceFile() const
|
|
{ return fFunctionDebugInfo->SourceFile(); }
|
|
SourceLocation GetSourceLocation() const
|
|
{ return fFunctionDebugInfo
|
|
->SourceStartLocation(); }
|
|
|
|
FunctionID* GetFunctionID() const;
|
|
// returns a reference
|
|
|
|
void SetFunction(Function* function);
|
|
// package private
|
|
|
|
// mutable attributes follow (locking required)
|
|
DisassembledCode* GetSourceCode() const
|
|
{ return fSourceCode; }
|
|
function_source_state SourceCodeState() const
|
|
{ return fSourceCodeState; }
|
|
void SetSourceCode(DisassembledCode* source,
|
|
function_source_state state);
|
|
|
|
private:
|
|
ImageDebugInfo* fImageDebugInfo;
|
|
Function* fFunction;
|
|
FunctionDebugInfo* fFunctionDebugInfo;
|
|
DisassembledCode* fSourceCode;
|
|
function_source_state fSourceCodeState;
|
|
};
|
|
|
|
|
|
typedef DoublyLinkedList<FunctionInstance> FunctionInstanceList;
|
|
|
|
|
|
#endif // FUNCTION_INSTANCE_H
|