Program Execution
The following is a list of running commands:
state
Display the current state of the target.
Syntax
state
Return the current execution state of target.
stop
Stop active target.
Syntax
stop
Suspend execution of active target.
Returns
Nothing, if the target is suspended. Error string, if the target is already stopped or cannot be stopped.
An information message is printed on the console when the target is suspended.
con
Resume active target.
Syntax
con [options]
Resume execution of active target.
Options
Option | Description |
---|---|
-addr <address> |
Resume execution from address specified by <address> |
-block |
Block until the target stops or a timeout is reached |
-timeout <sec> |
Timeout value in seconds |
Returns
Nothing, if the target is resumed. Error string, if the target is already running or cannot be resumed or does not halt within timeout, after being resumed.
An information message is printed on the console when the target is resumed.
Example(s)
con -addr 0x100000
Resume execution of the active target from address 0x100000.
con -block
Resume execution of the active target and wait until the target stops.
con -block -timeout 5
Resume execution of the active target and wait until the target stops or until the 5 sec timeout is reached.
stp
Step into a line of source code.
Syntax
stp [count]
Resume execution of the active target until control reaches instruction that belongs to different line of source code. If a function is called, stop at first line of the function code. Error is returned if line number information not available. If <count>
is greater than 1, repeat <count>
times. Default value of count is 1.
Returns
Nothing, if the target has single stepped. Error string, if the target is already running or cannot be resumed.
An information message is printed on the console when the target stops at the next address.
nxt
Step over a line of source code.
Syntax
nxt [count]
Resume execution of the active target until control reaches instruction that belongs to a different line of source code, but runs any functions called at full speed. Error is returned if line number information not available. If <count>
is greater than 1, repeat <count>
times. Default value of count is 1.
Returns
Nothing, if the target has stepped to the next source line. Error string, if the target is already running or cannot be resumed.
An information message is printed on the console when the target stops at the next address.
stpi
Execute a machine instruction.
Syntax
stpi [count]
Execute a single machine instruction. If instruction is function call, stop at first instruction of the function code If <count>
is greater than 1, repeat <count>
times. Default value of count is 1.
Returns
Nothing, if the target has single stepped. Error if the target is already running or cannot be resumed.
An information message is printed on the console when the target stops at the next address.
nxti
Step over a machine instruction.
Syntax
nxti [count]
Step over a single machine instruction. If instruction is function call, execution continues until control returns from the function. If <count>
is greater than 1, repeat <count>
times. Default value of count is 1.
Returns
Nothing, if the target has stepped to the next address. Error string, if the target is already running or cannot be resumed.
An information message is printed on the console when the target stops at the next address.
stpout
Step out from current function.
Syntax
stpout [count]
Resume execution of current target until control returns from current function. If <count>
is greater than 1, repeat <count>
times. Default value of count is 1.
Returns
Nothing, if the target has stepped out of the current function. Error if the target is already running or cannot be resumed.
An information message is printed on the console when the target stops at the next address.
dis
Disassemble Instructions.
Syntax
dis <address> [num]
Disassemble <num>
instructions at address specified by <address>
The keyword "pc" can be used to disassemble instructions at current PC Default value for <num>
is 1.
Returns
Disassembled instructions if successful. Error string, if the target instructions cannot be read.
Example(s)
dis
Disassemble an instruction at the current PC value.
dis pc 2
Disassemble two instructions at the current PC value.
dis 0x0 2
Disassemble two instructions at address 0x0.
Get or set the value of an expression.
Syntax
print [options] [expression]
Get or set the value of an expression specified by <expression>
. The <expression>
can include constants, local/global variables, CPU registers, or any operator, but pre-processor macros defined through #define are not supported. CPU registers can be specified in the format {$r1}, where r1 is the register name. Elements of a complex data types like a structure can be accessed through '.' operator. For example, var1.int_type refers to int_type element in var1 struct. Array elements can be accessed through their indices. For example, array1[0] refers to the element at index 0 in array1.
Options
Option | Description |
---|---|
-add <expression> |
Add the <expression> to auto expression list. The values or definitions of the expressions in auto expression list are displayed when expression name is not specified. Frequently used expressions should be added to the auto expression list. |
-defs [expression] |
Return the expression definitions like address, type, size and RW flags. Not all definitions are available for all the expressions. For example, address is available only for variables and not when the expression includes an operator. |
-dict [expression] |
Return the result in Tcl dict format, with variable names as dict keys and variable values as dict values. For complex data like structures, names are in the form of parent.child. |
-remove [expression] |
Remove the expression from auto expression list. Only expressions previously added to the list through -add option can be removed. When the expression name is not specified, all the expressions in the auto expression list are removed. |
-set <expression> |
Set the value of a variable. It is not possible to set the value of an expression which includes constants or operators. |
Returns
The return value depends on the options used.
<none>
or -add: Expression value(s)
-defs
: Expression definition(s)
-remove or -set
: Nothing
Error string, if expression value cannot be read or set.
Example(s)
print Int_Glob
Return the value of variable Int_Glob.
print -a Microseconds
Add the variable Microseconds to auto expression list and return its value.
print -a Int_Glob*2 + 1
Add the expression (Int_Glob*2 + 1) to auto expression list and return its value.
print tmp_var.var1.int_type
Return the value of int_type element in var1 struct, where var1 is a member of tmp_var struct.
print tmp_var.var1.array1[0]
Return the value of the element at index 0 in array array1. array1 is a member of var1 struct, which is in turn a member of tmp_var struct.
print
Return the values of all the expressions in auto expression list.
print -defs
Return the definitions of all the expressions in auto expression list.
print -set Int_Glob 23
Set the value of the variable Int_Glob to 23.
print -remove Microseconds
Remove the expression Microseconds from auto expression list.
print {r1}
Return the value of CPU register r1.
locals
Get or set the value of a local variable.
Syntax
locals [options] [variable-name [variable-value]]
Get or set the value of a variable specified by <variable-name>
. When variable name and value are not specified, values of all the local variables are returned. Elements of a complex data types like a structure can be accessed through '.' operator. For example, var1.int_type refers to int_type element in var1 struct. Array elements can be accessed through their indices. For example, array1[0] refers to the element at index 0 in array1.
Options
Option | Description |
---|---|
-defs |
Return the variable definitions like address, type, size and RW flags. |
-dict [expression] |
Return the result in Tcl dict format, with variable names as dict keys and variable values as dict values. For complex data like structures, names are in the form of parent.child. |
Returns
The return value depends on the options used.
<none>
: Variable value(s)
-defs
: Variable definition(s)
Nothing, when variable value is set. Error string, if variable value cannot be read or set.
Example(s)
locals Int_Loc
Return the value of the local variable Int_Loc.
locals
Return the values of all the local variables in the current stack frame.
locals -defs
Return definitions of all the local variables in the current stack frame.
locals Int_Loc 23
Set the value of the local variable Int_Loc to 23.
locals tmp_var.var1.int_type
Return the value of int_type element in var1 struct, where var1 is a member of tmp_var struct.
locals tmp_var.var1.array1[0]
Return the value of the element at index 0 in array array1. array1 is a member of var1 struct, which is in turn a member of tmp_var struct.
backtrace
Stack back trace.
Syntax
backtrace
Return stack trace for current target. Target must be stopped. Use debug information for best result. 'bt' is alias for backtrace and can be used interchangeably.
Returns
Stack Trace, if successful. Error string, if Stack Trace cannot be read from the target.
bt
Stack back trace.
Syntax
backtrace Return stack trace for current target. Target must be stopped. Use debug information for best result. 'bt' is alias for backtrace and can be used interchangeably.
Returns
Stack Trace, if successful. Error string, if Stack Trace cannot be read from the target.
profile
Configure and run the GNU profiler.
Syntax
profile [options]
Configure and run the GNU profiler. The profiling needs to enabled while building bsp and application to be profiled.
Options
Option | Description |
---|---|
-freq <sampling-freq> |
Sampling frequency. |
-scratchaddr <addr> |
Scratch memory for storing the profiling related data. It needs to be assigned carefully, as it should not overlap with the program sections. |
-out <file-name> |
Name of the output file for writing the profiling data. This option also runs the profiler and collects the data. If file name is not specified, profiling data is written to gmon.out. |
Returns
Depends on options used.
-scratchaddr, -freq
: Returns nothing on successful configuration. Error string, in case of error.
-out
: Returns nothing, and generates a file. Error string, in case of error.
Example(s)
profile -freq 10000 -scratchaddr 0
Configure the profiler with a sampling frequency of 10000 and scratch memory at 0x0.
profile -out testgmon.out
Output the profile data in testgmon.out.
mbprofile
Configure and run the MB profiler.
Syntax
mbprofile [options]
Configure and run the MB profiler, a non-intrusive profiler for profiling the application running on MB. The output file is generated in gmon.out format. The results can be viewed using gprof editor. In case of cycle count, an annotated disassembly file is also generated clearly marking time taken for execution of instructions.
Options
Option | Description |
---|---|
-low <addr> |
Low address of the profiling address range. |
-high <addr> |
High address of the profiling address range. |
-freq <value> |
Microblaze clock frequency in Hz. Default is 100MHz. |
-count-instr |
Count no. of executed instructions. By default no. of clock cycles of executed instructions are counted. |
-cumulate |
Cumulative profiling. Profiling without clearing the profiling buffers. |
-start |
Enable and start profiling. |
-stop |
Disable/stop profiling. |
-out <filename> |
Output profiling data to file. <filename> Name of the output file for writing the profiling data. If file name is not specified, profiling data is written to gmon.out. |
Returns
Depends on options used. -low, -high, -freq, -count-instr, -start, -cumulate Returns nothing on successful configuration. Error string, in case of error.
-stop
: Returns nothing, and generates a file. Error string, in case of error.
Example(s)
mbprofile -low 0x0 -high 0x3FFF
Configure the mb-profiler with address range 0x0 to 0x3FFF for profiling to count the clock cycles of executed instructions.
mbprofile -start
Enable and start profiling.
mbprofile -stop -out testgmon.out
Output the profile data in testgmon.out.
mbprofile -count-instr
Configure the mb-profiler to profile for entire program address range to count no. of instructions executed.
mbtrace
Configure and run MB trace.
Syntax
mbtrace [options]
Configure and run MB program and event trace for tracing the application running on MB. The output is the disassembly of the executed program.
Options
Option | Description |
---|---|
-start |
Enable and start trace. After starting trace the execution of the program is captured for later output. |
-stop |
Stop and output trace. |
-con |
Output trace after resuming execution of active target until a breakpoint is hit. Atleast one breakpoint or watchpoint must be set to use this option. This option is only available with embedded trace. |
-stp |
Output trace after resuming execution of the active target until control reaches instruction that belongs to different line of source code. |
-nxt |
Output trace after resuming execution of the active target until control reaches instruction that belongs to a different line of source code, but runs any functions called at full speed. |
-out <filename> |
Output trace data to a file. <filename> Name of the output file for writing the trace data. If not specified, data is output to standard output. |
-level <level> |
Set the trace level to "full", "flow", "event", or "cycles". If not specified, "flow" is used. |
-halt |
Set to halt program execution when the trace buffer is full. If not specified, trace is stopped but program execution continues. |
-save |
Set to enable capture of load and get instruction new data value. |
-low <addr> |
Set low address of the external trace buffer address range. The address range must indicate an unused accessible memory space. Only used with external trace. |
-high <addr> |
Set high address of the external trace buffer address range. The address range must indicate an unused accessible memory space. Only used with external trace. |
-format <format> |
Set external trace data format to "mdm", "ftm", or "tpiu". If format is not specified, "mdm" is used. The "ftm" and "tpiu" formats are output by Zynq-7000 PS. Only used with external trace. |
Returns
Depends on options used. -start, -out, -level, -halt -save, -low, -high, -format Returns nothing on successful configuration. Error string, in case of error.
-stop, -con, -stp, -nxt
: Returns nothing, and outputs trace data to a file or standard output. Error string, in case of error.
Example(s)
mbtrace -start
Enable and start trace.
mbtrace -start -level full -halt
Enable and start trace, configuring to save complete trace instead of only program flow and to halt execution when trace buffer is full.
mbtrace -stop
Stop trace and output data to standard output.
mbtrace -stop -out trace.out
Stop trace and output data to trace.out.
mbtrace -con -out trace.out
Continue execution and output data to trace.out.