Oracle Solaris Studio 12.2 dbxtool 2010 9
2 2 3 dbxtool 7 15 24 44 dbx (GUI) dbxtool dbx C++ Oracle Solaris Studio 12.2 examples/debugger/debug_tutorial 1. cp -r /opt/solstudio12.2/examples/debugger/debug_tutorial ~/debug_tutorial 2. make CC -g -c main.cc CC -g -c interp.cc CC -g -c cmd.cc CC -g -c debugger.cc CC -g -c cmds.cc CC -g main.o interp.o cmd.o debugger.o cmds.o -o a.out cmd.h cmd.cc Cmd interp.h interp.cc Interp debugger.h debugger.cc Debugger cmds.h cmds.cc main.h main.cc main() Interp Interp Interp dbx $ a.out > exec date Sun Jun 21 16:13:06 PDT 2009 > display var will display var > stop in X > run running... Oracle Solaris Studio 12.2 dbxtool 2
stopped in X var={ a = 100 b = 101 c = <error> d = 102 e = 103 f = 104 } > quit Goodby $ dbxtool dbxtool installation_directory/bin/dbxtool dbxtool Web dbxtool dbxtool : Oracle Solaris Studio 12.2 dbxtool 3
(Small Toolbar Icons) (Call Stack) : 1. (Call Stack) 2. (Call Stack) (Call Stack) Oracle Solaris Studio 12.2 dbxtool 4
3. (Call Stack) (Call Stack) (Call Stack) (Call Stack) 4. Oracle Solaris Studio 12.2 dbxtool 5
(Breakpoints) : 1. (Breakpoints) 2. (Breakpoints) Oracle Solaris Studio 12.2 dbxtool 6
(Process I/O) : 1. (Process I/O) dbxtool dbxtool 2. dbxtool (Process I/O) (Process I/O) (Dock window) (Editor) 1. (Tools) > (Options) 2. (Options) (Fonts & Colors) 3. (Syntax) (Languages) 4. (Font) 5. (Font Chooser) OK 6. (Options) OK dbx (Dbx Console) ( I/O) ANSI 1. (Tools) > (Options) 2. (Options) (Miscellaneous) 3. (Terminal) 4. (Font Size) (To Type) 5. OK dbxtool $ a.out > display var will display var > Segmentation Fault (core dumped) $ dbxtool $ dbxtool a.out core Oracle Solaris Studio 12.2 dbxtool 7
dbxtool dbx dbxtool Oracle Solaris Studio 12.2 dbxtool 8
Dbx (Dbx Console) Oracle Solaris Studio 12.2 dbxtool 9
program terminated by signal SEGV (no mapping at fault address) 0xff0318f0: strcmp+0x0170: ld [%ol], %gl Current function is Interp::find strcmp() SEGV dbx (Call Stack) (Call Stack) strcmp() 2 0x0 name NULL (Editor) strcmp() ( ) dbx stack_verbose.dbxrc (Call Stack) (Verbose) Oracle Solaris Studio 12.2 dbxtool 10
strcmp() (Variables) (Variables) Oracle Solaris Studio 12.2 dbxtool 11
name NULL SEGV (*cp)->name() (Variables) cp (cp*) name "quit" *cp.dbxrc dbx output_inherited_members (Inherited Members) (Editor) strcmp() name name NULL Oracle Solaris Studio 12.2 dbxtool 12
(*cp)->name() (Editor) name NULL Interp::find() (Debug) > (Stack) > (Make Caller Current) (Make Caller Current) Oracle Solaris Studio 12.2 dbxtool 13
(Call Stack) Interp::dispatch() (Editor) argv[0] NULL Oracle Solaris Studio 12.2 dbxtool 14
(Process I/O) dbxtool 1. (Run) Dbx (Dbx Console) run 2. (Process I/O) SEGV 3. (Discard and Pause) (Editor) Interp::find() strcmp() 4. (Make Caller Current) Interp::dispatch() find() (Show Line Numbers) 127 Oracle Solaris Studio 12.2 dbxtool 15
1. (Editor) Interp::dispatch 2. (Debug) > (New Breakpoint) (New Breakpoint) (New Breakpoint) Oracle Solaris Studio 12.2 dbxtool 16
(Function) 3. OK dbx Dbx (Dbx Console) stop in (dbx) stop in dispatch (4) stop in Interp::dispatch(char*) (dbx) Interp::dispatch Oracle Solaris Studio 12.2 dbxtool 17
(Breakpoints) 1. (Breakpoints) ) 2. 1 (Delete) dbx Dbx (Dbx Console) si dispatch si stop in dbx dbx ~/.dbxrc alias si stop in alias sa stop at alias s step alias n next alias r run (Breakpoint) interp.cc:127 ( (Breakpoint) (GoTo Source) 127 ) dbxtool Oracle Solaris Studio 12.2 dbxtool 18
Interp::dispatch() (Run) (Process I/O) dispatch() culprit find() argv[0] argv 1. (Editor) argv 2. (Debug) > New Watch New Watch New Watch 3. OK 4. Window > Watches Watches 5. argv Oracle Solaris Studio 12.2 dbxtool 19
argv 6. (Step Over) 2 PC int argc = 0; 7. argc argv 8. argc Watches argv Name ( ) 9. (Step Over) argc 0 Oracle Solaris Studio 12.2 dbxtool 20
10. strtok() (Step Over) NULL strtok() strtok (3) DELIMETERS/ 1 line 11. Step Over argv strtok() ( ) NULL 12. find() Signal Caught Discard and Pause Oracle Solaris Studio 12.2 dbxtool 21
13. Interp::dispatch find() a. (Make Caller Current) b. find() c. (Breakpoints) Interp::dispatch () dbxtool d. 2 141 1 14. Run Process I/O find() ( Run ) Oracle Solaris Studio 12.2 dbxtool 22
dbxtool Run dbx ( ) dbxtool 15. strtok() NULL argv[0] NULL 44 Interp::dispatch() Oracle Solaris Studio 12.2 dbxtool 23
dbx in in display nonexistent_var # should yield an error display var stop in X # will cause one "stopped" message and display stop in Y # will cause second "stopped" message and display run cont cont run cont cont $ a.out < in > display nonexistent_var error: Don t know about nonexistent_var > display var will display var > stop in X > stop in Y > run running... stopped in X var={ a = 100 b = 101 c = <error> d = 102 e = 103 f = 104 } > cont stopped in Y var={ a = 105 b = 106 c = <error> d = 107 e = 108 f = 109 } > cont exited > run running... stopped in X var={ a = 110 b = 111 error: cannot get value of var.c c = <error> Oracle Solaris Studio 12.2 dbxtool 24
d = 112 e = 113 f = 114 } > cont stopped in Y var={ a = 115 b = 116 error: cannot get value of var.c c = <error> d = 117 e = 118 f = 119 } > cont exited Goodby 1 c <error> 2 error: cannot get value of var.c error() err_silent c= <error> 1: Run) 1. 2 2. Debug > Debug Executable 3. Debug Executable 4. Arguments <in 5. Run Directory 6. Debug Oracle Solaris Studio 12.2 dbxtool 25
Arguments (Environment) Debug > (Configure Current Session) dbxtool Debug > Debug Recent) dbx Continue Run 2: error() 33 dbx Dbx Console Editor (dbx) func error func Oracle Solaris Studio 12.2 dbxtool 26
1. 33 Editor 2. Run in > display var # should yield an error error() Oracle Solaris Studio 12.2 dbxtool 27
3. Continue 3: Continue > display var # should yield an error 2 2 1. Breakpoints Customize 2. Customize Breakpoint Count Limit 2 3. OK Oracle Solaris Studio 12.2 dbxtool 28
4: 2 error() error() Customize Breakpoint Count Limit Always stop Run error() 2 1 Oracle Solaris Studio 12.2 dbxtool 29
2 runprogram ( [7]) Customize Breakpoint While In runprogram Oracle Solaris Studio 12.2 dbxtool 30
5: err_silent >0 err_silent 31 err_silent Oracle Solaris Studio 12.2 dbxtool 31
err_silent (Make Caller Current) 2 evaluatefield() evaluatefieldprepare() err_silent Make Caller Current printfield() err_silent printfield() printfieldprepare() err_silent Oracle Solaris Studio 12.2 dbxtool 32
err_silent++ err_silent-- printfieldprepare() evaluatefieldprepare() err_silent printfield() printfield () printfield() 6: printfield() 1. printfield() (New Breakpoint) 2. (Function) printfield 3. OK Oracle Solaris Studio 12.2 dbxtool 33
4. Run var.a err_silent 0 Oracle Solaris Studio 12.2 dbxtool 34
5. Continue err_silent 6. Continue err_silent printfield() printfield 1. printfield() Customize Breakpoint (Count Limit) infinity Oracle Solaris Studio 12.2 dbxtool 35
2. Breakpoints a. Breakpoints (Change Visible Columns) b. (Count) (Limit) (While In) c. OK Oracle Solaris Studio 12.2 dbxtool 36
3. error() runprogram() 4. printfield() 15 5. Count Limit (Use current Count value) printfield() 6: err_silent -1 printfield() err_silent-- err_silent++ err_silent Oracle Solaris Studio 12.2 dbxtool 37
err_silent++; err_silent--; err_silent++; err_silent--; err_silent 7: err_silent 1. err_silent (New Breakpoint) 2. (Settings) (Address) & err_silent 3. (When) (After) 4. Operation Write 5. OK Oracle Solaris Studio 12.2 dbxtool 38
6. init() err_silent 1 7. Continue init() 8. Continue init() 9. Continue init() 10. Continue stopin() -1s err_silent -1-1 (Continue) 8: 1. Breakpoint (After) (write) Customize 2. (After) (When) err_silent (After) 3. (Condition) err_silent == -1 4. OK Oracle Solaris Studio 12.2 dbxtool 39
checkthings() err_silent -1 err_silent++ err_silent else Oracle Solaris Studio 12.2 dbxtool 40
9: else 1 checkthings() checkthings() checkthings() Debug > Stack > (Pop Topmost Call) (Pop Topmost Call) err_silent checkthings() checkthings() (Step Into) checkthings() checkthings()() if err_silent -1 Oracle Solaris Studio 12.2 dbxtool 41
10: 1. err_silent++ if Oracle Solaris Studio 12.2 dbxtool 42
2. Debug > (Apply Code Changes) 3. printfield error() 4. error() Oracle Solaris Studio 12.2 dbxtool 43
15 15 NULL SEGV 1. 2. (Debug Executable) <in 3. interp.cc 130 Oracle Solaris Studio 12.2 dbxtool 44
4. Breakpoints ( ) Customize 5. Customize Breakpoint Condition token == 0 6. (Action) Run Script 7. Script assign token = line assign token = "dummy" dbx dummy line "" Oracle Solaris Studio 12.2 dbxtool 45
8. OK dbxtool dbx when at "interp.cc":130 -if token == 0 { assign token = line; } Oracle Solaris Studio 12.2 dbxtool 46
Copyright 2010 U.S. GOVERNMENT RIGHTS Programs, software, databases, and related documentation and technical data delivered to U.S. Government customers are commercial computer software or commercial technical data pursuant to the applicable Federal Acquisition Regulation and agency-specific supplemental regulations. As such, the use, duplication, disclosure, modification, and adaptation shall be subject to the restrictions and license terms set forth in the applicable Government contract, and, to the extent applicable by the terms of the Government contract, the additional rights set forth in FAR 52.227-19, Commercial Computer Software License (December 2007). Oracle America, Inc., 500 Oracle Parkway, Redwood City, CA 94065. redundancy Oracle Java Oracle Corporation AMD Opteron AMD AMD Opteron Advanced Micro Devices, Inc. Intel Intel Xeon Intel Corporation SPARC SPARC International, Inc. UNIX X/Open Company, Ltd. 821-2503 Oracle Corporation 500 Oracle Parkway, Redwood City, CA 94065 U.S.A.