Escape Sequences

This topic describes the usage of the following symbols used in the debugger commands:

  • Double quotation mark "

  • Newline \n

  • Backslash \

To use these symbols in a string variable of a debugger command, the symbols " and \n must be escaped by a backslash \. The backslash \ itself must only be escaped if it is used together with the symbol \n or " (\", \\n) or if the backslash is used in pathnames. The following two examples demonstrate the escaping.

Example 1

  1. The following command prints Hello world in the Console window.

    PRINT "Hello world\n"
  2. The following command defines the button PR. If the button PR is pressed, the command PRINT "Hello world\n" is executed. Since the command DEFINE BUTTON contains a string variable, the symbols " and \n must be escaped. The bold printed letters are inserted to create this button.

    DEFINE BUTTON PR  " Print \"Hello world\\n\"  \n"
  3. The following command defines the macro out. If the macro out is executed by entering @out in the Console window, the button PR is created. Clicking the button PR executes the command PRINT "Hello world\n". Since the command DEFINE MACRO contains a string variable, the symbols " and \n must be escaped. Note that every " and \n must be escaped! The bold printed letters are inserted to create this macro.

    DEFINE MACRO out " DEFINE BUTTON PR \"PRINT \\\"Hello world\\\\n\\\"\\n\" "

Example 2

  1. The following command loads the hex file test.hx located in the directory c:\samples\testdir\v100\debug. Note that the backslash contained in the pathname must be escaped!

    LOAD /HEX of " C:\\samples\\testdir\\v100\\debug\\test"
  2. The following command defines the button LO. If the button LO is pressed, the hex file test.hx located in the directory c:\samples\testdir\v100\debug is loaded. The bold printed letters are inserted to create this button.

    DEFINE BUTTON LO " LOAD /HEX of \"c:\\\\samples\\\\testdir\\\\v100\\\\debug\\\\test\"  \n"

Example 3

The following command loads the symbol file DxeCore.efi located in the directory c:\temp\ into the debugger memory. Note that the \t contained in the pathname would be interpreted as a whitespace. Use the forward slash instead to pass the correct path to the debugger.

LOAD /NOLOAD /OFFSET = 0xeb47000 OF "c:/temp/DxeCore.efi"

Note

It is recommended to use forward slashes for file paths.

See Also

For more complete information about compiler optimizations, see our Optimization Notice.