2 * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Distributed under the terms of the MIT License.
6 #include "DwarfFunctionDebugInfo.h"
8 #include "DebugInfoEntries.h"
9 #include "DwarfImageDebugInfo.h"
10 #include "LocatableFile.h"
11 #include "TargetAddressRangeList.h"
14 DwarfFunctionDebugInfo::DwarfFunctionDebugInfo(
15 DwarfImageDebugInfo
* imageDebugInfo
, CompilationUnit
* compilationUnit
,
16 DIESubprogram
* subprogramEntry
, TargetAddressRangeList
* addressRanges
,
17 const BString
& name
, LocatableFile
* sourceFile
,
18 const SourceLocation
& sourceLocation
)
20 fImageDebugInfo(imageDebugInfo
),
21 fCompilationUnit(compilationUnit
),
22 fSubprogramEntry(subprogramEntry
),
23 fAddressRanges(addressRanges
),
25 fSourceFile(sourceFile
),
26 fSourceLocation(sourceLocation
)
28 fImageDebugInfo
->AcquireReference();
29 fAddressRanges
->AcquireReference();
31 if (fSourceFile
!= NULL
)
32 fSourceFile
->AcquireReference();
36 DwarfFunctionDebugInfo::~DwarfFunctionDebugInfo()
38 if (fSourceFile
!= NULL
)
39 fSourceFile
->ReleaseReference();
41 fAddressRanges
->ReleaseReference();
42 fImageDebugInfo
->ReleaseReference();
46 SpecificImageDebugInfo
*
47 DwarfFunctionDebugInfo::GetSpecificImageDebugInfo() const
49 return fImageDebugInfo
;
54 DwarfFunctionDebugInfo::Address() const
56 return fAddressRanges
->LowestAddress() + fImageDebugInfo
->RelocationDelta();
61 DwarfFunctionDebugInfo::Size() const
63 return fAddressRanges
->CoveringRange().Size();
68 DwarfFunctionDebugInfo::Name() const
75 DwarfFunctionDebugInfo::PrettyName() const
82 DwarfFunctionDebugInfo::IsMain() const
84 return fSubprogramEntry
->IsMain();
89 DwarfFunctionDebugInfo::SourceFile() const
96 DwarfFunctionDebugInfo::SourceStartLocation() const
98 return fSourceLocation
;
103 DwarfFunctionDebugInfo::SourceEndLocation() const
105 return fSourceLocation
;