* 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:
parent
796f1b412c
commit
7d82c6dd73
@ -80,6 +80,13 @@ CompilationUnit::SetUnitEntry(DIECompileUnitBase* entry)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
CompilationUnit::SetSourceLanguage(const SourceLanguageInfo* language)
|
||||
{
|
||||
fSourceLanguage = language;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
CompilationUnit::SetAddressRanges(TargetAddressRangeList* ranges)
|
||||
{
|
||||
|
@ -18,6 +18,7 @@
|
||||
class AbbreviationTable;
|
||||
class DebugInfoEntry;
|
||||
class DIECompileUnitBase;
|
||||
class SourceLanguageInfo;
|
||||
class TargetAddressRangeList;
|
||||
|
||||
|
||||
@ -53,6 +54,11 @@ public:
|
||||
DIECompileUnitBase* UnitEntry() const { return fUnitEntry; }
|
||||
void SetUnitEntry(DIECompileUnitBase* entry);
|
||||
|
||||
const SourceLanguageInfo* SourceLanguage() const
|
||||
{ return fSourceLanguage; }
|
||||
void SetSourceLanguage(
|
||||
const SourceLanguageInfo* language);
|
||||
|
||||
TargetAddressRangeList* AddressRanges() const
|
||||
{ return fAddressRanges; }
|
||||
void SetAddressRanges(
|
||||
@ -91,6 +97,7 @@ private:
|
||||
off_t fAbbreviationOffset;
|
||||
AbbreviationTable* fAbbreviationTable;
|
||||
DIECompileUnitBase* fUnitEntry;
|
||||
const SourceLanguageInfo* fSourceLanguage;
|
||||
TargetAddressRangeList* fAddressRanges;
|
||||
Array<DebugInfoEntry*> fEntries;
|
||||
Array<off_t> fEntryOffsets;
|
||||
|
@ -58,6 +58,9 @@ public:
|
||||
target_addr_t& _result);
|
||||
status_t EvaluateLocation(const void* expression,
|
||||
size_t size, ValueLocation& _location);
|
||||
// The returned location will have DWARF
|
||||
// semantics regarding register numbers and
|
||||
// bit offsets/sizes (cf. bit pieces).
|
||||
|
||||
private:
|
||||
struct EvaluationException;
|
||||
|
@ -702,14 +702,19 @@ DwarfFile::EvaluateDynamicValue(CompilationUnit* unit,
|
||||
DIESubprogram* subprogramEntry, const DynamicAttributeValue* value,
|
||||
const DwarfTargetInterface* targetInterface,
|
||||
target_addr_t instructionPointer, target_addr_t framePointer,
|
||||
BVariant& _result)
|
||||
BVariant& _result, DIEType** _type)
|
||||
{
|
||||
if (!value->IsValid())
|
||||
return B_BAD_VALUE;
|
||||
|
||||
DIEType* dummyType;
|
||||
if (_type == NULL)
|
||||
_type = &dummyType;
|
||||
|
||||
switch (value->attributeClass) {
|
||||
case ATTRIBUTE_CLASS_CONSTANT:
|
||||
_result.SetTo(value->constant);
|
||||
*_type = NULL;
|
||||
return B_OK;
|
||||
|
||||
case ATTRIBUTE_CLASS_REFERENCE:
|
||||
@ -725,28 +730,50 @@ DwarfFile::EvaluateDynamicValue(CompilationUnit* unit,
|
||||
return B_BAD_VALUE;
|
||||
|
||||
const ConstantAttributeValue* constantValue = NULL;
|
||||
DIEType* type = NULL;
|
||||
|
||||
switch (entry->Tag()) {
|
||||
case DW_TAG_constant:
|
||||
constantValue = dynamic_cast<DIEConstant*>(entry)
|
||||
->ConstValue();
|
||||
{
|
||||
DIEConstant* constantEntry
|
||||
= dynamic_cast<DIEConstant*>(entry);
|
||||
constantValue = constantEntry->ConstValue();
|
||||
type = constantEntry->GetType();
|
||||
break;
|
||||
}
|
||||
case DW_TAG_enumerator:
|
||||
constantValue = dynamic_cast<DIEEnumerator*>(entry)
|
||||
->ConstValue();
|
||||
if (DIEEnumerationType* enumerationType
|
||||
= dynamic_cast<DIEEnumerationType*>(
|
||||
entry->Parent())) {
|
||||
type = enumerationType->GetType();
|
||||
}
|
||||
break;
|
||||
case DW_TAG_formal_parameter:
|
||||
constantValue = dynamic_cast<DIEFormalParameter*>(entry)
|
||||
->ConstValue();
|
||||
{
|
||||
DIEFormalParameter* parameterEntry
|
||||
= dynamic_cast<DIEFormalParameter*>(entry);
|
||||
constantValue = parameterEntry->ConstValue();
|
||||
type = parameterEntry->GetType();
|
||||
break;
|
||||
}
|
||||
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;
|
||||
}
|
||||
case DW_TAG_variable:
|
||||
constantValue = dynamic_cast<DIEVariable*>(entry)
|
||||
->ConstValue();
|
||||
{
|
||||
DIEVariable* variableEntry
|
||||
= dynamic_cast<DIEVariable*>(entry);
|
||||
constantValue = variableEntry->ConstValue();
|
||||
type = variableEntry->GetType();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return B_BAD_VALUE;
|
||||
}
|
||||
@ -754,8 +781,14 @@ DwarfFile::EvaluateDynamicValue(CompilationUnit* unit,
|
||||
if (constantValue == NULL || !constantValue->IsValid())
|
||||
return B_BAD_VALUE;
|
||||
|
||||
return EvaluateConstantValue(unit, subprogramEntry, constantValue,
|
||||
targetInterface, instructionPointer, framePointer, _result);
|
||||
status_t error = EvaluateConstantValue(unit, subprogramEntry,
|
||||
constantValue, targetInterface, instructionPointer,
|
||||
framePointer, _result);
|
||||
if (error != B_OK)
|
||||
return error;
|
||||
|
||||
*_type = type;
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
case ATTRIBUTE_CLASS_BLOCK:
|
||||
@ -768,6 +801,7 @@ DwarfFile::EvaluateDynamicValue(CompilationUnit* unit,
|
||||
return error;
|
||||
|
||||
_result.SetTo(result);
|
||||
*_type = NULL;
|
||||
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
|
||||
if (TargetAddressRangeList* ranges = ResolveRangeList(unit,
|
||||
unit->UnitEntry()->AddressRangesOffset())) {
|
||||
|
@ -68,6 +68,9 @@ public:
|
||||
target_addr_t objectPointer,
|
||||
target_addr_t framePointer,
|
||||
ValueLocation& _result);
|
||||
// The returned location will have DWARF
|
||||
// semantics regarding register numbers and
|
||||
// bit offsets/sizes (cf. bit pieces).
|
||||
|
||||
status_t EvaluateConstantValue(CompilationUnit* unit,
|
||||
DIESubprogram* subprogramEntry,
|
||||
@ -82,7 +85,7 @@ public:
|
||||
const DwarfTargetInterface* targetInterface,
|
||||
target_addr_t instructionPointer,
|
||||
target_addr_t framePointer,
|
||||
BVariant& _result);
|
||||
BVariant& _result, DIEType** _type = NULL);
|
||||
|
||||
private:
|
||||
struct ExpressionEvaluationContext;
|
||||
|
Loading…
Reference in New Issue
Block a user