Debugger: Split into core library and application.
[haiku.git] / src / kits / debugger / debug_info / DwarfFunctionDebugInfo.cpp
blob68b9fb3afaf3541c0083ff4f7f6aacf9e3aabc37
1 /*
2 * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Distributed under the terms of the MIT License.
4 */
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),
24 fName(name),
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;
53 target_addr_t
54 DwarfFunctionDebugInfo::Address() const
56 return fAddressRanges->LowestAddress() + fImageDebugInfo->RelocationDelta();
60 target_size_t
61 DwarfFunctionDebugInfo::Size() const
63 return fAddressRanges->CoveringRange().Size();
67 const BString&
68 DwarfFunctionDebugInfo::Name() const
70 return fName;
74 const BString&
75 DwarfFunctionDebugInfo::PrettyName() const
77 return fName;
81 bool
82 DwarfFunctionDebugInfo::IsMain() const
84 return fSubprogramEntry->IsMain();
88 LocatableFile*
89 DwarfFunctionDebugInfo::SourceFile() const
91 return fSourceFile;
95 SourceLocation
96 DwarfFunctionDebugInfo::SourceStartLocation() const
98 return fSourceLocation;
102 SourceLocation
103 DwarfFunctionDebugInfo::SourceEndLocation() const
105 return fSourceLocation;