8.3 Running a debug session from a script

To automate a debug session from a script, create a text file with a .ds file extension and list, line-by-line, the debugger commands that you want to execute. Then, use the debugger command to run the script.

Debugger script format

The script is a text file with a .ds file extension. The debugger commands are listed one after the other in the file.

Things to remember when you create a .ds script file.

  • The script file must contain only one command on each line.
  • If required, you can add comments using #.
  • Commands are not case-sensitive.
  • The .ds file extension must be used for a DS-5 Debugger script.

Tip:

If you are using the DS-5 graphical user interface (GUI) to perform your debugging, a full list of all the DS-5 Debugger commands generated during a debug session is recorded in the History view. You can select the commands that you want in your script file and right-click and select Save selected lines as a script... to save them to a file.

Example 8-2 Examples

A simple sample script file is shown below:

# Filename: myScript.ds
# Initialization commands
load file "struct_array.axf"  # Load image and symbols
break main                    # Set breakpoint at main()
break *0x814C                 # Set breakpoint at address 0x814C
# Run to breakpoint and print required values
run                           # Start running device
wait 0.5s                     # Wait or time-out after half a second
info stack                    # Display call stack
info registers                # Display info for all registers
# Continue to next breakpoint and print required values
continue                      # Continue running device
wait 0.5s                     # Wait or time-out after half a second
info functions                # Displays info for all functions
info registers                # Display info for all registers
x/3wx 0x8000                  # Display 3 words of memory from 0x8000 (hex)
delete 1                      # Delete breakpoint number 1
delete 2                      # Delete breakpoint number 2

Running a DS-5 script

After creating the script, use the debugger command to run the script using the command-line interface.

On Windows, use the DS-5 Command Prompt. On Linux, set the required environment variables, and use the UNIX shell.

There are two scenarios where you might run scripts:

  • You have set up your target and it is connected to DS-5.

    In this case, use the source command to load your script.

  • You are yet to configure the target and connect to it.

    In this case, you have to use the appropriate debugger options and arguments to configure and connect to your target. Along with the configuration options, use the --script= filename option to run your script.

    For example:

    debugger --cdb-entry "ARM Development Boards::Versatile Express A9x4::Bare Metal Debug::Bare Metal SMP Debug of all cores::Debug Cortex-A9x4 SMP::DSTREAM"--cdb-entry-param "Connection=TCP:10.5.20.64" --cdb-entry-param "dtsl_options_file=C:\DS-5_Workspace\my_dtsl_settings.dtslprops" --script= C:\DS-5_Workspace\my_script.txt

    See Specifying a custom configuration database using the command-line and Capturing trace data using the command-line debugger for examples of how debugger options and arguments are used.

Non-ConfidentialPDF file icon PDF versionARM DUI0446Z
Copyright © 2010-2016 ARM Limited or its affiliates. All rights reserved.