2009-06-22 01:13:57 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
|
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
|
|
|
#ifndef DISASSEMBLED_CODE_H
|
|
|
|
#define DISASSEMBLED_CODE_H
|
|
|
|
|
|
|
|
#include <ObjectList.h>
|
|
|
|
|
|
|
|
#include "SourceCode.h"
|
|
|
|
|
|
|
|
|
|
|
|
class BString;
|
|
|
|
class ContiguousStatement;
|
|
|
|
|
|
|
|
|
|
|
|
class DisassembledCode : public SourceCode {
|
|
|
|
public:
|
|
|
|
DisassembledCode();
|
|
|
|
~DisassembledCode();
|
|
|
|
|
|
|
|
virtual int32 CountLines() const;
|
|
|
|
virtual const char* LineAt(int32 index) const;
|
|
|
|
|
|
|
|
virtual int32 CountStatements() const;
|
|
|
|
virtual Statement* StatementAt(int32 index) const;
|
|
|
|
virtual Statement* StatementAtLine(int32 index) const;
|
|
|
|
virtual Statement* StatementAtAddress(target_addr_t address) const;
|
|
|
|
|
2009-06-22 21:51:32 +00:00
|
|
|
virtual TargetAddressRange StatementAddressRange() const;
|
|
|
|
|
2009-06-22 01:13:57 +00:00
|
|
|
public:
|
|
|
|
bool AddCommentLine(const BString& line);
|
|
|
|
bool AddInstructionLine(const BString& line,
|
|
|
|
target_addr_t address, target_size_t size,
|
|
|
|
bool breakpointAllowed);
|
|
|
|
// instructions must be added in
|
|
|
|
// ascending address order
|
|
|
|
|
|
|
|
private:
|
|
|
|
struct Line;
|
|
|
|
|
|
|
|
typedef BObjectList<Line> LineList;
|
|
|
|
typedef BObjectList<ContiguousStatement> StatementList;
|
|
|
|
|
|
|
|
private:
|
|
|
|
bool _AddLine(const BString& line,
|
|
|
|
ContiguousStatement* statement);
|
|
|
|
static int _CompareAddressStatement(
|
|
|
|
const target_addr_t* address,
|
|
|
|
const ContiguousStatement* statement);
|
|
|
|
|
|
|
|
private:
|
|
|
|
LineList fLines;
|
|
|
|
StatementList fStatements;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif // DISASSEMBLED_CODE_H
|