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

📄 axd.vbs

📁 realview22.rar
💻 VBS
📖 第 1 页 / 共 5 页
字号:
'***********************************************************
'   AXD: AXD.vbs
'   Copyright (C) ARM Limited 1999-2000. All rights reserved
'***********************************************************/

'   $Revision: 1.177 $
'   $Date: 2001/12/03 12:50:08 $

'''''''''''''''''''''''''''''''''''''''
' Property Enumeration Variables
'
'''''''''''''''''''''''''''''''''''''''


'    Dim HexFmt, DecFmt, OctFmt, BinFmt
'    HexFmt = "hex" : DecFmt = "dec" : OctFmt = "oct" : BinFmt = "bin"

    Dim AxdFile, AxdMsgbox, AxdIgnore, AxdReplace
    AxdFail = "Fail" : AxdMsgbox = "Msgbox" : AxdIgnore = "Ignore" : AxdReplace = "Replace"

    Dim SYNC, ASYNC
    ASYNC = 0 : SYNC = 1

    Dim stpIn, stpLine, stpInstr, stpOut
    stpIn = 0: stpOut = 1
    stpInstr = 0 : stpLine = 1
    
    Dim Bit8, Bit16, Bit32
    Bit8 = 1 : Bit16 = 2 : Bit32 = 4
    
    Dim THUMB, ARM, AUTO, BYTECODE
    THUMB = 0 : ARM = 1 : AUTO = 2 : BYTECODE = 3
  
    Dim AxdGLOBAL, AxdLOCAL, AxdCLASS
    AxdGLOBAL = 0 : AxdLOCAL = 1 : AxdCLASS = 2

    Dim sOn, sOff
    sOn = 0 : sOff =1

    Dim PosImgObj, PosFileObj, PosLineObj, PosAsmObj
    PosImgObj = 0 : PosFileObj = 1 : PosLineObj = 2 : PosAsmObj = 3

    Dim DefPlatForm
	Dim ImageLoadFlag
	ImageLoadFlag = FALSE
    
'''''''''''''''''''''''''''''''''''''''
' Property Flags
'''''''''''''''''''''''''''''''''''''''
    Dim DefDisplayFormat
    Dim DefDisplayFormatPar
    Dim DefInputBase
    Dim DefMemSize
    Dim DefInstrSize
    Dim DefMemRange
    Dim DefDisplayLine
    Dim DefRunMode
    Dim DefStepSize

''''''''''''''''''''''''''''''''''''''''''''
' Define global object and their list
' Lists of references to external objects
'''''''''''''''''''''''''''''''''''''''''''
    Dim CurrentThread
    Dim ProcList   
    Dim ImageList
    Dim FileList
    Dim RegBankList
    Dim MemBankList
    Dim BreakPtList
    Dim WatchPtList

''''''''''''''''''''
    Dim VariableList
    Dim FunctionList
    Dim ClassList
    Dim ClassVarList
    
'''''''''''''''''''''''''''''''
' Global strings for id and name.
'''''''''''''''''''''''''''''''''''''''''
    Dim ThreadIDString, ThreadNameString
    Dim ProcIDString, ProcNameString
    Dim ImageIDString, ImageNameString
    Dim FileIDString, FileNameString
    Dim RegBankIDString, RegBankNameString
    Dim ClassNameString
    Dim VariableNameSting
    Dim RegNameString
    Dim FunctionNameString
    Dim StackEntryString
    Dim FormatRDINameString

'''''''''''''''''''''''
'Text Strings
''''''''''''''''''''''
    Dim ImageListText
    Dim ProcListText
    Dim ImageFileListText
    Dim ImageFunctionListText
    Dim ImageVariableListText
    Dim FormatListText

''''''''''''''''''''''''''''''''''''''''''
' Column header
''''''''''''''''''''
    Dim HeaderText, HeadText, regheader
    headertext = "Index" & Chr(9) & "Name" & Chr(13) & Chr(10)
    regheader = "Index" & Chr(9) & "Name" & Chr(9) & "Value" & Chr(13) & Chr(10)
    HeadText = "Index" & Chr(9) & "ID" & Chr(9) & "Name" & Chr(13) & Chr(10)
''''''''''''''''''''

''''''''''''''''''''''''''''''
' semi permanent async objects
''''''''''''''''''''''''''''''
    Dim AsyncSource
    Dim AsyncAsm

'''''''''''''''''''''''''''''''
' local flag only
'''''''''''''''''''''''''''''''
    Dim ListFormatPar, ListCounter
    ListFormatPar = -1 : ListCounter = false
    
'''''''''''''''''''''''''
'Property Functions
''''''''''''''''''
Function MemSize(MemorySize)

    Select Case MemorySize
        Case Bit8
            DefMemSize = 1
        Case Bit16
            DefMemSize = 2
        Case Bit32
            DefMemSize = 4
    End Select
End Function

Function ConvertMemSize(MemorySize)
    Dim Result
    Select Case MemorySize
        Case Bit8
            Result = 1
        Case Bit16
            Result = 2
        Case Bit32
            Result = 4
    End Select
    ConvertMemSize = Result
End Function

Function MemRange(MemoryRange)
    DefMemRange = MemoryRange
End Function

Function StepSize(stpSize)                            '<--- CLI command
On Error Resume Next 
    StepSize = StepSizeInt(stpSize)
    DisplayError
End Function

Function StepSizeInt(stpSize)
    If stpSize = stpLine Then
        DefStepSize = 1
    ElseIf stpSize = stpInstr Then
        DefStepSize = 0
    ElseIf stpSize = -1 Then
        DefStepSize = DefStepSize
    Else
        err.raise 1000, "VBScript", "Invalid step size specified"
    End If
End Function


Function RunMode(aRunMode, stpSize)                     '<--- CLI command
On Error Resume Next 
    RunMode = RunModeInt(aRunMode, stpSize)
    DisplayError
End Function

Function RunModeInt(aRunMode, stpSize)
    If aRunMode = ASYNC Then
        DefRunMode = 0
    ElseIf aRunMode = SYNC Then
        DefRunMode = 1
    ElseIf aRunMode = -1 Then
        DefRunMode = DefRunMode
    Else
        err.raise 1000, "VBScript", "Invalid mode specified"
    End If
    If stpSize = stpLine Then
        DefStepSize = 1
    ElseIf stpSize = stpInstr Then
        DefStepSize = 0
    ElseIf stpSize = -1 Then
        DefStepSize = DefStepSize
    Else
        err.raise 1000, "VBScript", "Invalid step size specified"
    End If
End Function

Function InstrSize(aInstrSize)
    If aInstrSize = THUMB Then
        DefInstrSize = 0
    ElseIf aInstrSize = ARM Then
        DefInstrSize = 1
    ElseIf aInstrSize = AUTO Then
        DefInstrSize = 2
    Else
        adw3cli.Display("Unknown instruction type."& Chr(13) & Chr(10))
    End If
End Function

'Function format(InputParam, FormatParam)                    '<-- CLI command
'On Error Resume Next
'    If InputParam = HexFmt Then
'        DefInputBase = "H"
'    ElseIf InputParam = DecFmt Then
'        DefInputBase = "D"
'    ElseIf InputParam = OctFmt Then
'        DefInputBase = "O"
'    Else
'        adw3cli.Display("Invalid input option."& Chr(13) & Chr(10))
'    End If

'    If FormatParam = HexFmt Then
'        DefDisplayFormat = "hex"
'    ElseIf FormatParam = DecFmt Then
'        DefDisplayFormat = "dec"
'    ElseIf FormatParam = OctFmt Then
'        DefDisplayFormat = "oct"
'    ElseIf FormatParam = BinFmt Then
'        DefDisplayFormat = "bin"
'    Else
'        adw3cli.Display("Invalid format option."& Chr(13) & Chr(10))
'    End If
'    DisplayError
'End Function

Function Format(fmtStr, fmtPar)
On Error Resume Next

    If FormatListPar = -1 Then
        DefDisplayFormat = fmtStr
    Else
        DefDisplayFormat = GetFormatFromKey(fmtStr)
    End If
    DefDisplayFormatPar = CStr(fmtPar)    
'    DefDisplayFormat = CStr(fmtStr) & CStr(fmtPar)
    DisplayError
End Function

Function Platform(iPlatform)
    DefPlatForm = iPlatForm
End Function   

Function ThreadChange()
    Dim CurImageList
	set CurrentThread = session.GetCurrentThread
	'In case user start up CLI after loaded an image.
	set CurImageList = session.Images
	If CurImageList.count > 0 Then
		ImageLoaded
	End If
End Function

Function ImageLoaded()
	ImageLoadFlag = TRUE
    call UpdateImageList
End Function

'''''''''''''''''''''''''''''''''''''
' ImportFormat
'''''''''''''''''''''''''''''''''''''
Function ImportFormat(FmtFile, FailureOpt)                 '<--- CLI command
On Error Resume Next
    call ImportFormatInt(FmtFile, FailureOpt)
    DisplayError
End Function

Function ImportFormat(FmtFile, FailureOpt)               
    Dim ImportRes

    If FailureOpt = "-1" Then
        FailureOpt = "Fail" 
    End If

    ImportRes = session.ImportFormat(FmtFile, FailureOpt)
    adw3cli.Display(ImportRes)

End Function


Function LoadSession(SessionFile)                       '<---CLI command
On Error Resume Next 
    call LoadSessionInt(SessionFile)
    DisplayError
End Function

Function LoadSessionInt(SessionFile)
    Dim LoadStatus
    LoadStatus = session.LoadSession(SessionFile)
End Function

Function SaveSession(SessionFile)                       '<---CLI command
On Error Resume Next 
    call SaveSessionInt(SessionFile)
    DisplayError
End Function

Function SaveSessionInt(SessionFile)
    SaveStatus = session.SaveSession(SessionFile)
    If SaveStatus = 0 Then
        err.raise 1000, "VBScript", "Open file error."
    ElseIf SaveStatus = 2 Then
        err.raise 1000, "VBScript", "Error in saving session."
    End If
End Function

Function TraceLoad(TCFName)                             '<---CLI command
On Error Resume Next 
    TraceLoad = TraceLoadInt(TCFName)
    DisplayError
End Function


Function TraceLoadInt(TCFName)
    LoadState = session.TraceLoad(TCFName)
    If LoadState = 0 Then
        err.raise 1000, "VBScript", "Not a valid trace target."
    ElseIf LoadState = 1 Then
        err.raise 1000, "VBScript", "Failed to load TCF file."
    End If
End Function

Function Trace(Toggle)                                  '<---CLI command
On Error Resume Next 
    call TraceInt(Toggle)
    DisplayError
End Function

Function TraceInt(Toggle)
    If Toggle = SON Then
        res = session.TraceToggle(TRUE)
    Else
        res = session.TraceToggle(FALSE)
    End If
    If res = 0 Then
        err.raise 1000, "VBScript", "Not a valid trace target."
    ElseIf res = 1 and Toggle = SON Then
        err.raise 1000, "VBScript", "Failed to start trace."
    ElseIf res = 1 and Toggle = SOFF Then
        err.raise 1000, "VBScript", "Failed to stop trace."
    End If

End Function
''''''''''''''''''''''''''
' ListFormat
''''''''''''''''''''''''''
Function ListFormat(SizeOption)                           '<--- CLI command
On Error Resume Next 
    ListFormatInt(SizeOption)
    DisplayError
End Function

Function ListFormatInt(SizeOption)                           

    Dim HelperText
    Dim FormatList
    Dim GenericList, EightBitList, SixteenBitList, ThirtytwoBitList, SixtyfourBitList, EightyBitList, UserDefinedList
    Dim DataSize
    Dim ListHeader
    Dim FormatListText

    ListHeader = "Index" & Chr(9) & AddSpace("ShortName", 25) & "RDIName" & Chr(13) & Chr(10)
    set FormatList = session.ListFormat(SizeOption)
    ListFormatPar = SizeOption
    ListCounter = TRUE

    count = FormatList.count
    If count = 0 Then
        FormatListText = "No display format is available for this domain." & chr(13) & chr(10)
    End If
    iter = 0 : index = 0
    do while iter < count
        set ThisFormat = FormatList(iter)
        DataSize = ThisFormat.GetSize
        FmtRDIName = ThisFormat.GetRDIName
        FmtName = ThisFormat.GetName

        FormatListText = FormatListText & Chr(35) & CStr(index + 1) & Chr(9) & AddSpace(ThisFormat.GetName, 25) & FmtRDIName & chr(13) & chr(10)

        If DataSize <> 0 Then
           FormatRDINameString = FormatRDINameString  & CStr(FmtRDIName) & "%" & CStr(iter) & "%"
           RegBankNameString = RegBankNameString & CStr(FmtName) & "%" & CStr(iter) & "%" 
        End If
        index = index + 1
        iter = iter + 1
    loop

    If SizeOption = -1  Then
        BitName = "All"
    Else
        BitName = CStr(SizeOption) & " bits data"
    End If
    
    ListTitle = BitName & " display formats:" & chr(13) & chr(10)
    txt = txt & ListTitle & ListHeader & FormatListText            

    adw3cli.Display(txt)
    
End Function


Function ListFormatIntOld(SizeOption)                           
                           

⌨️ 快捷键说明

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