During the execution of a command file or a user-defined command, normal GDB output is suppressed; the only output that appears is what is explicitly printed by the commands in the definition. This section describes three commands useful for generating exactly the output you want.
echo text
echo This is some text\n\ which is continued\n\ onto several lines.\nproduces the same output as
echo This is some text\n echo which is continued\n echo onto several lines.\n
output expression
output/fmt expression
print
. See section Output formats, for more information.
printf string, expressions...
printf (string, expressions...);For example, you can print two values in hex like this:
printf "foo, bar-foo = 0x%x, 0x%x\n", foo, bar-fooThe only backslash-escape sequences that you can use in the format string are the simple ones that consist of backslash followed by a letter.