Debugger: Add classes for representing image loading state.

Adds a hierarchy of classes for preserving the loading state information for
a LoadImageDebugInfoJob. These include:
	- ImageDebugInfoLoadingState:
		Top level class that simply stores a reference for  the specific info
		state that we're currently attempting to load.

	- SpecificImageDebugInfoLoadingState:
		Abstract base class representing state information specific to a
		particular kind of debug information.

	- DwarfImageDebugInfoLoadingState:
		Implementation of the above for the case of DWARF.

	- DwarfFileLoadingState:
		Encapsulates the in-progress loading state of a DWARF file for the case
		where a file's debug information is referenced externally, but cannot
		be found.
This commit is contained in:
Rene Gollent 2014-06-08 11:41:49 -04:00
parent 4605febacf
commit a262768084
10 changed files with 269 additions and 0 deletions

View File

@ -100,6 +100,7 @@ Application Debugger :
DebuggerTeamDebugInfo.cpp
DwarfFunctionDebugInfo.cpp
DwarfImageDebugInfo.cpp
DwarfImageDebugInfoLoadingState.cpp
DwarfStackFrameDebugInfo.cpp
DwarfTeamDebugInfo.cpp
DwarfTypeFactory.cpp
@ -109,9 +110,11 @@ Application Debugger :
FunctionInstance.cpp
GlobalTypeLookup.cpp
ImageDebugInfo.cpp
ImageDebugInfoLoadingState.cpp
ImageDebugInfoProvider.cpp
NoOpStackFrameDebugInfo.cpp
SpecificImageDebugInfo.cpp
SpecificImageDebugInfoLoadingState.cpp
SpecificTeamDebugInfo.cpp
StackFrameDebugInfo.cpp
TeamDebugInfo.cpp

View File

@ -0,0 +1,27 @@
/*
* Copyright 2014, Rene Gollent, rene@gollent.com.
* Distributed under the terms of the MIT License.
*/
#include "DwarfImageDebugInfoLoadingState.h"
DwarfImageDebugInfoLoadingState::DwarfImageDebugInfoLoadingState()
:
SpecificImageDebugInfoLoadingState(),
fState()
{
}
DwarfImageDebugInfoLoadingState::~DwarfImageDebugInfoLoadingState()
{
}
bool
DwarfImageDebugInfoLoadingState::UserInputRequired() const
{
return fState.state == DWARF_FILE_LOADING_STATE_USER_INPUT_NEEDED;
}

View File

@ -0,0 +1,30 @@
/*
* Copyright 2014, Rene Gollent, rene@gollent.com.
* Distributed under the terms of the MIT License.
*/
#ifndef DWARF_IMAGE_DEBUG_INFO_LOADING_STATE_H
#define DWARF_IMAGE_DEBUG_INFO_LOADING_STATE_H
#include "DwarfFileLoadingState.h"
#include "SpecificImageDebugInfoLoadingState.h"
class DwarfImageDebugInfoLoadingState
: public SpecificImageDebugInfoLoadingState {
public:
DwarfImageDebugInfoLoadingState();
virtual ~DwarfImageDebugInfoLoadingState();
virtual bool UserInputRequired() const;
DwarfFileLoadingState& GetFileState()
{ return fState; }
private:
DwarfFileLoadingState fState;
};
#endif // DWARF_IMAGE_DEBUG_INFO_LOADING_STATE_H

View File

@ -0,0 +1,61 @@
/*
* Copyright 2014, Rene Gollent, rene@gollent.com.
* Distributed under the terms of the MIT License.
*/
#include "ImageDebugInfoLoadingState.h"
#include "SpecificImageDebugInfoLoadingState.h"
ImageDebugInfoLoadingState::ImageDebugInfoLoadingState()
:
fSpecificInfoLoadingState(),
fSpecificInfoIndex(0)
{
}
ImageDebugInfoLoadingState::~ImageDebugInfoLoadingState()
{
}
bool
ImageDebugInfoLoadingState::HasSpecificDebugInfoLoadingState() const
{
return fSpecificInfoLoadingState.Get() != NULL;
}
void
ImageDebugInfoLoadingState::SetSpecificDebugInfoLoadingState(
SpecificImageDebugInfoLoadingState* state)
{
fSpecificInfoLoadingState.SetTo(state, true);
}
void
ImageDebugInfoLoadingState::ClearSpecificDebugInfoLoadingState()
{
fSpecificInfoLoadingState = NULL;
}
bool
ImageDebugInfoLoadingState::UserInputRequired() const
{
if (HasSpecificDebugInfoLoadingState())
return fSpecificInfoLoadingState->UserInputRequired();
return false;
}
void
ImageDebugInfoLoadingState::SetSpecificInfoIndex(int32 index)
{
fSpecificInfoIndex = index;
}

View File

@ -0,0 +1,43 @@
/*
* Copyright 2014, Rene Gollent, rene@gollent.com.
* Distributed under the terms of the MIT License.
*/
#ifndef IMAGE_DEBUG_INFO_LOADING_STATE_H
#define IMAGE_DEBUG_INFO_LOADING_STATE_H
#include <Referenceable.h>
class SpecificImageDebugInfoLoadingState;
class ImageDebugInfoLoadingState {
public:
ImageDebugInfoLoadingState();
virtual ~ImageDebugInfoLoadingState();
bool HasSpecificDebugInfoLoadingState() const;
SpecificImageDebugInfoLoadingState*
GetSpecificDebugInfoLoadingState() const
{ return fSpecificInfoLoadingState; }
void SetSpecificDebugInfoLoadingState(
SpecificImageDebugInfoLoadingState* state);
// note: takes over reference of passed
// in state object.
void ClearSpecificDebugInfoLoadingState();
bool UserInputRequired() const;
int32 GetSpecificInfoIndex() const
{ return fSpecificInfoIndex; }
void SetSpecificInfoIndex(int32 index);
private:
BReference<SpecificImageDebugInfoLoadingState>
fSpecificInfoLoadingState;
int32 fSpecificInfoIndex;
};
#endif // IMAGE_DEBUG_INFO_LOADING_STATE_H

View File

@ -0,0 +1,19 @@
/*
* Copyright 2014, Rene Gollent, rene@gollent.com.
* Distributed under the terms of the MIT License.
*/
#include "SpecificImageDebugInfoLoadingState.h"
SpecificImageDebugInfoLoadingState::SpecificImageDebugInfoLoadingState()
:
BReferenceable()
{
}
SpecificImageDebugInfoLoadingState::~SpecificImageDebugInfoLoadingState()
{
}

View File

@ -0,0 +1,21 @@
/*
* Copyright 2014, Rene Gollent, rene@gollent.com.
* Distributed under the terms of the MIT License.
*/
#ifndef SPECIFIC_IMAGE_DEBUG_INFO_LOADING_STATE_H
#define SPECIFIC_IMAGE_DEBUG_INFO_LOADING_STATE_H
#include <Referenceable.h>
class SpecificImageDebugInfoLoadingState : public BReferenceable {
public:
SpecificImageDebugInfoLoadingState();
virtual ~SpecificImageDebugInfoLoadingState();
virtual bool UserInputRequired() const = 0;
};
#endif // SPECIFIC_IMAGE_DEBUG_INFO_LOADING_STATE_H

View File

@ -0,0 +1,26 @@
/*
* Copyright 2014, Rene Gollent, rene@gollent.com.
* Distributed under the terms of the MIT License.
*/
#include "DwarfFileLoadingState.h"
#include "DwarfFile.h"
DwarfFileLoadingState::DwarfFileLoadingState()
:
dwarfFile(),
externalInfoFileName(),
locatedExternalInfoPath(),
state(DWARF_FILE_LOADING_STATE_INITIAL)
{
}
DwarfFileLoadingState::~DwarfFileLoadingState()
{
}

View File

@ -0,0 +1,38 @@
/*
* Copyright 2014, Rene Gollent, rene@gollent.com.
* Distributed under the terms of the MIT License.
*/
#ifndef DWARF_FILE_LOADING_STATE_H
#define DWARF_FILE_LOADING_STATE_H
#include <Referenceable.h>
#include <String.h>
class DwarfFile;
enum dwarf_file_loading_state {
DWARF_FILE_LOADING_STATE_INITIAL = 0,
DWARF_FILE_LOADING_STATE_USER_INPUT_NEEDED,
DWARF_FILE_LOADING_STATE_USER_INPUT_PROVIDED,
DWARF_FILE_LOADING_STATE_FAILED,
DWARF_FILE_LOADING_STATE_SUCCEEDED
};
struct DwarfFileLoadingState {
BReference<DwarfFile>
dwarfFile;
BString externalInfoFileName;
BString locatedExternalInfoPath;
dwarf_file_loading_state
state;
DwarfFileLoadingState();
~DwarfFileLoadingState();
};
#endif // DWARF_FILE_LOADING_STATE_H

View File

@ -22,6 +22,7 @@ MergeObject Debugger_dwarf.o
DebugInfoEntry.cpp
DwarfExpressionEvaluator.cpp
DwarfFile.cpp
DwarfFileLoadingState.cpp
DwarfManager.cpp
DwarfTargetInterface.cpp
DwarfUtils.cpp