Debug Tutorial: How to View Source Code

Command syntax:
list [ context ] [ start_line | procedure ] [ count ]

Source files are automatically searched for in the current directory. The use command should be used to add other directories to be searched or to change the order in which the paths are to be searched.


Examples:

In this example, list was given no arguments so the source listing will begin at the current point of execution for each process. Process 0 is stopped at line 7 while the other processes are at line 16.

(all) > list
***** (0) *****
./hello.c
* 7    int a = 0;
  8    int *ptr;
  9 
* 10    i++;
* 11    b=4;
* 12    i = a+b;
* 13 }
  14 
  15 main()
* 16 {
  17    int i;
***** (1..3) *****
./hello.c
* 16 {
  17    int i;
* 18    int p1 = 555;
* 19    int p2 = 1234;
  20 
* 21    printf("Hello has started on %d\n", mynode());
* 22    one( p1 );
* 23    printf("mystring=\"%s\"\n", mystring);
* 24 }

In this example, a disassembly is requested for procedure one.

(all) > listi one
  ***** (all) *****
  hello.c{}one(int)#5
00020130: 83ec0c                 sub      0xc,esp
00020133: 896c2408               mov      ebp,8(esp)
00020137: 8d6c2408               lea      8(esp),ebp
  hello.c{}one(int)#7
0002013b: c745fc00000000         mov      0x0,-4(ebp)
  hello.c{}one(int)#10
00020142: 8b4508                 mov      8(ebp),eax
00020145: 40                     inc      eax
00020146: 894508                 mov      eax,8(ebp)
  hello.c{}one(int)#11
00020149: c745f804000000         mov      0x4,-8(ebp)
  hello.c{}one(int)#12
00020150: 8b45f8                 mov      -8(ebp),eax
00020153: 0345fc                 add      -4(ebp),eax
00020156: 894508                 mov      eax,8(ebp)
  hello.c{}one(int)#13
00020159: 89ec                   mov      ebp,esp
0002015b: 5d                     pop      ebp
0002015c: c3                     ret      

Intel Tutorial Notes Previous -- Next
Acknowledgement and Disclaimer