Presentation is loading. Please wait.

Presentation is loading. Please wait.

S OME USEFUL D EBUG C OMMANDS FOR C LEAR -S PEED S OFTWARE D EVELOPMENT K IT -- COMMANDS FROM CHAP.7 By: Pallav Laskar.

Similar presentations


Presentation on theme: "S OME USEFUL D EBUG C OMMANDS FOR C LEAR -S PEED S OFTWARE D EVELOPMENT K IT -- COMMANDS FROM CHAP.7 By: Pallav Laskar."— Presentation transcript:

1 S OME USEFUL D EBUG C OMMANDS FOR C LEAR -S PEED S OFTWARE D EVELOPMENT K IT -- COMMANDS FROM CHAP.7 By: Pallav Laskar

2 cscn –o mandelbrot.csx –g mandelbrotcp.cn --to compile program with debug support. csgdb mandelbrot.csx -- to Start debugging A message is displayed along with the current location of the program counter. List To view the program source. -> list -> set listsize 10

3 break 22 --to set a new break point -> break main -- to set a break around a function -> break info --to get info around all break points that have been set -> tbreak Gets deleted once hit by execution

4 run -- start running the program till the break point is reached. print (mono or poly) To view the state of all variables when the break point is reached. -> print /d --to print integer value of the variable -->set print elements Where Find the current location of the program counter while debugging. Whatis gives the data type of the variable name used delete

5 Next -- take the program counter to the next line of execution continue Run till the end of the program is reached. Step Differs from next because it steps into function call rather than stepping over.

6 Print &x print the address of variable x If address is $8p4 then print/f $8p4 Will give the value of x print/f $8p4[5] If x is poly then the above content will print the content of the 5 th register.

7 (gdb)step calcres (x=-1.5, y= {-1.25, -1.22395837, -1.19791663, - 1.171875, - 1.14583337, -1.11979163, -1.09375, -1.06770837, -1.04166663, - 1.015625, - 0.989583373, -0.963541687, ……….},res=64) at mandelbrot.cn:52 52 xcal=x; Stop at the first valid line of code for the function calcres which is line number 52.

8 To limit the number of display of PE’s (gdb) set print elements 4 (gdb) where #0 calcres (x=-1.5, y={-1.25, -1.22395837, -1.19791663, - 1.171875...}, res=64) at mandelbrot.cn:52 #1 0x800155a0 in main () at mandelbrot.cn:113

9 regs and peregs: The whole mono and poly register set can be viewed using the two above commands. Step: progress the debugger to the function up: To move up the call stack and back to main use the up command.

10 print/x $pc Print the program counter (PC) at the current location down Move back down the call stack into function using the down command p/x $enable To view the enable state of the poly array

11 Viewing the poly enable state Print the value of the enable register in the debugger: (gdb) p/x $enable $2 = {0xff } (gdb)p/t $enable Print the value of the enable state in binary -- 11111111 }. This show that all 96 of the PEs are currently enabled at every level. --{11111110 }.PEs are currently disabled:

12 Attaching a command to a breakpoint commands 4 Attaching a command to a breakpoint (gdb) commands 4 Type commands for when breakpoint 4 is hit, one per line. End with a line saying just "end". >print/t $enable >end (gdb) commands 5 Type commands for when breakpoint 5 is hit, one per line. End with a line saying just "end". >print/t $enable >end

13  (gdb) info break  Num Type Disp Enb Address What  1 breakpoint keep y 0x80015470 in main at mandelbrot.cn:96  breakpoint already hit 1 time  4 breakpoint keep y 0x800150ec in terminate at  mandelbrot.cn:34  breakpoint already hit 1 time  print/t $enable  5 breakpoint keep y 0x80015138 in terminate at  mandelbrot.cn:36  breakpoint already hit 1 time  print/t $enable

14 Finish debugger can return from a function by using the finish command ignore 6 20 Will ignore next 20 crossings of breakpoint 6.

15 Viewing memory List 2 integers at the current PC location in mono memory using the x command: (gdb) x/2x $pc 0x800155f0 : 0x04000060 0x88280940 (gdb) The argument “2” determines the number of values to print and the “x” specifies that the output is hexadecimal. pex/2x 0x0  pex/2x 0x0 0..10  pex/4x &buffer 33..63

16  Enter the same pex command again but add the argument 0..10 to the end.  (gdb) pex/2x 0x0 0..10  (PE 0) 0x0 : 0xdead2222 0x00000000  (PE 1) 0x0 : 0xdead2222 0x00000000  (PE 2) 0x0 : 0xdead2222 0x00000000  (PE 3) 0x0 : 0xdead2222 0x00000000  (PE 4) 0x0 : 0xdead2222 0x00000000  (PE 5) 0x0 : 0xdead2222 0x00000000  (PE 6) 0x0 : 0xdead2222 0x00000000  (PE 7) 0x0 : 0xdead2222 0x00000000  (PE 8) 0x0 : 0xdead2222 0x00000000  (PE 9) 0x0 : 0xdead2222 0x00000000  (PE 10) 0x0 : 0xdead2222 0x00000000  (gdb)  You can now see 2 integer values for each of the first 11 processing elements.


Download ppt "S OME USEFUL D EBUG C OMMANDS FOR C LEAR -S PEED S OFTWARE D EVELOPMENT K IT -- COMMANDS FROM CHAP.7 By: Pallav Laskar."

Similar presentations


Ads by Google