UC3M

Telematic/Audiovisual Syst./Communication Syst. Engineering

Systems Architecture

September 2017 - January 2018

16.3.  Viewing the Code

Any part of the source code can be shown in the screen through the list command (abbreviated as l). With no options, the command shows ten lines of code starting at the point in which the execution is suspended. If the program is not executing yet, the first ten lines of the main function are shown. This command accepts options to show any line in a function, a file, or even the code stored at a certain memory location. The help list command shows all possible options.

(gdb) l main
32          }
33        }
34        return 0;
33      }
36
37      int main(int argc, char **argv) 
38      {
39        unit_ptr buf;
40
41        buf = (unit_ptr)calloc(SIZE, sizeof(struct data_unit));
42        function(buf)
(gdb)