Supported on windows
Supported on linux
Supported on embedded
Supported on android

undisplay command

Removes an auto-displayed expression previously set with the display command.

Syntax

udisplay [Expression number]
undisplay

Parameters

Expression number
Specifies the number of the expression (as reported by the display) command that should be removed. If no expression number specified, the undisplay command will remove all auto-displayed expressions.

Examples

We will demonstrate the undisplay command using a basic program that displays its arguments in a loop:

#include <stdio.h>

int main(int argc, char **argv)
{
  for(int i = 0; i < argc; i++)
    printf("Arg %d: %s\n", i, argv[i]);
  return 0;
}

We will use the display command to let GDB display the value of the loop counter and the currently displayed argument after each step and then use the undisplay command to remove some of those expressions:

(gdb) set args arg1 arg2 arg3
(gdb) start
Temporary breakpoint 1 at 0x8048426: file test.cpp, line 5.
Starting program: /home/bazis/test arg1 arg2 arg3

Temporary breakpoint 1, main (argc=4, argv=0xbffff024) at test.cpp:5
5 for(int i = 0; i < argc; i++)
(gdb) next
6 printf("Arg %d: %si, argv[i]);
(gdb) display/x i
1: /x i = 0x0
(gdb) display argv[i]
2: argv[i] = 0xbffff204 "/home/bazis/test"
(gdb) next
Arg 0: /home/bazis/test
5 for(int i = 0; i < argc; i++)
2: argv[i] = 0xbffff204 "/home/bazis/test"
1: /x i = 0x0
(gdb) next
6 printf("Arg %d: %si, argv[i]);
2: argv[i] = 0xbffff215 "arg1"
1: /x i = 0x1
(gdb) display
2: argv[i] = 0xbffff215 "arg1"
1: /x i = 0x1
(gdb) undisplay 1
(gdb) next
Arg 1: arg1
5 for(int i = 0; i < argc; i++)
2: argv[i] = 0xbffff215 "arg1"
(gdb) next
6 printf("Arg %d: %si, argv[i]);
2: argv[i] = 0xbffff21a "arg2"
(gdb) undisplay
Delete all auto-display expressions? (y or n) y
(gdb) next
Arg 2: arg2
5 for(int i = 0; i < argc; i++)
(gdb) next
6 printf("Arg %d: %si, argv[i]);
(gdb) print i
$1 = 3

Compatibility with VisualGDB

Normally you don't need to use the undisplay command under VisualGDB. Use the Watch window in Visual Studio instead.

See also