DIESubprogram: Add parsing for main subprogram attribute.

- Will be used later to recognize the main function of a given program.
This commit is contained in:
Rene Gollent
2013-05-28 22:36:55 -04:00
parent cc428f5bbf
commit 54a0525eca
2 changed files with 22 additions and 0 deletions
@@ -1840,6 +1840,7 @@ DIESubprogram::DIESubprogram()
fAddressClass(0), fAddressClass(0),
fPrototyped(false), fPrototyped(false),
fInline(DW_INL_not_inlined), fInline(DW_INL_not_inlined),
fMain(false),
fArtificial(false), fArtificial(false),
fCallingConvention(DW_CC_normal) fCallingConvention(DW_CC_normal)
{ {
@@ -1893,6 +1894,9 @@ DIESubprogram::AddChild(DebugInfoEntry* child)
case DW_TAG_template_value_parameter: case DW_TAG_template_value_parameter:
fTemplateValueParameters.Add(child); fTemplateValueParameters.Add(child);
return B_OK; return B_OK;
case DW_TAG_GNU_call_site:
fCallSites.Add(child);
return B_OK;
default: default:
return DIEDeclaredNamedBase::AddChild(child); return DIEDeclaredNamedBase::AddChild(child);
} }
@@ -2018,6 +2022,15 @@ DIESubprogram::AddAttribute_calling_convention(uint16 attributeName,
} }
status_t
DIESubprogram::AddAttribute_main_subprogram(uint16 attributeName,
const AttributeValue& value)
{
fMain = true;
return B_OK;
}
// #pragma mark - DIETemplateTypeParameter // #pragma mark - DIETemplateTypeParameter
@@ -1225,12 +1225,15 @@ public:
{ return fTemplateTypeParameters; } { return fTemplateTypeParameters; }
const DebugInfoEntryList TemplateValueParameters() const const DebugInfoEntryList TemplateValueParameters() const
{ return fTemplateValueParameters; } { return fTemplateValueParameters; }
const DebugInfoEntryList CallSites() const
{ return fCallSites; }
bool IsPrototyped() const { return fPrototyped; } bool IsPrototyped() const { return fPrototyped; }
uint8 Inline() const { return fInline; } uint8 Inline() const { return fInline; }
bool IsArtificial() const { return fArtificial; } bool IsArtificial() const { return fArtificial; }
uint8 CallingConvention() const uint8 CallingConvention() const
{ return fCallingConvention; } { return fCallingConvention; }
bool IsMain() const { return fMain; }
DIEType* ReturnType() const { return fReturnType; } DIEType* ReturnType() const { return fReturnType; }
@@ -1264,6 +1267,10 @@ public:
virtual status_t AddAttribute_calling_convention( virtual status_t AddAttribute_calling_convention(
uint16 attributeName, uint16 attributeName,
const AttributeValue& value); const AttributeValue& value);
virtual status_t AddAttribute_main_subprogram(
uint16 attributeName,
const AttributeValue& value);
protected: protected:
DebugInfoEntryList fParameters; DebugInfoEntryList fParameters;
@@ -1271,6 +1278,7 @@ protected:
DebugInfoEntryList fBlocks; DebugInfoEntryList fBlocks;
DebugInfoEntryList fTemplateTypeParameters; DebugInfoEntryList fTemplateTypeParameters;
DebugInfoEntryList fTemplateValueParameters; DebugInfoEntryList fTemplateValueParameters;
DebugInfoEntryList fCallSites;
target_addr_t fLowPC; target_addr_t fLowPC;
target_addr_t fHighPC; target_addr_t fHighPC;
off_t fAddressRangesOffset; off_t fAddressRangesOffset;
@@ -1281,6 +1289,7 @@ protected:
uint8 fAddressClass; uint8 fAddressClass;
bool fPrototyped; bool fPrototyped;
uint8 fInline; uint8 fInline;
bool fMain;
bool fArtificial; bool fArtificial;
uint8 fCallingConvention; uint8 fCallingConvention;