Debugger Dbx and Xdbx trace execute trace line
Debugger Dbx and Xdbx
trace ��������� execute ������� trace ������ line tracing: trace #trace each source line trace in<proc> #trace each source line while in proc trace [at] <#line> #trace given source line
trace call tracing: trace <proc> #trace cals to the peocedure trace inmember<func> #trace call to any member function name trace infunction<func> #trace when function name is called trace in class #trace calls to any member function of class
trace value tracing: trace <exp> at <line#> # print <exp> when <line> is reached trace<var>[in<proc>] # trace changes to the variable
Stop at<line< ��������� execute ��� � operation ������� set breakpoint stop at <line> #stop execute at the line )dbx) stop at 49 [1]stop at “foo. f”: 49 )dbx(
stop in<proc< ��������� execute �������� set breakpoint �������� )dbx) stop in foobar [2]stop in foobar )dbx(
list <line>, <line> -list source lines ��������� source code ��� argument line ��������� ���� )dbx) list 3 # 1 include<stdio. h< 2 main(argc, argv(
Print print <exp> - print the value of the expression ใชเพอแสดงคาของตวแปร )dbx) stop at 19 )dbx) run 20 )dbx. X print var 1 1000
print expression (dbx) print y(i+1) + 2 3. 0 (dbx)
Step �������� excute statement ������� execute ���� step
delete คำสง delete <number> - remove trace or stop of given number คำสง delete ใชเพอลบลำดบคำสงท debugger เกบไวใน list เชน (dbx) delete 1 (dbx) status [2] stop in foobar (dbx)
next �������� execute ���� step �� next #step one line (step OVER calls( next<n> #step <n> lines (skip OVER calls(
cont คำสง cont - continue execution
การเปด dbx มาใชงาน • ทำการพมพวา shell prompt debugger ท command • หรอ double click ท debugger icon ใน SPARC works/Pro. Works Manager
Graphical overview | | | Menu item information fields source display button commands command pane program input / output windows
program input / output windows ใช program input /output Windows เพอเตรยม interface คำสง I/O สำหรบโปรแกรม ซงมนจะไมเขาไปยงกบ dbx interaction ใน command window ใชรบและแสดง input ของการใช dbx ในการ debugging program
การเรม debugger จาก command tool เพอเรม debugger จาก windows command tool (หรอ Shel tool) §ท Prompt พมพ % debugger [-options] [program_name [corefile | process_id] ]
| เลอก load จากโปรแกรม menu. เพอแสดง program loader Program Load Visit. . Make List Module Input /Output |click ทชอ filename เพอเลอกโปรแกรม แลว click ท load
The breakpoint menu Breakpoint menu ประกอบดวย item สำหรบ set ชนดของ breakpoint Breakpoint Stop At <line> Stop In <func> Stop in Member Stop in Class Stop in Function Stop <variable> Clear clear All List Breakpoints
Stop At <line> - sets breakpoint at select line. stop in <func>-sets breakpoint in selected procedure or function stop in member<func>-sets breakpoint in all member function with same name as selected member function across all classes stop in class<class>-sets breakpoint in all member function of <class> stop in function <func>-sets breakpoint in all top level function with same name (overloaded) as selected top level function stop<variable>-sets breakpoint at a change in the value of the specified<variable> clear<line> -clear breakpoint at select line clear-clear breakpoint at current stop location (regardless of current selection ) clear all breakpoints-clears breakpoint at all location List breakpoint-list all current active breakpoint and trace
การ set breakpoint |Setting a Breakpoint at line of source code เลอกตวอกษรตวใดตวหนงในบรรทดแลวเลอก Stop At <line> จาก breakpoint menu
|Setting a Breakpoint in function เลอกชอ Function แลวเลอก stop In<func> จาก breakpoint menu
Clearing a breakpoint at a line เพอทำการ clear breakpoint ท ระบใน แต ละบรรทดทำ ได ดงน |เลอก บรรทดใน source display ท ถก set breakpoint |เลอก clear <line> จาก breakpoint menu
Running a program without argument เพอทจะ run โปรแกรมใน debugger โดยไมม argu |เลอกท execution จาก menu แลวเลอก run with argum Adding argument to the run command |เลอกท execution จาก menu แลวเลอก run with argument หลงจากนนใส argument ท debugger windows ดงภาพ
Adding argument to the run command เลอกท execution จาก menu แลวเลอก run with argument หลงจากนนใส argument ท debugger windows ดงภาพ
Next and Step
Reference Ramkrishna S. Tare , UNIX Utilities, Mc. GRAW-HILL International Editor 1988 workshop SPARC work 3. 1, Debugging a program , Sun. Soft inc , 1995 http: //www. physics. utah. edu/~p 573/hamlet/lessons/dbx/node 19. html
- Slides: 50