#ifndef armdbg__h
#define armdbg__h
#include <stddef.h>
#include "host.h"
#include "msg.h"
typedef unsigned32 ARMaddress;
typedef unsigned32 ARMword;
typedef unsigned16 ARMhword;
#include "dbg_conf.h"
#include "dbg_rdi.h"
#ifdef __cplusplus
extern "C"
{
#endif
typedef unsigned char Dbg_Byte;
typedef int Dbg_Error;
typedef struct Dbg_MCState Dbg_MCState;
#define Error_OK 0
#define Dbg_Error_Base 0x1000
#define Dbg_Error_Limit 0x2000
#define DbgError(n) ((Dbg_Error)(Dbg_Error_Base+(n)))
#define Dbg_Err_OK Error_OK
#define Dbg_Err_Interrupted DbgError(1)
#define Dbg_Err_Overflow DbgError(2)
#define Dbg_Err_FileNotFound DbgError(3)
#define Dbg_Err_ActivationNotPresent DbgError(4)
#define Dbg_Err_OutOfHeap DbgError(5)
#define Dbg_Err_TypeNotSimple DbgError(6)
#define Dbg_Err_BufferFull DbgError(7)
#define Dbg_Err_AtStackBase DbgError(8)
#define Dbg_Err_AtStackTop DbgError(9)
#define Dbg_Err_DbgTableFormat DbgError(10)
#define Dbg_Err_NotVariable DbgError(11)
#define Dbg_Err_NoSuchBreakPoint DbgError(12)
#define Dbg_Err_NoSuchWatchPoint DbgError(13)
#define Dbg_Err_FileLineNotFound DbgError(14)
#define Dbg_Err_DbgTableVersion DbgError(15)
#define Dbg_Err_NoSuchPath DbgError(16)
#define Dbg_Err_StateChanged DbgError(17)
#define Dbg_Err_SoftInitialiseError DbgError(18)
#define Dbg_Err_CoProRegNotWritable DbgError(19)
#define Dbg_Err_NotInHistory DbgError(20)
#define Dbg_Err_ContextSyntax DbgError(21)
#define Dbg_Err_ContextNoLine DbgError(22)
#define Dbg_Err_ContextTwoLines DbgError(23)
#define Dbg_Err_VarReadOnly DbgError(24)
#define Dbg_Err_FileNewerThanImage DbgError(25)
#define Dbg_Err_NotFound DbgError(26)
typedef struct Dbg_BufDesc Dbg_BufDesc;
typedef void Dbg_BufferFullProc(Dbg_BufDesc *bd);
struct Dbg_BufDesc {
char *buffer;
size_t size,
filled;
Dbg_BufferFullProc *p;
void *arg;
};
#define Dbg_InitBufDesc(bd, buf, bytes) \
((bd).buffer = (buf), (bd).size = (bytes), (bd).filled = 0,\
(bd).p = NULL, (bd).arg = NULL)
#define Dbg_InitBufDesc_P(bd, buf, bytes, fn, a) \
((bd).buffer = (buf), (bd).size = (bytes), (bd).filled = 0,\
(bd).p = (fn), (bd).arg = (a))
Dbg_Error Dbg_StringToBuf(Dbg_BufDesc *buf, char const *s);
Dbg_Error Dbg_BufPrintf(Dbg_BufDesc *buf, char const *form, ...);
#ifdef NLS
Dbg_Error Dbg_MsgToBuf(Dbg_BufDesc *buf, msg_t t);
Dbg_Error Dbg_BufMsgPrintf(Dbg_BufDesc *buf, msg_t form, ...);
#else
#define Dbg_MsgToBuf Dbg_StringToBuf
#define Dbg_BufMsgPrintf Dbg_BufPrintf
#endif
Dbg_Error Dbg_CharToBuf(Dbg_BufDesc *buf, int ch);
int Dbg_CIStrCmp(char const *s1, char const *s2);
int Dbg_CIStrnCmp(char const *s1, char const *s2, size_t n);
void Dbg_ErrorToChars(Dbg_MCState *state, Dbg_Error err, Dbg_BufDesc *buf);
typedef int Dbg_RDIResetCheckProc(int);
typedef struct Dbg_CoProDesc Dbg_CoProDesc;
typedef Dbg_Error Dbg_CoProFoundProc(Dbg_MCState *state, int cpno, Dbg_CoProDesc const *cpd);
typedef struct RDIProcVec RDIProcVec;
Dbg_Error Dbg_RequestReset(Dbg_MCState *);
Dbg_Error Dbg_Initialise(
Dbg_ConfigBlock *config, Dbg_HostosInterface const *i,
Dbg_RDIResetCheckProc *checkreset, Dbg_CoProFoundProc *coprofound,
RDIProcVec const *rdi, Dbg_MCState **statep);
void Dbg_Finalise(Dbg_MCState *state, bool targetdead);
typedef struct {
char name[16];
RDI_MemDescr md;
RDI_MemAccessStats a;
} Dbg_MemStats;
typedef struct Dbg_SymTable Dbg_SymTable;
typedef struct Dbg_ImageFragmentDesc {
ARMaddress base, limit;
} Dbg_ImageFragmentDesc;
typedef enum {
Dbg_Lang_None,
Dbg_Lang_C,
Dbg_Lang_Pascal,
Dbg_Lang_Fortran,
Dbg_Lang_Asm,
Dbg_Lang_Cpp
} Dbg_Lang;
typedef struct Dbg_ImageDesc {
Dbg_Lang lang;
int executable;
ARMaddress robase, rolimit, rwbase, rwlimit;
int nfrags;
Dbg_ImageFragmentDesc *fragments;
char *name;
} Dbg_ImageDesc;
Dbg_ImageDesc *Dbg_ImageAreas(Dbg_SymTable *st);
Dbg_SymTable *Dbg_LastImage(Dbg_MCState *state);
Dbg_SymTable *Dbg_NewSymTable(Dbg_MCState *state, const char *name);
Dbg_Error Dbg_ReadSymbols(Dbg_MCState *state, const char *filename, Dbg_SymTable **st);
typedef struct Dbg_SymInfo {
int isize;
ARMaddress addr;
char *name;
} Dbg_SymInfo;
Dbg_SymInfo *Dbg_AsmSym(Dbg_SymTable *st, ARMaddress addr);
int32 Dbg_AsmAddr(Dbg_SymTable *st, int32 line);
int32 Dbg_AsmLine(Dbg_SymTable *st, ARMaddress addr);
int32 Dbg_AsmLinesInRange(Dbg_SymTable *st, ARMaddress start, ARMaddress end);
Dbg_Error Dbg_LoadFile(Dbg_MCState *state, const char *filename, Dbg_SymTable **st);
Dbg_Error Dbg_CallGLoadFile(Dbg_MCState *state, const char *filename, Dbg_SymTable **st);
typedef void Dbg_ImageLoadProc(Dbg_MCState *, Dbg_SymTable *);
Dbg_Error Dbg_OnImageLoad(Dbg_MCState *, Dbg_ImageLoadProc *);
Dbg_Error Dbg_LoadAgent(Dbg_MCState *state, const char *filename);
Dbg_Error Dbg_RelocateSymbols(Dbg_SymTable *st, ARMaddress reloc);
Dbg_Error Dbg_DeleteSymbols(Dbg_MCState *state, Dbg_SymTable **st);
typedef enum Dbg_LLSymType {
llst_code,
llst_code16,
llst_data,
llst_const,
llst_unknown,
llst_max
} Dbg_LLSymType;
typedef Dbg_Error Dbg_SymProc(
Dbg_MCState *state,
const char *symbol, Dbg_LLSymType symtype, ARMaddress value,
void *arg);
Dbg_Error Dbg_EnumerateLowLevelSymbols(
Dbg_MCState *state, const char *match, Dbg_SymProc *p,
void *arg);
typedef struct Dbg_RegSet {
ARMword
user[15],
pc,
psr,
fiq[7],
spsr_fiq,
irq[2],
spsr_irq,
svc[2],
spsr_svc,
abort[2],
spsr_abort,
undef[2],
spsr_undef;
} Dbg_RegSet;
#define Dbg_MM_User 1
#define Dbg_MM_FIQ 2
#define Dbg_MM_IRQ 4
#define Dbg_MM_SVC 8
#define Dbg_MM_Abort 0x10
#define Dbg_MM_Undef 0x20
#define Dbg_MM_System 0x40
Dbg_Error Dbg_ReadRegisters(Dbg_MCState *state, Dbg_RegSet *regs, int modemask);
Dbg_Error Dbg_WriteRegister(Dbg_MCState *state, int rno, int modemask, ARMword val);
int Dbg_StringToMode(const char *name);
int Dbg_ModeToModeMask(ARMword mode);
typedef enum { F_Single, F_Double, F_Extended, F_Packed,
F_Internal,
F_None } Dbg_FPType;
typedef struct { ARMword w[3]; } Dbg_TargetExtendedVal;
typedef struct { ARMword w[3]; } Dbg_TargetPackedVal;
typedef struct { ARMword w[2]; } Dbg_TargetDoubleVal;
typedef struct { ARMword w[1]; } Dbg_TargetFloatVal;
typedef union { Dbg_TargetExtendedVal e; Dbg_TargetPackedVal p;
Dbg_TargetDoubleVal d; Dbg_TargetFloatVal f; } Dbg_TargetFPVal;
#define TargetSizeof_Extended 12
#define TargetSizeof_Packed 12
#define TargetSizeof_Double 8
#define TargetSizeof_Float 4
typedef struct Dbg_FPRegVal {
Dbg_FPType type;
Dbg_TargetFPVal v;
} Dbg_FPRegVal;
typedef struct Dbg_FPRegSet {
Dbg_FPRegVal f[8];
ARMword fpsr, fpcr;
} Dbg_FPRegSet;
Dbg_Error Dbg_ReadFPRegisters(Dbg_MCState *state, Dbg_FPRegSet *regs);
Dbg_Error Dbg_WriteFPRegisters(Dbg_MCState *state, int32 mask, Dbg_FPRegSet *regs);
Dbg_Error Dbg_FPRegToDouble(DbleBin *d, Dbg_FPRegVal const *f);
void Dbg_DoubleToFPReg(Dbg_FPRegVal *f, DbleBin const *d);
#include "dbg_cp.h"
Dbg_Error Dbg_DescribeCoPro(Dbg_MCState *state, int cpnum, Dbg_CoProDesc *p);
Dbg_Error Dbg_DescribeCoPro_RDI(Dbg_MCState *state, int cpnum, Dbg_CoProDesc *p);
Dbg_Error Dbg_ReadCPRegisters(Dbg_MCState *state, int cpnum, ARMword *regs);
Dbg_Error Dbg_WriteCPRegisters(Dbg_MCState *state, int cpnum, int32 mask, ARMword *regs);
Dbg_Error Dbg_ReadWords(
Dbg_MCState *state,
ARMword *words, ARMaddress addr, unsigned count);
Dbg_Error Dbg_WriteWords(
Dbg_MCState *state,
ARMaddress addr, const ARMword *words, unsigned count);
Dbg_Error Dbg_ReadHalf(Dbg_MCState *state, ARMhword *val, ARMaddress addr);
Dbg_Error Dbg_WriteHalf(Dbg_MCState *state, ARMaddress addr, ARMword val);
Dbg_Error Dbg_ReadBytes(Dbg_MCState *state, Dbg_Byte *val, ARMaddress addr, unsigned count);
Dbg_Error Dbg_WriteBytes(Dbg_MCState *state, ARMaddress addr, const Dbg_Byte *val, unsigned count);
void Dbg_HostWords(Dbg_MCState *state, ARMword *words, unsigned wordcount);
ARMword Dbg_HostWord(Dbg_MCState *state, ARMword v);
ARMhword Dbg_HostHalf(Dbg_MCState *state, ARMword v);
typedef struct Dbg_LLPos {
Dbg_SymTable *st;
char *llsym;
ARMaddress offset;
} Dbg_LLPos;
typedef struct Dbg_File {
Dbg_SymTable *st;
char *file;
} Dbg_File;
typedef struct Dbg_Line {
unsigned32 line;
unsigned16 statement,
charpos;
} Dbg_Line;
typedef struct Dbg_FilePos {
Dbg_File f;
Dbg_Line line;
} Dbg_FilePos;
typedef struct Dbg_ProcDesc {
Dbg_File f;
char *name;
} Dbg_ProcDesc;
typedef struct Dbg_ProcPos {
Dbg_ProcDesc p;
Dbg_Line line;
} Dbg_ProcPos;
Dbg_Error Dbg_ProcDescToLine(Dbg_MCState *state, Dbg_ProcDesc *proc, Dbg_Line *line);
Dbg_Error Dbg_FilePosToProc(Dbg_MCState *state, const Dbg_FilePos *pos, char **procname);
Dbg_Error Dbg_AddressToProcPos(
Dbg_MCState *state, ARMaddress addr,
Dbg_ProcPos *pos);
Dbg_Error Dbg_AddressToLLPos(
Dbg_MCState *state, ARMaddress addr,
Dbg_LLPos *pos, Dbg_LLSymType *res_type, int system_names);
Dbg_Error Dbg_ProcPosToAddress(
Dbg_MCState *state, const Dbg_ProcPos *pos,
ARMaddress *res);
Dbg_Error Dbg_LLPosToAddress(
Dbg_MCState *state, const Dbg_LLPos *pos,
ARMaddress *res);
typedef struct {
ARMaddress start, end;
} Dbg_AddressRange;
typedef Dbg_Error Dbg_AddressRangeProc(void *arg, int32 first, int32 last, Dbg_AddressRange const *range);
Dbg_Error Dbg_MapAddressRangesForFileRange(
Dbg_MCState *state,
Dbg_SymTable *st, const char *f, int32 first, int32 last, Dbg_AddressRangeProc *p, void *arg);
typedef struct Dbg_Environment Dbg_Environment;
Dbg_Environment *Dbg_NewEnvironment(Dbg_MCState *state);
void Dbg_DeleteEnvironment(Dbg_MCState *state, Dbg_Environment *env);
Dbg_Error Dbg_StringToEnv(
Dbg_MCState *state, char *str, Dbg_Environment *resenv,
int forcontext, Dbg_Environment const *curenv);
Dbg_Error Dbg_ProcPosToEnvironment(
Dbg_MCState *state, const Dbg_ProcPos *pos, int activation,
const Dbg_Environment *current, Dbg_Environment *res);
typedef struct Dbg_DeclSpec Dbg_DeclSpec;
Dbg_Error Dbg_EnvToProcItem(
Dbg_MCState *state, Dbg_Environment const *env, Dbg_DeclSpec *proc);
Dbg_Error Dbg_ContainingEnvironment(
Dbg_MCState *state, const Dbg_Environment *context, Dbg_Environment *res);
#ifndef Dbg_TypeSpec_Defined
struct Dbg_DeclSpec { void *a; };
#ifdef CALLABLE_COMPILER
typedef void *Dbg_TypeSpec;
#define Dbg_T_Void xDbg_T_Void
#define Dbg_T_Bool xDbg_T_Bool
#define Dbg_T_SByte xDbg_T_SByte
#define Dbg_T_SHalf xDbg_T_Half
#define Dbg_T_SWord xDbg_T_SWord
#define Dbg_T_UByte xDbg_T_UByte
#define Dbg_T_UHalf xDbg_T_UHalf
#define Dbg_T_UWord xDbg_T_UWord
#define Dbg_T_Float xDbg_T_Float
#define Dbg_T_Double xDbg_T_Double
#define Dbg_T_LDouble xDbg_T_LDouble
#define Dbg_T_Complex xDbg_T_Complex
#define Dbg_T_DComplex xDbg_T_DComplex
#define Dbg_T_String xDbg_T_String
#define Dbg_T_Function xDbg_T_Function
#define Dbg_BasicType xDbg_BaiscType
#define Dbg_PrimitiveTypeToTypeSpec xDbg_PrimitiveTypeToTypeSpec
#else
typedef struct Dbg_TypeSpec Dbg_TypeSpec;
struct Dbg_TypeSpec { void *a; int32 b; };
#endif
typedef enum {
Dbg_T_Void,
Dbg_T_Bool,
Dbg_T_SByte,
Dbg_T_SHalf,
Dbg_T_SWord,
Dbg_T_UByte,
Dbg_T_UHalf,
Dbg_T_UWord,
Dbg_T_Float,
Dbg_T_Double,
Dbg_T_LDouble,
Dbg_T_Complex,
Dbg_T_DComplex,
Dbg_T_String,
Dbg_T_Function
} Dbg_BasicType;
#endif
void Dbg_PrimitiveTypeToTypeSpec(Dbg_TypeSpec *ts, Dbg_BasicType t);
bool Dbg_TypeIsIntegral(Dbg_TypeSpec const *ts);
bool Dbg_TypeIsPointer(Dbg_TypeSpec const *ts);
bool Dbg_TypeIsFunction(Dbg_TypeSpec const *ts);
bool Dbg_PruneType(Dbg_TypeSpec *tsres, Dbg_TypeSpec const *ts);
typedef Dbg_Error Dbg_FileProc(Dbg_MCState *state, const char *name, const Dbg_DeclSpec *procdef, void *arg);
Dbg_Error Dbg_EnumerateFiles(Dbg_MCState *state, Dbg_SymTable *st, Dbg_FileProc *p, void *arg);
typedef enum {
ds_Invalid,
ds_Type,
ds_Var,
ds_Proc,
ds_Enum,
ds_Function,
ds_Label
} Dbg_DeclSort;
Dbg_DeclSort Dbg_SortOfDeclSpec(Dbg_DeclSpec const *decl);
char *Dbg_NameOfDeclSpec(Dbg_DeclSpec const *decl);
Dbg_TypeSpec Dbg_TypeSpecOfDeclSpec(Dbg_DeclSpec const *decl);
typedef enum {
cs_None,
cs_Extern,
cs_Static,
cs_Auto,
cs_Reg,
cs_Var,
cs_Farg,
cs_Fcarg,
cs_Local,
cs_Filtered,
cs_Globalreg
} Dbg_StgClass;
Dbg_StgClass Dbg_StgClassOfDeclSpec(Dbg_DeclSpec const *decl);
bool Dbg_VarsAtSameAddress(Dbg_DeclSpec const *d1, Dbg_DeclSpec const *d2);
bool Dbg_VarsDecribedForDeclSpec(Dbg_DeclSpec const *decl);
int Dbg_ArgCountOfDeclSpec(Dbg_DeclSpec const *decl);
typedef struct Dbg_DComplex { DbleBin r, i; } Dbg_DComplex;
typedef union Dbg_ConstantVal {
int32 l;
unsigned32 u;
DbleBin d;
Dbg_DComplex fc;
ARMaddress a;
char *s;
} Dbg_ConstantVal;
typedef struct Dbg_Constant {
Dbg_TypeSpec type;
Dbg_ConstantVal val;
} Dbg_Constant;
typedef enum Dbg_ValueSort {
vs_register,
vs_store,
vs_constant,
vs_local,
vs_filtered,
vs_none,
vs_error
} Dbg_ValueSort;
#define fpr_base 16
typedef struct Dbg_Value Dbg_Value;
typedef Dbg_Error Dbg_AccessFn(Dbg_MCState *state, int write, Dbg_Value *self, Dbg_Constant *c);
typedef Dbg_Error Dbg_FormatFn(int decode, char *b, ARMword *valp, void *formatarg);
typedef struct { Dbg_AccessFn *f; int id; } Dbg_AccessFnRec;
struct Dbg_Value {
Dbg_TypeSpec type;
Dbg_ValueSort sort;
Dbg_FormatFn *formatp;
void *formatarg;
int f77csize;
union {
struct { int no; ARMaddress frame; } r;
ARMaddress ptr;
Dbg_ConstantVal c;
void *localp;
Dbg_AccessFnRec f;
Dbg_Error err;
} val;
};
Dbg_Error Dbg_AddLLSymbol(Dbg_SymTable *st, char const *name, Dbg_LLSymType type, ARMword val);
Dbg_Error Dbg_AddSymbol(Dbg_SymTable *st, char const *name, Dbg_Value const *val);
typedef struct Dbg_DeclSpecF {
Dbg_DeclSpec decl;
Dbg_FormatFn *formatp;
void *formatarg;
} Dbg_DeclSpecF;
typedef Dbg_Error Dbg_DeclProc(Dbg_MCState *state, Dbg_Environment const *context,
Dbg_DeclSpecF const *var, Dbg_DeclSort sort, int masked,
void *arg);
Dbg_Error Dbg_EnumerateDeclarations(Dbg_MCState *state, Dbg_Environment const *context,
Dbg_DeclProc *p, void *arg);
Dbg_Error Dbg_ValueOfVar(Dbg_MCState *state, const Dbg_Environment *context,
const Dbg_DeclSpec *var, Dbg_Value *val);
Dbg_Error Dbg_EvalExpr(Dbg_MCState *state, Dbg_Environment const *context,
char const *expr, int flags, Dbg_Value *val);
Dbg_Error Dbg_EvalExpr_ep(Dbg_MCState *state, Dbg_Environment const *context,
char const *expr, char **exprend, int flags, Dbg_Value *val);
void Dbg_RealLocation(Dbg_MCState *state, Dbg_Value *val);
Dbg_Error Dbg_DereferenceValue(Dbg_MCState *state, const Dbg_Value *value, Dbg_Constant *c);
typedef struct Dbg_Expr Dbg_Expr;
#define Dbg_exfl_heap 1
#define Dbg_exfl_needassign 2
#define Dbg_exfl_lowlevel 4
int Dbg_SetInputRadix(Dbg_MCState *state, int radix);
char *Dbg_SetDefaultIntFormat(Dbg_MCState *state, char *format);
Dbg_Error Dbg_ParseExpr(
Dbg_MCState *state, Dbg_Environment const *env, char *string,
char **end, Dbg_Expr **res, int flags);
Dbg_Error Dbg_ParseExprCheckEnd(
Dbg_MCState *state, Dbg_Environment const *env, char *string,
Dbg_Expr **res, int flags);
Dbg_Error Dbg_ParsedExprToValue(
Dbg_MCState *state, const Dbg_Environment *env, Dbg_Expr *expr, Dbg_Value *v);
Dbg_Error Dbg_ReadDecl(
Dbg_MCState *state, Dbg_Environment const *env, char *string,
Dbg_TypeSpec *p, char **varp, int flags);
bool Dbg_IsCastToArrayType(Dbg_MCState *state, Dbg_Expr *expr);
void Dbg_FreeExpr(Dbg_Expr *expr);
Dbg_Error Dbg_CopyType(Dbg_TypeSpec *tdest, Dbg_TypeSpec const *tsource);
Dbg_Error Dbg_FreeCopiedType(Dbg_TypeSpec *ts);
Dbg_Error Dbg_TypeOfExpr(Dbg_MCState *state, Dbg_Expr *tree, Dbg_TypeSpec *restype);
Dbg_Error Dbg_ExprToVar(const Dbg_Expr *expr, Dbg_DeclSpec *var, Dbg_Environment *env);
Dbg_Error Dbg_Assign(Dbg_MCState *state, const Dbg_Value *lv, const Dbg_Value *rv);
typedef enum Dbg_TypeSort {
ts_simple,
ts_union,
ts_struct,
ts_array
} Dbg_TypeSort;
Dbg_TypeSort Dbg_TypeSortOfValue(Dbg_MCState *state, const Dbg_Value *val, int *fieldcount);
Dbg_Error Dbg_TypeToChars(const Dbg_TypeSpec *var, Dbg_BufDesc *buf);
Dbg_Error Dbg_TypeSize(Dbg_MCState *state, const Dbg_TypeSpec *type, unsigned32 *res);
typedef int Dbg_ValToChars_cb(Dbg_MCState *state, Dbg_Value *subval, const char *fieldname,
Dbg_BufDesc *buf, void *arg);
Dbg_Error Dbg_ValToChars(Dbg_MCState *state, Dbg_Value *val, int base,
Dbg_ValToChars_cb *cb, void *arg,
const char *form, Dbg_BufDesc *buf);
Dbg_Error Dbg_NthElement(
Dbg_MCState *state,
const Dbg_Value *val, unsigned32 n, char **fieldname, Dbg_Value *subval);
typedef Dbg_Error Dbg_HistoryProc(void *, int, Dbg_Value *);
Dbg_Error Dbg_RegisterHistoryProc(Dbg_MCState *state, Dbg_HistoryProc *p, void *arg);
typedef enum {
ls_cpu,
ls_store,
ls_copro,
ls_local,
ls_filtered
} Dbg_LocSort;
typedef struct {
Dbg_LocSort sort;
union {
struct { ARMaddress addr, size; } store;
struct { int modemask; int r; } cpu;
struct { int no; int r; } cp;
void *localp;
Dbg_AccessFnRec f;
} loc;
} Dbg_Loc;
typedef Dbg_Error Dbg_ObjectWriteProc(Dbg_MCState *state, Dbg_Loc const *loc);
Dbg_Error Dbg_OnObjectWrite(Dbg_MCState *state, Dbg_ObjectWriteProc *p);
Dbg_Error Dbg_ObjectWritten(Dbg_MCState *state, Dbg_Loc const *loc);
Dbg_Error Dbg_SetCommandline(Dbg_MCState *state, const char *args);
typedef enum Dbg_ProgramState {
ps_notstarted,
ps_atbreak, ps_atwatch, ps_stepdone,
ps_interrupted,
ps_stopped,
ps_lostwatch,
ps_branchthrough0, ps_undef, ps_caughtswi, ps_prefetch,
ps_abort, ps_addrexcept, ps_caughtirq, ps_caughtfiq,
ps_error,
ps_callfailed, ps_callreturned,
ps_broken,
ps_unknownbreak,
ps_unknown
} Dbg_ProgramState;
int Dbg_IsCallLink(Dbg_MCState *state, ARMaddress pc);
typedef struct {
Dbg_FPRegVal fpres;
ARMword intres;
} Dbg_CallResults;
Dbg_CallResults *Dbg_GetCallResults(Dbg_MCState *state);
#define Dbg_S_STATEMENTS 0
#define Dbg_S_INSTRUCTIONS 1
#define Dbg_S_STEPINTOPROCS 2
Dbg_Error Dbg_Step(Dbg_MCState *state, int32 stepcount, int stepby, Dbg_ProgramState *status);
Dbg_Error Dbg_StepOut(Dbg_MCState *state, Dbg_ProgramState *status);
bool Dbg_CanGo(Dbg_MCState *state);
bool Dbg_IsExecuting(Dbg_MCState *state);
Dbg_Error Dbg_Go(Dbg_MCState *state, Dbg_ProgramState *status);
Dbg_Error Dbg_Stop(Dbg_MCState *state);
typedef void Dbg_ExecuteProc(Dbg_MCState *state, Dbg_ProgramState status);
Dbg_Error Dbg_OnExecute(Dbg_MCState *, Dbg_ExecuteProc *);
Dbg_Error Dbg_SetReturn(Dbg_MCState *state,
const Dbg_Environment *context, const Dbg_Value *value);
Dbg_Error Dbg_SetExecution(Dbg_MCState *state, Dbg_Environment *context);
Dbg_Error Dbg_ProgramStateToChars(Dbg_MCState *state, Dbg_ProgramState event, Dbg_BufDesc *buf);
Dbg_Error Dbg_CurrentEnvironment(Dbg_MCState *state, Dbg_Environment *context);
Dbg_Error Dbg_PrevFrame(Dbg_MCState *state, Dbg_Environment *context);
Dbg_Error Dbg_NextFrame(Dbg_MCState *state, Dbg_Environment *context);
typedef struct Dbg_AnyPos {
enum { pos_source, pos_ll, pos_none } postype;
ARMaddress pc;
union {
Dbg_ProcPos source;
Dbg_LLPos ll;
ARMaddress none;
} pos;
} Dbg_AnyPos;
Dbg_Error Dbg_EnvironmentToPos(Dbg_MCState *state, const Dbg_Environment *context, Dbg_AnyPos *pos);
Dbg_Error Dbg_ClearPaths(Dbg_MCState *state, Dbg_SymTable *st);
Dbg_Error Dbg_AddPath(Dbg_MCState *state, Dbg_SymTable *st, const char *path);
Dbg_Error Dbg_DeletePath(Dbg_MCState *state, Dbg_SymTable *st, const char *path);
typedef enum {
Dbg_PathsCleared,
Dbg_PathAdded,
Dbg_PathDeleted
} Dbg_PathAlteration;
typedef void Dbg_PathAlteredProc(
Dbg_MCState *state, Dbg_SymTable *st, char const *path,
Dbg_PathAlteration sort);
Dbg_Error Dbg_OnPathAlteration(Dbg_MCState *state, Dbg_PathAlteredProc *p);
typedef struct Dbg_FileRec Dbg_FileRec;
typedef struct {
unsigned32 linecount;
Dbg_FileRec *handle;
char *fullname;
} Dbg_FileDetails;
Dbg_Error Dbg_GetFileDetails(
Dbg_MCState *state, const Dbg_File *fname, Dbg_FileDetails *res);
Dbg_Error Dbg_FinishedWithFile(Dbg_MCState *state, Dbg_FileRec *handle);
Dbg_Error Dbg_GetFileDetails_fr(
Dbg_MCState *state, Dbg_FileRec *handle, Dbg_FileDetails *res);
Dbg_Error Dbg_FileLineLength(
Dbg_MCState *state, Dbg_FileRec *handle, int32 lineno, int32 *len);
Dbg_Error Dbg_GetFileLine_fr(
Dbg_MCState *state, Dbg_FileRec *handle, int32 lineno, Dbg_BufDesc *buf);
Dbg_Error Dbg_StartFileAccess(Dbg_MCState *state, Dbg_FileRec *handle);
Dbg_Error Dbg_EndFileAccess(Dbg_MCState *state, Dbg_FileRec *handle);
Dbg_Error Dbg_ControlSourceFileAccess(
Dbg_MCState *state, uint32 cachesize, bool closefiles);
typedef const char *Dbg_SWI_Decode(Dbg_MCState *state, ARMword swino);
Dbg_Error Dbg_InstructionAt(Dbg_MCState *state, ARMaddress addr,
int isize, ARMhword *inst, Dbg_SymTable *st,
Dbg_SWI_Decode *swi_name, Dbg_BufDesc *buf, int *length);
int Dbg_RDIOpen(Dbg_MCState *state, unsigned type);
int Dbg_RDIInfo(Dbg_MCState *state, unsigned type, ARMword *arg1, ARMword *arg2);
typedef enum {
Dbg_Point_Toolbox,
Dbg_Point_RDI_Unknown,
Dbg_Point_RDI_SW,
Dbg_Point_RDI_HW
} Dbg_PointType;
typedef enum Dbg_BreakPosType {
bt_procpos,
bt_procexit,
bt_address
} Dbg_BreakPosType;
typedef union {
Dbg_ProcPos procpos;
Dbg_ProcDesc procexit;
ARMaddress address;
} Dbg_BreakPosPos;
typedef struct Dbg_BreakPos {
Dbg_BreakPosType sort;
Dbg_BreakPosPos loc;
} Dbg_BreakPos;
typedef int Dbg_BPProc(Dbg_MCState *state, void *BPArg, Dbg_BreakPos *where);
typedef struct Dbg_BreakStatus {
int index;
int initcount, countnow;
Dbg_BreakPos where;
char *expr;
Dbg_BPProc *p; void *p_arg;
int incomplete;
Dbg_PointType type;
ARMword hwresource;
} Dbg_BreakStatus;
Dbg_Error Dbg_StringToBreakPos(
Dbg_MCState *state, Dbg_Environment *env, char const *str, size_t len,
Dbg_BreakPos *bpos, char *b);
Dbg_Error Dbg_SetBreakPoint(Dbg_MCState *state, Dbg_BreakPos *where,
int count,
const char *expr,
Dbg_BPProc *p, void *arg);
Dbg_Error Dbg_SetBreakPoint16(Dbg_MCState *state, Dbg_BreakPos *where,
int count,
const char *expr,
Dbg_BPProc *p, void *arg);
Dbg_Error Dbg_SetBreakPointNaturalSize(Dbg_MCState *state, Dbg_BreakPos *where,
int count,
const char *expr,
Dbg_BPProc *p, void *arg);
Dbg_Error Dbg_DeleteBreakPoint(Dbg_MCState *state, Dbg_BreakPos *where);
Dbg_Error Dbg_SuspendBreakPoint(Dbg_MCState *state, Dbg_BreakPos *where);
Dbg_Error Dbg_ReinstateBreakPoint(Dbg_MCState *state, Dbg_BreakPos *where);
Dbg_Error Dbg_DeleteAllBreakPoints(Dbg_MCState *state);
Dbg_Error Dbg_SuspendAllBreakPoints(Dbg_MCState *state);
Dbg_Error Dbg_ReinstateAllBreakPoints(Dbg_MCState *state);
typedef Dbg_Error Dbg_BPEnumProc(Dbg_MCState *state, Dbg_BreakStatus *status, void *arg);
Dbg_Error Dbg_EnumerateBreakPoints(Dbg_MCState *state, Dbg_BPEnumProc *p, void *arg);
Dbg_Error Dbg_BreakPointStatus(Dbg_MCState *state,
const Dbg_BreakPos *where, Dbg_BreakStatus *status);
typedef void Dbg_BreakAlteredProc(Dbg_MCState *state, ARMaddress addr, bool set);
Dbg_Error Dbg_OnBreak(Dbg_MCState *state, Dbg_BreakAlteredProc *p);
bool Dbg_StoppedAtBreakPoint(Dbg_MCState *state, const Dbg_BreakPos *where);
typedef struct {
Dbg_Value val;
char *name;
} Dbg_WatchPos;
typedef int Dbg_WPProc(Dbg_MCState *state, void *WPArg, Dbg_WatchPos *where);
typedef struct Dbg_WPStatus {
int index;
int initcount, countnow;
Dbg_WatchPos what, target;
char *expr;
Dbg_WPProc *p; void *p_arg;
Dbg_PointType type;
ARMword hwresource;
int skip;
} Dbg_WPStatus;
Dbg_Error Dbg_SetWatchPoint(
Dbg_MCState *state, Dbg_Environment *context, char const *watchee,
char const *target,
int count,
char const *expr,
Dbg_WPProc *p, void *arg);
Dbg_Error Dbg_DeleteWatchPoint(Dbg_MCState *state, Dbg_Environment *context, char const *watchee);
Dbg_Error Dbg_SetWatchPoint_V(
Dbg_MCState *state,
char const *name, Dbg_Value const *val, char const *tname, Dbg_Value const *tval,
int count,
char const *expr,
Dbg_WPProc *p, void *arg);
Dbg_Error Dbg_DeleteWatchPoint_V(Dbg_MCState *state, Dbg_Value const *val);
Dbg_Error Dbg_DeleteAllWatchPoints(Dbg_MCState *state);
typedef Dbg_Error Dbg_WPEnumProc(Dbg_MCState *state, Dbg_WPStatus const *watchee, void *arg);
Dbg_Error Dbg_EnumerateWatchPoints(Dbg_MCState *state, Dbg_WPEnumProc *p, void *arg);
Dbg_Error Dbg_WatchPointStatus(Dbg_MCState *state,
Dbg_WatchPos const *where, Dbg_WPStatus *status);
typedef void Dbg_WPRemovedProc(void *arg, Dbg_WPStatus const *wp);
Dbg_Error Dbg_RegisterWPRemovalProc(Dbg_MCState *state, Dbg_WPRemovedProc *p, void *arg);
typedef void Dbg_WatchAlteredProc(Dbg_MCState *state, Dbg_Value const *where, bool set);
Dbg_Error Dbg_OnWatch(Dbg_MCState *state, Dbg_WatchAlteredProc *p);
Dbg_Error Dbg_ProfileLoad(Dbg_MCState *state);
Dbg_Error Dbg_ProfileStart(Dbg_MCState *state, ARMword interval);
Dbg_Error Dbg_ProfileStop(Dbg_MCState *state);
Dbg_Error Dbg_ProfileClear(Dbg_MCState *state);
Dbg_Error Dbg_WriteProfile(Dbg_MCState *state, char const *filename,
char const *toolid, char const *arg);
Dbg_Error Dbg_ConnectChannel_ToHost(Dbg_MCState *state, RDICCProc_ToHost *p, void *arg);
Dbg_Error Dbg_ConnectChannel_FromHost(Dbg_MCState *state, RDICCProc_FromHost *p, void *arg);
Dbg_Error Dbg_LoadConfigData(Dbg_MCState *state, char const *filename);
Dbg_Error Dbg_SelectConfig(
Dbg_MCState *state,
RDI_ConfigAspect aspect, char const *name, RDI_ConfigMatchType matchtype,
unsigned versionreq, unsigned *versionp);
Dbg_Error Dbg_ParseConfigVersion(
char const *s, RDI_ConfigMatchType *matchp, unsigned *versionp);
typedef Dbg_Error Dbg_ConfigEnumProc(Dbg_MCState *state, RDI_ConfigDesc const *desc, void *arg);
Dbg_Error Dbg_EnumerateConfigs(Dbg_MCState *state, Dbg_ConfigEnumProc *p, void *arg);
Dbg_Error Dbg_CreateTask(Dbg_MCState **statep, Dbg_MCState *parent, bool inherit);
Dbg_Error Dbg_DeleteTask(Dbg_MCState *state);
Dbg_Error Dbg_DetachTask(Dbg_MCState *state);
Dbg_Error Dbg_AttachTask(Dbg_MCState *state);
typedef Dbg_Error Dbg_TaskSwitchProc(void *arg, Dbg_MCState *newstate);
Dbg_Error Dbg_OnTaskSwitch(Dbg_MCState *state, Dbg_TaskSwitchProc *fn, void *arg);
typedef Dbg_Error Dbg_RestartProc(
void *arg, Dbg_MCState *curstate, Dbg_MCState **newstate);
Dbg_Error Dbg_OnRestart(Dbg_MCState *state, Dbg_RestartProc *fn, void *arg);
#ifdef __cplusplus
}
#endif
#endif