2 * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Distributed under the terms of the MIT License.
5 #ifndef DISASSEMBLED_CODE_H
6 #define DISASSEMBLED_CODE_H
9 #include <ObjectList.h>
11 #include "SourceCode.h"
15 class ContiguousStatement
;
18 class DisassembledCode
: public SourceCode
{
20 DisassembledCode(SourceLanguage
* language
);
24 virtual void Unlock();
26 virtual SourceLanguage
* GetSourceLanguage() const;
28 virtual bool GetStatementLocationRange(
29 const SourceLocation
& location
,
30 SourceLocation
& _start
,
31 SourceLocation
& _end
) const;
33 virtual LocatableFile
* GetSourceFile() const;
35 Statement
* StatementAtAddress(target_addr_t address
) const;
36 Statement
* StatementAtLocation(
37 const SourceLocation
& location
) const;
38 TargetAddressRange
StatementAddressRange() const;
41 virtual int32
CountLines() const;
42 virtual const char* LineAt(int32 index
) const;
43 virtual int32
LineLengthAt(int32 index
) const;
46 bool AddCommentLine(const BString
& line
);
47 bool AddInstructionLine(const BString
& line
,
48 target_addr_t address
, target_size_t size
);
49 // instructions must be added in
50 // ascending address order
55 typedef BObjectList
<Line
> LineList
;
56 typedef BObjectList
<ContiguousStatement
> StatementList
;
59 bool _AddLine(const BString
& line
,
60 ContiguousStatement
* statement
);
61 static int _CompareAddressStatement(
62 const target_addr_t
* address
,
63 const ContiguousStatement
* statement
);
66 SourceLanguage
* fLanguage
;
68 StatementList fStatements
;
72 #endif // DISASSEMBLED_CODE_H