Some optimizations for ThreadHandler.

- CreateStackTrace() now takes a parameter indicating whether or not
  to try and retrieve full frame information. This in turn is passed
  on to SpecificImageDebugInfo, where e.g. DwarfImageDebugInfo can
  use it to avoid constructing variables and parameters. This is
  used by ThreadHandler since, when it requests the top frame for
  its stepping  calculations, this additional data/work is completely
  unnecessary.
This commit is contained in:
Rene Gollent 2012-12-26 00:17:09 -05:00
parent 50bd564d06
commit 1167ae5274
8 changed files with 20 additions and 9 deletions

View File

@ -94,7 +94,8 @@ Architecture::InitRegisterRules(CfaContext& context) const
status_t
Architecture::CreateStackTrace(Team* team,
ImageDebugInfoProvider* imageInfoProvider, CpuState* cpuState,
StackTrace*& _stackTrace, int32 maxStackDepth, bool useExistingTrace)
StackTrace*& _stackTrace, int32 maxStackDepth, bool useExistingTrace,
bool getFullFrameInfo)
{
BReference<CpuState> cpuStateReference(cpuState);
@ -161,8 +162,8 @@ Architecture::CreateStackTrace(Team* team,
CpuState* previousCpuState = NULL;
if (function != NULL) {
status_t error = functionDebugInfo->GetSpecificImageDebugInfo()
->CreateFrame(image, function, cpuState, frame,
previousCpuState);
->CreateFrame(image, function, cpuState, getFullFrameInfo,
frame, previousCpuState);
if (error != B_OK && error != B_UNSUPPORTED)
break;
}
@ -170,7 +171,8 @@ Architecture::CreateStackTrace(Team* team,
// If we have no frame yet, let the architecture create it.
if (frame == NULL) {
status_t error = CreateStackFrame(image, functionDebugInfo,
cpuState, nextFrame == NULL, frame, previousCpuState);
cpuState, nextFrame == NULL, frame,
previousCpuState);
if (error != B_OK)
break;
}

View File

@ -109,7 +109,8 @@ public:
CpuState* cpuState,
StackTrace*& _stackTrace,
int32 maxStackDepth = -1,
bool useExistingTrace = false);
bool useExistingTrace = false,
bool getFullFrameInfo = true);
// team is not locked
virtual status_t GetWatchpointDebugCapabilities(

View File

@ -253,7 +253,8 @@ ThreadHandler::HandleThreadAction(uint32 action)
if (stackTrace == NULL && cpuState != NULL) {
if (fDebuggerInterface->GetArchitecture()->CreateStackTrace(
fThread->GetTeam(), this, cpuState, stackTrace, 1) == B_OK) {
fThread->GetTeam(), this, cpuState, stackTrace, 1, false,
false) == B_OK) {
stackTraceReference.SetTo(stackTrace, true);
}
}

View File

@ -68,7 +68,8 @@ DebuggerImageDebugInfo::GetAddressSectionType(target_addr_t address)
status_t
DebuggerImageDebugInfo::CreateFrame(Image* image,
FunctionInstance* functionInstance, CpuState* cpuState,
StackFrame*& _previousFrame, CpuState*& _previousCpuState)
bool getFullFrameInfo, StackFrame*& _previousFrame,
CpuState*& _previousCpuState)
{
return B_UNSUPPORTED;
}

View File

@ -35,6 +35,7 @@ public:
virtual status_t CreateFrame(Image* image,
FunctionInstance* functionInstance,
CpuState* cpuState,
bool getFullFrameInfo,
StackFrame*& _previousFrame,
CpuState*& _previousCpuState);
virtual status_t GetStatement(FunctionDebugInfo* function,

View File

@ -516,7 +516,7 @@ DwarfImageDebugInfo::GetAddressSectionType(target_addr_t address)
status_t
DwarfImageDebugInfo::CreateFrame(Image* image,
FunctionInstance* functionInstance, CpuState* cpuState,
StackFrame*& _frame, CpuState*& _previousCpuState)
bool getFullFrameInfo, StackFrame*& _frame, CpuState*& _previousCpuState)
{
DwarfFunctionDebugInfo* function = dynamic_cast<DwarfFunctionDebugInfo*>(
functionInstance->GetFunctionDebugInfo());
@ -635,7 +635,7 @@ DwarfImageDebugInfo::CreateFrame(Image* image,
// The subprogram entry may not be available since this may be a case
// where .eh_frame was used to unwind the stack without other DWARF
// info being available.
if (subprogramEntry != NULL) {
if (subprogramEntry != NULL && getFullFrameInfo) {
// create function parameter objects
for (DebugInfoEntryList::ConstIterator it
= subprogramEntry->Parameters().GetIterator();

View File

@ -61,6 +61,7 @@ public:
virtual status_t CreateFrame(Image* image,
FunctionInstance* functionInstance,
CpuState* cpuState,
bool getFullFrameInfo,
StackFrame*& _frame,
CpuState*& _previousCpuState);
virtual status_t GetStatement(FunctionDebugInfo* function,

View File

@ -55,11 +55,15 @@ public:
virtual status_t CreateFrame(Image* image,
FunctionInstance* functionInstance,
CpuState* cpuState,
bool getFullFrameInfo,
StackFrame*& _Frame,
CpuState*& _previousCpuState) = 0;
// returns reference to previous frame
// and CPU state; returned CPU state
// can be NULL; can return B_UNSUPPORTED
// getFullFrameInfo: try to retrieve
// variables/parameters if true
// (and supported)
virtual status_t GetStatement(FunctionDebugInfo* function,
target_addr_t address,
Statement*& _statement) = 0;