Setting up the debugger options

    Debugger tab picture

    You can change the debugger appearance and behavior if you use the command System|Options. A dialog will appear. There are several sections in this dialogs with two which are interesting for a debugging - the sections Colors and Debug.

    you can change the colors which are used for the line with a breakpoint and for the current line (the line which is going to be executed in the debugger).

    there are two fields - show array indexes and depth of recursive watching. The first one determines whether the indexes of array fields are displayed while showing a contents of an array in the Watches, Locals or Call Stack windows. The second field says to the debugger how deep it has to try to get when getting a value of some variable. Default value is 2.

    We will try to explain a meaning of these fields more precisely. Image that there is such a (nonsense) application

            class A {
                    int array[];
                    
                    A(int size) {
                            array = new int[size];
                            for(int i = 0; i < size; i++)
                                    array[i] = 2*i;
                    }
            }
    
            class B {
                    int x = 9;
                    A a = new A(4);
            }
    
            class C {
                    B b = new B();
            }
    
            class MainClass {
                    public static void main(String args) {
                            C c = new C();
                            System.exit(0);
                    }
            }
    
    
    

    Now imagine that you start the debugger and it will stop on the line with the text "System.exit(0)". Now you imagine that you have set a watch "c" (see the chapter "Watching the state of the application", the field show array indexes is checked and the field depth of the recursive watching is set to 4. Now the debugger will show this value in the Watches window

    c: {b: {x: 9, a: {array: [0: 0, 1: 2, 2: 4, 3: 6]}}}

    If you clear the checkbox show array indexes the value will look like this

    c: {b: {x: 9, a: {array: [0, 2, 4, 6]}}}

    And finally if you change the depth of recursive watching to the default value 2 the output will look like this

    c: {b: {x: 9, a: {...}}}