⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 armdbg.h

📁 这个是LINUX下的GDB调度工具的源码
💻 H
📖 第 1 页 / 共 4 页
字号:
/*  * Copyright (C) 1995 Advanced RISC Machines Limited. All rights reserved. *  * This software may be freely used, copied, modified, and distributed * provided that the above copyright notice is preserved in all copies of the * software. *//* * ARM symbolic debugger toolbox interface *//* * RCS $Revision: 1.2 $ * Checkin $Date: 1998/01/08 11:11:32 $ *//* Minor points of uncertainty are indicated by a question mark in the   LH margin.   Wherever an interface is required to iterate over things of some class,   I prefer something of the form  EnumerateXXs(..., XXProc *p, void *arg)   which results in a call of p(xx, arg) for each xx, rather than something   of the form     for (xxh = StartIterationOverXXs(); (xx = Next(xxh)) != 0; ) { ... }     EndIterationOverXXs(xxh);   Others may disagree.   (Each XXProc returns an Error value: if this is not Err_OK, iteration   stops immediately and the EnumerateXXs function returns that value).   ptrace has been retired as of insufficient utility.  If such fuctionality is   required, it can be constructed using breakpoints.   The file form of all name fields in debug areas is in-line, with a length   byte and no terminator.  The debugger toolbox makes an in-store translation,   where the strings are out of line (the namep variant in asdfmt.h) and have a   terminating zero byte: the pointer is to the first character of the string   with the length byte at ...->n.namep[-1]. */#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 __cplusplusextern "C"{#endiftypedef unsigned char Dbg_Byte;typedef int Dbg_Error;typedef struct Dbg_MCState Dbg_MCState;/* A representation of the state of the target.  The structure is not revealed.   A pointer to one of these is returned by Dbg_Initialise(), is passed to all   toolbox calls which refer to the state of the target, and is discarded   by Dbg_Finalise().   Nothing in the toolbox itself precludes there being multiple targets, each   with its own state. *//* Most toolbox interfaces return an error status.  Only a few of the status   values are expected to be interesting to clients and defined here; the   rest are private (but a textual form can be produced by ErrorToChars()). */#define Error_OK 0/* Partitioning of the error code space: errors below Dbg_Error_Base are RDI   errors (as defined in dbg_rdi.h). Codes above Dbg_Error_Limit are   available to clients, who may impose some further structure. */#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)   /* functions which evaluate expressions may return this value, to indicate      that execution became suspended within a function called in the debugee *//* Functions returning characters take a BufDesc argument, with fields buffer   and bufsize being input arguments describing the buffer to be filled, and   filled being set on return to the number of bytes written to the buffer   (omitting the terminating 0). */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 NLSDbg_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#endifDbg_Error Dbg_CharToBuf(Dbg_BufDesc *buf, int ch);int Dbg_CIStrCmp(char const *s1, char const *s2);/* Case-independent string comparison, interface as for strcmp */int Dbg_CIStrnCmp(char const *s1, char const *s2, size_t n);/* Case-independent string comparison, interface as for strncmp */void Dbg_ErrorToChars(Dbg_MCState *state, Dbg_Error err, Dbg_BufDesc *buf);typedef int Dbg_RDIResetCheckProc(int);/* Type of a function to be called after each RDI operation performed by the   toolbox, with the status from the operation as argument.  The value returned   is treated as the status.  (The intent is to allow the toolbox's client to   take special action to handle RDIDbg_Error_Reset). */typedef struct Dbg_CoProDesc Dbg_CoProDesc;typedef Dbg_Error Dbg_CoProFoundProc(Dbg_MCState *state, int cpno, Dbg_CoProDesc const *cpd);/* Type of a function to be called when the shape of a coprocessor is discovered   by enquiry of the target or agent (via RequestCoProDesc) */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);/* values in config are updated if they call for default values */void Dbg_Finalise(Dbg_MCState *state, bool targetdead);typedef struct {    char name[16];    RDI_MemDescr md;    RDI_MemAccessStats a;} Dbg_MemStats;/*--------------------------------------------------------------------------*//* Symbol table management.   The structure of a Dbg_SymTable is not revealed.  It is created by   Dbg_ReadSymbols() or by Dbg_LoadFile(), and associated with the argument   Dbg_MCState.   Many symbol tables may be concurrently active.   A Dbg_SymTable is removed either explicitly (by call to Dbg_DeleteSymbols)   or implicitly when a symbol table for an overlapping address range is read.   There is a pre-defined symbol table containing entries for ARM registers,   co-processor registers and the like. */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);/* Just read the symbols from the named image.  <st> is set to the allocated   symbol table.?  Maybe we could usefully allow other formats than AIF images to describe   the symbols (eg) of shared libraries */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);/* load the image into target memory, and read its symbols.  <st> is set to   the allocated symbol table.   A null filename reloads the most recently loaded file (and rereads its   symbols).   Loading an image leaves breakpoints unchanged.  If a client wishes   otherwise, it must remove the breakpoints explicitly.*/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 *);/* Register function to be called back whenever an image is loaded, or symbols * for an image read. (To allow multiple toolbox clients to coexist). */Dbg_Error Dbg_LoadAgent(Dbg_MCState *state, const char *filename);/* Load a debug agent, and start it.   Symbols in the image for the agent are ignored.*/Dbg_Error Dbg_RelocateSymbols(Dbg_SymTable *st, ARMaddress reloc);/* add <reloc> to the value of all symbols in <st> describing absolute memory   locations.  The intent is to allow the symbols in a load-time relocating   image (for example) to be useful. */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;/* Since AIF images contain no type information for low-level symbols, this   classification is only a guess, and some symbols describing constants will   incorrectly be described as code or data. */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);/* Call  p(name, value)  for each low level symbol in the tables of <state>   whose name matches the regular expression <match> (a NULL <match> matches   any name).  Symbols are enumerated in no particular order. *//*--------------------------------------------------------------------------*//* Functions are provided here to allow quick mass access to register values   for display.  There is no comparable need for quick mass update, so writing   should be via Assign(). */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;/* bits in the modemask argument for ReadRegisters */#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 0x40Dbg_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);/* Some implementations of the FP instruction set keep FP values loaded into   registers in their unconverted format, converting only when necessary.   Some RDI implementations deliver these values uninterpreted.   (For the rest, register values will always have type F_Extended). */typedef enum { F_Single, F_Double, F_Extended, F_Packed, /* fpe340 values */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -