* Clarified the location expression evaluation semantics -- the ValueLocations
returned by the DWARF layer need to be translated to be usable in the generic code. * DwarfFile::EvaluateDynamicValue(): Added optional parameter to return the type of the evaluated value, if available. * Added source language info attribute to CompilationUnit. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33313 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -80,6 +80,13 @@ CompilationUnit::SetUnitEntry(DIECompileUnitBase* entry)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
CompilationUnit::SetSourceLanguage(const SourceLanguageInfo* language)
|
||||||
|
{
|
||||||
|
fSourceLanguage = language;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
CompilationUnit::SetAddressRanges(TargetAddressRangeList* ranges)
|
CompilationUnit::SetAddressRanges(TargetAddressRangeList* ranges)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
class AbbreviationTable;
|
class AbbreviationTable;
|
||||||
class DebugInfoEntry;
|
class DebugInfoEntry;
|
||||||
class DIECompileUnitBase;
|
class DIECompileUnitBase;
|
||||||
|
class SourceLanguageInfo;
|
||||||
class TargetAddressRangeList;
|
class TargetAddressRangeList;
|
||||||
|
|
||||||
|
|
||||||
@@ -53,6 +54,11 @@ public:
|
|||||||
DIECompileUnitBase* UnitEntry() const { return fUnitEntry; }
|
DIECompileUnitBase* UnitEntry() const { return fUnitEntry; }
|
||||||
void SetUnitEntry(DIECompileUnitBase* entry);
|
void SetUnitEntry(DIECompileUnitBase* entry);
|
||||||
|
|
||||||
|
const SourceLanguageInfo* SourceLanguage() const
|
||||||
|
{ return fSourceLanguage; }
|
||||||
|
void SetSourceLanguage(
|
||||||
|
const SourceLanguageInfo* language);
|
||||||
|
|
||||||
TargetAddressRangeList* AddressRanges() const
|
TargetAddressRangeList* AddressRanges() const
|
||||||
{ return fAddressRanges; }
|
{ return fAddressRanges; }
|
||||||
void SetAddressRanges(
|
void SetAddressRanges(
|
||||||
@@ -91,6 +97,7 @@ private:
|
|||||||
off_t fAbbreviationOffset;
|
off_t fAbbreviationOffset;
|
||||||
AbbreviationTable* fAbbreviationTable;
|
AbbreviationTable* fAbbreviationTable;
|
||||||
DIECompileUnitBase* fUnitEntry;
|
DIECompileUnitBase* fUnitEntry;
|
||||||
|
const SourceLanguageInfo* fSourceLanguage;
|
||||||
TargetAddressRangeList* fAddressRanges;
|
TargetAddressRangeList* fAddressRanges;
|
||||||
Array<DebugInfoEntry*> fEntries;
|
Array<DebugInfoEntry*> fEntries;
|
||||||
Array<off_t> fEntryOffsets;
|
Array<off_t> fEntryOffsets;
|
||||||
|
|||||||
@@ -58,6 +58,9 @@ public:
|
|||||||
target_addr_t& _result);
|
target_addr_t& _result);
|
||||||
status_t EvaluateLocation(const void* expression,
|
status_t EvaluateLocation(const void* expression,
|
||||||
size_t size, ValueLocation& _location);
|
size_t size, ValueLocation& _location);
|
||||||
|
// The returned location will have DWARF
|
||||||
|
// semantics regarding register numbers and
|
||||||
|
// bit offsets/sizes (cf. bit pieces).
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct EvaluationException;
|
struct EvaluationException;
|
||||||
|
|||||||
@@ -702,14 +702,19 @@ DwarfFile::EvaluateDynamicValue(CompilationUnit* unit,
|
|||||||
DIESubprogram* subprogramEntry, const DynamicAttributeValue* value,
|
DIESubprogram* subprogramEntry, const DynamicAttributeValue* value,
|
||||||
const DwarfTargetInterface* targetInterface,
|
const DwarfTargetInterface* targetInterface,
|
||||||
target_addr_t instructionPointer, target_addr_t framePointer,
|
target_addr_t instructionPointer, target_addr_t framePointer,
|
||||||
BVariant& _result)
|
BVariant& _result, DIEType** _type)
|
||||||
{
|
{
|
||||||
if (!value->IsValid())
|
if (!value->IsValid())
|
||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
|
|
||||||
|
DIEType* dummyType;
|
||||||
|
if (_type == NULL)
|
||||||
|
_type = &dummyType;
|
||||||
|
|
||||||
switch (value->attributeClass) {
|
switch (value->attributeClass) {
|
||||||
case ATTRIBUTE_CLASS_CONSTANT:
|
case ATTRIBUTE_CLASS_CONSTANT:
|
||||||
_result.SetTo(value->constant);
|
_result.SetTo(value->constant);
|
||||||
|
*_type = NULL;
|
||||||
return B_OK;
|
return B_OK;
|
||||||
|
|
||||||
case ATTRIBUTE_CLASS_REFERENCE:
|
case ATTRIBUTE_CLASS_REFERENCE:
|
||||||
@@ -725,28 +730,50 @@ DwarfFile::EvaluateDynamicValue(CompilationUnit* unit,
|
|||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
|
|
||||||
const ConstantAttributeValue* constantValue = NULL;
|
const ConstantAttributeValue* constantValue = NULL;
|
||||||
|
DIEType* type = NULL;
|
||||||
|
|
||||||
switch (entry->Tag()) {
|
switch (entry->Tag()) {
|
||||||
case DW_TAG_constant:
|
case DW_TAG_constant:
|
||||||
constantValue = dynamic_cast<DIEConstant*>(entry)
|
{
|
||||||
->ConstValue();
|
DIEConstant* constantEntry
|
||||||
|
= dynamic_cast<DIEConstant*>(entry);
|
||||||
|
constantValue = constantEntry->ConstValue();
|
||||||
|
type = constantEntry->GetType();
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case DW_TAG_enumerator:
|
case DW_TAG_enumerator:
|
||||||
constantValue = dynamic_cast<DIEEnumerator*>(entry)
|
constantValue = dynamic_cast<DIEEnumerator*>(entry)
|
||||||
->ConstValue();
|
->ConstValue();
|
||||||
|
if (DIEEnumerationType* enumerationType
|
||||||
|
= dynamic_cast<DIEEnumerationType*>(
|
||||||
|
entry->Parent())) {
|
||||||
|
type = enumerationType->GetType();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case DW_TAG_formal_parameter:
|
case DW_TAG_formal_parameter:
|
||||||
constantValue = dynamic_cast<DIEFormalParameter*>(entry)
|
{
|
||||||
->ConstValue();
|
DIEFormalParameter* parameterEntry
|
||||||
|
= dynamic_cast<DIEFormalParameter*>(entry);
|
||||||
|
constantValue = parameterEntry->ConstValue();
|
||||||
|
type = parameterEntry->GetType();
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case DW_TAG_template_value_parameter:
|
case DW_TAG_template_value_parameter:
|
||||||
constantValue = dynamic_cast<DIETemplateValueParameter*>(
|
{
|
||||||
entry)->ConstValue();
|
DIETemplateValueParameter* parameterEntry
|
||||||
|
= dynamic_cast<DIETemplateValueParameter*>(entry);
|
||||||
|
constantValue = parameterEntry->ConstValue();
|
||||||
|
type = parameterEntry->GetType();
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case DW_TAG_variable:
|
case DW_TAG_variable:
|
||||||
constantValue = dynamic_cast<DIEVariable*>(entry)
|
{
|
||||||
->ConstValue();
|
DIEVariable* variableEntry
|
||||||
|
= dynamic_cast<DIEVariable*>(entry);
|
||||||
|
constantValue = variableEntry->ConstValue();
|
||||||
|
type = variableEntry->GetType();
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
}
|
}
|
||||||
@@ -754,8 +781,14 @@ DwarfFile::EvaluateDynamicValue(CompilationUnit* unit,
|
|||||||
if (constantValue == NULL || !constantValue->IsValid())
|
if (constantValue == NULL || !constantValue->IsValid())
|
||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
|
|
||||||
return EvaluateConstantValue(unit, subprogramEntry, constantValue,
|
status_t error = EvaluateConstantValue(unit, subprogramEntry,
|
||||||
targetInterface, instructionPointer, framePointer, _result);
|
constantValue, targetInterface, instructionPointer,
|
||||||
|
framePointer, _result);
|
||||||
|
if (error != B_OK)
|
||||||
|
return error;
|
||||||
|
|
||||||
|
*_type = type;
|
||||||
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
case ATTRIBUTE_CLASS_BLOCK:
|
case ATTRIBUTE_CLASS_BLOCK:
|
||||||
@@ -768,6 +801,7 @@ DwarfFile::EvaluateDynamicValue(CompilationUnit* unit,
|
|||||||
return error;
|
return error;
|
||||||
|
|
||||||
_result.SetTo(result);
|
_result.SetTo(result);
|
||||||
|
*_type = NULL;
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -962,6 +996,9 @@ DwarfFile::_FinishCompilationUnit(CompilationUnit* unit)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// set the compilation unit's source language
|
||||||
|
unit->SetSourceLanguage(entryInitInfo.languageInfo);
|
||||||
|
|
||||||
// resolve the compilation unit's address range list
|
// resolve the compilation unit's address range list
|
||||||
if (TargetAddressRangeList* ranges = ResolveRangeList(unit,
|
if (TargetAddressRangeList* ranges = ResolveRangeList(unit,
|
||||||
unit->UnitEntry()->AddressRangesOffset())) {
|
unit->UnitEntry()->AddressRangesOffset())) {
|
||||||
|
|||||||
@@ -68,6 +68,9 @@ public:
|
|||||||
target_addr_t objectPointer,
|
target_addr_t objectPointer,
|
||||||
target_addr_t framePointer,
|
target_addr_t framePointer,
|
||||||
ValueLocation& _result);
|
ValueLocation& _result);
|
||||||
|
// The returned location will have DWARF
|
||||||
|
// semantics regarding register numbers and
|
||||||
|
// bit offsets/sizes (cf. bit pieces).
|
||||||
|
|
||||||
status_t EvaluateConstantValue(CompilationUnit* unit,
|
status_t EvaluateConstantValue(CompilationUnit* unit,
|
||||||
DIESubprogram* subprogramEntry,
|
DIESubprogram* subprogramEntry,
|
||||||
@@ -82,7 +85,7 @@ public:
|
|||||||
const DwarfTargetInterface* targetInterface,
|
const DwarfTargetInterface* targetInterface,
|
||||||
target_addr_t instructionPointer,
|
target_addr_t instructionPointer,
|
||||||
target_addr_t framePointer,
|
target_addr_t framePointer,
|
||||||
BVariant& _result);
|
BVariant& _result, DIEType** _type = NULL);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct ExpressionEvaluationContext;
|
struct ExpressionEvaluationContext;
|
||||||
|
|||||||
Reference in New Issue
Block a user