SourcePoint Intel Help
Table of Contents
- Using Help
- Contacting ASSET InterTech
- Introduction to SourcePoint
- SourcePoint Environment
- SourcePoint Overview
- SourcePoint Parent Window Introduction
- SourcePoint Icon Toolbar
- File Menu
- File Menu - Project Menu Item
- File Menu - Layout Menu Item
- File Menu - Program Menu Item
- File Menu - Macro Menu Item
- File Menu - Print Menu Items
- File Menu - Update Emulator Flash Menu Item
- File Menu - Program Target Device Menu Item
- File Menu - Other Menu Items
- Edit Menu
- View Menu
- Processor Menu
- Options Menu
- Options Menu - Preferences Menu Item
- Options Menu - Target Configuration Menu Item
- Options Menu - Load Target Configuration File Menu Item
- Options Menu - Save Target Configuration File Menu Item
- Options Menu - Emulator Configuration Menu Item
- Options Menu - Emulator Connection Menu Item
- Options Menu - Emulator Reset Menu Item
- Options Menu - Confidence Tests Menu Item
- Window Menu
- Help Menu
- How To -- SourcePoint Environment
- Add Emulator Connections
- Configure Custom Macro Icons
- Configure Autoloading Macros
- Display Text on the Icon Toolbar
- Edit Icon Groups to Customize Your Toolbars
- Modify a Defined Memory Region
- Refresh SourcePoint Windows
- Save a Program
- Start SourcePoint With Command Line Arguments
- Use the New Project Wizard
- Verify Emulator Network Connections
- SourcePoint Overview
- Breakpoints Window
- Breakpoints Window Overview
- How To - Breakpoints
- Code Window
- Command Window
- Command Window Overview
- Confidence Tests Window
- Confidence Tests Window Overview
- Descriptors Tables Window
- Descriptors Tables Window Overview
- How To - Descriptors
- Devices Window
- Devices Window Overview
- How To - Devices Window
- Log Window
- Log Window Overview
- Memory Window
- Memory Window Overview
- How To - Memory Window
- Page Translation Window
- Page Translation Windows Overview
- PCI Devices Window
- PCI Devices Window Overview
- How To - PCI Devices Window
- Registers Window
- Registers Window Overview
- How To - Registers
- Symbols Windows
- Symbols Window Overview
- How To - Symbols Window
- Trace Window
- Trace Window Overview
- How To - Trace Window
- Advanced
- Viewpoint Window
- Viewpoint Window Overview
- Watch Window
- Watch Window Overview
- How To - Watch Window
- Technical Notes
- Descriptor Cache: Revealing Hidden Registers
- UEFI Framework Debugging
- Memory Casting
- Microsoft PE Format Support in SourcePoint
- Multi-Clustering
- Python/CScripts
- OpenIPC Integration, Installation and Usage
- Registers Keyword Table
- SourcePoint Licensing
- Stepping
- Symbols Textsym Format
- Target Configuration
- Using Bookmarks
- Which Processor Is Which
- Getting Started with DbC
- SourcePoint Command Language
- Overview
- Commands and Control Variables
- aadump
- abort
- abs
- acos
- advanced
- asin
- asm
- asmmode
- atan
- atan2
- autoconfigure
- base
- bell (beep)
- bits
- break
- breakall
- cachememory
- cause
- Character Functions
- clock
- continue
- cos
- cpubreak commands
- cpuid_eax
- cpuid_ebx
- cpuid_ecx
- cpuid_edx
- createprocess
- cscfg, local_cscfg
- csr
- ctime
- cwd
- dbgbreak commands
- defaultpath
- #define
- define
- definemacro
- deviceconfigure
- devicelist
- devicescan
- disconnect
- displayflag
- do while
- dos
- dport
- drscan
- edit
- editor
- emubreak, emuremove, emudisable, emuenable
- emulatorstate
- encrypt
- error
- eval
- evalprogramsymbol
- execution point ($)
- exit
- exp
- fc
- fclose
- feof
- fgetc
- fgets
- first_jtag_device
- flist
- flush
- fopen
- for
- forward
- fprintf
- fputc
- fputs
- fread
- fseek
- ftell
- fwrite
- getc
- getchar
- getnearestprogramsymbol
- getprogramsymboladdress
- gets
- globalsourcepath
- go
- halt
- help
- homepath
- idcode
- if
- include
- invd
- irscan
- isdebugsymbol
- isem64t
- isprogramsymbol
- isrunning
- issleeping
- issmm
- itpcompatible
- jtagchain
- jtagconfigure
- jtagdeviceadd
- jtagdeviceclear
- jtagdevices
- jtagscan
- jtagtest
- keys
- last
- last_jtag_device
- left
- libcall
- license
- linear
- list, nolist
- load
- loadbreakpoints
- loadlayout
- loadproject
- loadtarget
- loadwatches
- log, nolog
- log10
- loge
- logmessage
- macropath
- Memory Access
- messagebox
- mid
- msgclose
- msgdata
- msgdelete
- msgdr
- msgdump
- msgir
- msgopen
- msgreturndatasize
- msgscan
- msr
- num_activeprocessors
- num_all_devices
- num_devices
- num_jtag_chains
- num_jtag_devices
- num_processors
- num_uncore_devices
- openipc
- pause
- physical
- port
- pow
- print cycles
- printf
- proc
- processorcontrol
- processorfamily
- processormode
- processors
- processortype
- projectpath
- putchar
- puts
- rand
- readsetting
- reconnect
- Register Access
- reload
- reloadproject
- remove
- reset
- restart
- return
- right
- runcontroltype
- safemode
- save
- savebreakpoints
- savelayout
- savewatches
- selectdirectory
- selectfile
- shell
- show
- sin
- sizeof
- sleep
- softbreak, softremove, softdisable, softenable
- sprintf
- sqrt
- srand
- step
- stop
- strcat
- strchr
- strcmp
- strcpy
- _strdate
- string [ ] (index into string)
- strlen
- _strlwr
- strncat
- strncmp
- strncpy
- strpos
- strstr
- _strtime
- strtod
- strtol
- strtoul
- _strupr
- swbreak
- switch
- swremove
- tabs
- tan
- tapdatashift
- tapstateset
- targpower
- targstatus
- taskattach
- taskbreak, taskremove, taskdisable, taskenable
- taskend
- taskgetpid
- taskstart
- tck
- time
- uncoreconfigure
- uncorescan
- #undef
- unload
- unloadproject
- upload
- use
- verify
- verifydeviceconfiguration
- verifyjtagconfiguration
- version
- viewpoint
- vpalias
- wait
- wbinvd
- while
- windowrefresh
- wport
- writesetting
- yield
- yieldflag
Debug Procedures
Debug procedures are the equivalent to functions in the C language. ย When a debug procedure is defined, it is saved in memory for later execution. ย Debug procedures can accept arguments and return values.
The define command is used to define a debug procedure. ย The show command lists debug procedures, and the remove command can be used to remove debug procedures. The proc ย command can be used to display a debug procedure definition.
Typically, a command file is loaded that contains one or more debug procedure definitions. ย The user can type a procedure name at the command line to execute it, or assign the procedure to a user-defined toolbar button, and press the button to execute it.
Syntax
define proc [data-type] proc-name ([argument-name][,...])
[define argument-type argument-name][...]
{
ย ย ย ย ย commands [...]
ย
ย ย ย ย ย [return expr]
}
Where:
define |
signals creation of a user-defined procedure or procedure argument. |
proc |
specifies a user-defined procedure. |
data-type |
specifies the data type to be returned. |
proc-name |
specifies the name of a debug procedure. |
argument-name |
specifies the name of an argument that is used in the procedure. Separates the names of arguments with commas. |
argument-type |
specifies the data type of the argument. |
commands |
any emulator commands (except for include). |
return |
specifies an argument name whose value is returned upon completion of proc execution. |
Discussion:
Use debug procedures (procs) to define custom functions. Create a proc with the ย proc command. You can use any text editor to initially create and edit a proc. You can also enter a proc at the command line. A proc is executed when it is called by name, just as a built-in function is executed.
You can define debug procedures that accept arguments. If an argument name is specified but not an the argument type, the caller data type is used as the default. When executing a proc, an error message is displayed if the proc requires arguments that have not been passed to it.
To define debug procedures that accept a variable number of arguments, use two predefined local variables, argvector and argcount. The argcount variable tracks the number of arguments supplied when the function is called. The argvector variable (array) stores the actual arguments passed when a function is called.
Recursive or reentrant debug procedures are supported to the extent of available host memory. Debug procedures can also call other debug procedures that have been previously defined. Use the forward option to reference debug objects (including other debug procedures) that have not yet been defined. To define recursive debug procedures, the forward option must be used.
Debug variables defined inside the proc are local to the proc unless declared as global (see define). Debug variables inside the proc not declared as global are automatically removed after the execution of the proc.
Use the return command to return values from a proc. If the return command is not used or executed, the proc returns a null value. If the return data type does not match the calling data type, then an explicit data type conversion occurs. If a return datatype is not specified, then the type comes from the value returned.
If a proc executes an emulation command (such as go or step), the statements after the emulation command are executed immediately unless followed by the wait command. The wait command prevents the emulator from executing any more commands until a breakpoint is reached.
Note: You can use debug procedures and macro files to create a library of frequently used commands. The emulator displays a syntax error when a proc processes an undefined proc symbol or variable. Define all program symbols before referencing.
Example 1
To define and then execute a procedure named avg that accepts three parameters and returns their average:
Note: Types are not specified for a, b and c, so the caller's data type is assumed.
ย
Command input:
define proc avg(a,b,c)
{
ย return ((a + b + c) / 3)
}
avg(4, 6, 3)
Result:
4T
Example 2
To use the forward option to refer to undefined debug procedures:
Command input:
define proc int8 calc(a,b,c)
define int8 a
define int8 b
define int8 c
{
ย forward proc int8 min ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย // forward references procs
ย forward proc int8 max ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย // min and max.
ย if ((a > 0) && (b > 0))
ย ย ย ย ย ย return (max (a,b) * c) \
ย else if ((a < 0) && ( b < 0))
ย ย ย ย ย ย return (min(a,b) * c) \
ย else return (0)
} ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย
ย
define proc int8 min(x,y) ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย // define min proc
{
ย return ((x < y) ? (x): (y))
}
define proc int8 max(x,y) ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย // define max proc.
{
ย return ((x > y) ? (x): (y))
}
ย
base = 10t
calc(2,4,6) ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย // execute calc proc.
Result:
24T
Example 3
To use the forward option to create a recursive procedure:
Command input:
define proc ord4 factorial (n)
define ord4 n
{
ย forward proc ord4 factorial ย ย ย ย ย ย ย ย ย ย ย // recursive proc
ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย // forward reference
ย if (n == 0)
ย ย ย ย ย ย return 1
ย ย else
ย ย ย ย ย ย return (n * factorial(n-1))
}
ย
base = 10t
factorial (4)
Result:
24T
Example 4
A return data type is not specified, so the type comes from the value returned.
Command input:
define proc truefalse(b)
{
ย ย ย ย ย if(b) {
ย ย ย ย ย ย ย ย ย ย return "true"
ย ย ย ย ย } else {
ย ย ย ย ย ย ย ย ย ย return "false"
ย ย ย ย ย }
}
Related Topics
ย
ย