s ome useful d ebug c ommands for c lear -s peed s oftware d evelopment k it -- commands from chap.7...
TRANSCRIPT
![Page 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](https://reader035.vdocuments.us/reader035/viewer/2022062423/5697bfbd1a28abf838ca23be/html5/thumbnails/1.jpg)
SOME USEFUL DEBUG COMMANDS FOR CLEAR-SPEED SOFTWARE DEVELOPMENT KIT--COMMANDS FROM CHAP.7
By:
Pallav Laskar
![Page 2: 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](https://reader035.vdocuments.us/reader035/viewer/2022062423/5697bfbd1a28abf838ca23be/html5/thumbnails/2.jpg)
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 <enter>To view the program source.-> list <function name> <enter> ->set listsize 10
![Page 3: 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](https://reader035.vdocuments.us/reader035/viewer/2022062423/5697bfbd1a28abf838ca23be/html5/thumbnails/3.jpg)
break 22<line number> --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 -> tbreakGets deleted once hit by execution
![Page 4: 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](https://reader035.vdocuments.us/reader035/viewer/2022062423/5697bfbd1a28abf838ca23be/html5/thumbnails/4.jpg)
run -- start running the program till the break point is
reached.print <variablename> (mono or poly)To view the state of all variables when the break
point is reached.-> print /d <variablename>--to print integer value of the variable -->set print elements <number>WhereFind the current location of the program counter
while debugging.Whatis <variablename> gives the data type of
the variable name useddelete <breakpointnumber>
![Page 5: 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](https://reader035.vdocuments.us/reader035/viewer/2022062423/5697bfbd1a28abf838ca23be/html5/thumbnails/5.jpg)
Next -- take the program counter to the next line of
executioncontinueRun till the end of the program is reached.StepDiffers from next because it steps into function call
rather than stepping over.
![Page 6: 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](https://reader035.vdocuments.us/reader035/viewer/2022062423/5697bfbd1a28abf838ca23be/html5/thumbnails/6.jpg)
Print &x print the address of variable x<mono or poly>If address is $8p4thenprint/f $8p4 Will give the value of x<value stored at x>print/f $8p4[5] If x is poly then the above content will print the
content of the 5th register.
![Page 7: 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](https://reader035.vdocuments.us/reader035/viewer/2022062423/5697bfbd1a28abf838ca23be/html5/thumbnails/7.jpg)
(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:5252 xcal=x;Stop at the first valid line of code for the function
calcres which is line number 52.
![Page 8: 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](https://reader035.vdocuments.us/reader035/viewer/2022062423/5697bfbd1a28abf838ca23be/html5/thumbnails/8.jpg)
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
![Page 9: 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](https://reader035.vdocuments.us/reader035/viewer/2022062423/5697bfbd1a28abf838ca23be/html5/thumbnails/9.jpg)
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.
![Page 10: 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](https://reader035.vdocuments.us/reader035/viewer/2022062423/5697bfbd1a28abf838ca23be/html5/thumbnails/10.jpg)
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
![Page 11: 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](https://reader035.vdocuments.us/reader035/viewer/2022062423/5697bfbd1a28abf838ca23be/html5/thumbnails/11.jpg)
Viewing the poly enable statePrint the value of the enable register in the
debugger: (gdb) p/x $enable $2 = {0xff <repeats 96 times>}
(gdb)p/t $enable Print the value of the enable state in binary--11111111 <repeats 96 times>}. This show that
all 96 of the PEs are currently enabled at every level.
--{11111110 <repeats 96 times>} .PEs are currently disabled:
![Page 12: 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](https://reader035.vdocuments.us/reader035/viewer/2022062423/5697bfbd1a28abf838ca23be/html5/thumbnails/12.jpg)
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
![Page 13: 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](https://reader035.vdocuments.us/reader035/viewer/2022062423/5697bfbd1a28abf838ca23be/html5/thumbnails/13.jpg)
(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
![Page 14: 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](https://reader035.vdocuments.us/reader035/viewer/2022062423/5697bfbd1a28abf838ca23be/html5/thumbnails/14.jpg)
Finishdebugger can return from a function by using the
finish command ignore 6 20 Will ignore next 20 crossings of breakpoint 6.
![Page 15: 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](https://reader035.vdocuments.us/reader035/viewer/2022062423/5697bfbd1a28abf838ca23be/html5/thumbnails/15.jpg)
Viewing memory List 2 integers at the current PC location in mono
memory using the x command: (gdb) x/2x $pc 0x800155f0 <main+408>: 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
![Page 16: 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](https://reader035.vdocuments.us/reader035/viewer/2022062423/5697bfbd1a28abf838ca23be/html5/thumbnails/16.jpg)
Enter the same pex command again but add the argument 0..10 to the end. (gdb) pex/2x 0x0 0..10 (PE 0) 0x0 <__FRAME_BEGIN_POLY__>: 0xdead2222 0x00000000 (PE 1) 0x0 <__FRAME_BEGIN_POLY__>: 0xdead2222 0x00000000 (PE 2) 0x0 <__FRAME_BEGIN_POLY__>: 0xdead2222 0x00000000 (PE 3) 0x0 <__FRAME_BEGIN_POLY__>: 0xdead2222 0x00000000 (PE 4) 0x0 <__FRAME_BEGIN_POLY__>: 0xdead2222 0x00000000 (PE 5) 0x0 <__FRAME_BEGIN_POLY__>: 0xdead2222 0x00000000 (PE 6) 0x0 <__FRAME_BEGIN_POLY__>: 0xdead2222 0x00000000 (PE 7) 0x0 <__FRAME_BEGIN_POLY__>: 0xdead2222 0x00000000 (PE 8) 0x0 <__FRAME_BEGIN_POLY__>: 0xdead2222 0x00000000 (PE 9) 0x0 <__FRAME_BEGIN_POLY__>: 0xdead2222 0x00000000 (PE 10) 0x0 <__FRAME_BEGIN_POLY__>: 0xdead2222 0x00000000 (gdb) You can now see 2 integer values for each of the first 11 processing
elements.