xref: /haiku/src/kits/debugger/model/Statement.cpp (revision fce4895d1884da5ae6fb299d23c735c598e690b1)
1 /*
2  * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
3  * Distributed under the terms of the MIT License.
4  */
5 
6 #include "Statement.h"
7 
8 
9 // #pragma mark - Statement
10 
11 
~Statement()12 Statement::~Statement()
13 {
14 }
15 
16 
17 // #pragma mark - AbstractStatement
18 
19 
AbstractStatement(const SourceLocation & start)20 AbstractStatement::AbstractStatement(const SourceLocation& start)
21 	:
22 	fStart(start)
23 {
24 }
25 
26 
27 SourceLocation
StartSourceLocation() const28 AbstractStatement::StartSourceLocation() const
29 {
30 	return fStart;
31 }
32 
33 
34 // #pragma mark - ContiguousStatement
35 
36 
ContiguousStatement(const SourceLocation & start,const TargetAddressRange & range)37 ContiguousStatement::ContiguousStatement(const SourceLocation& start,
38 	const TargetAddressRange& range)
39 	:
40 	AbstractStatement(start),
41 	fRange(range)
42 {
43 }
44 
45 
46 TargetAddressRange
CoveringAddressRange() const47 ContiguousStatement::CoveringAddressRange() const
48 {
49 	return fRange;
50 }
51 
52 
53 int32
CountAddressRanges() const54 ContiguousStatement::CountAddressRanges() const
55 {
56 	return 1;
57 }
58 
59 
60 TargetAddressRange
AddressRangeAt(int32 index) const61 ContiguousStatement::AddressRangeAt(int32 index) const
62 {
63 	return index == 0 ? fRange : TargetAddressRange();
64 }
65 
66 
67 bool
ContainsAddress(target_addr_t address) const68 ContiguousStatement::ContainsAddress(target_addr_t address) const
69 {
70 	return fRange.Contains(address);
71 }
72