Академический Документы
Профессиональный Документы
Культура Документы
Subtitle
Title 1
Copyright 2000 OPNET Technologies, Inc.
Goals
Develop a sensible approach to debugging Teach use of OPNET Debugger (ODB) How to debug models Review features and commands Discuss the debugging process Step-by step methods for debugging models
Title 2
Copyright Copyright 2000 OPNET Technologies, Inc. 2000 OPNET Technologies, Inc.
Items Not Covered Will not cover C programming Segmentation violation Bus error
These topics are covered in the session Debugging Simulation Models Advanced.
Title 3
Copyright Copyright 2000 OPNET Technologies, Inc. 2000 OPNET Technologies, Inc.
Prerequisites
Familiarity with OPNET Modeler model hierarchy Creating process models Running simulations
Title 4
Copyright Copyright 2000 OPNET Technologies, Inc. 2000 OPNET Technologies, Inc.
Agenda
Interpreting error messages Identifying the problem Using the OPNET Debugger (ODB) Viewing animation for debugging
Title 5
Copyright Copyright 2000 OPNET Technologies, Inc. 2000 OPNET Technologies, Inc.
The Challenge
Debugging is like finding a needle in a haystack Narrow down the problem Time (event number) Space (code segment) Different types of problems
Structural Simulation fails to execute successfully. Illustrated in Lab 1 Simulation completes successfully, but does not accurately represent the modelers intent. Illustrated in Lab 2
Title 6
Copyright Copyright 2000 OPNET Technologies, Inc. 2000 OPNET Technologies, Inc.
Behavioral
Object Reference
Objects can be identified in two ways
Object ID: Unique integer identifying object Object Name: Hierarchical name of object:
Format: <subnet name(s)>.<node name>.<module name> top.e_campus.bldg_10.router.in_queue <subnet name(s)> <node name> <module name> top.e_campus.bldg_10 router in_queue
Title 7
Copyright Copyright 2000 OPNET Technologies, Inc. 2000 OPNET Technologies, Inc.
Simulation Log
Records notable events for every scenario Recreated every time a scenarios simulation is run Describes problems Suggests solutions Gives informational messages
Title 8
Copyright Copyright 2000 OPNET Technologies, Inc. 2000 OPNET Technologies, Inc.
Diagnostic Error
Warning
Type
Type of error
T EV
MOD KP
10
Title 11
Copyright Copyright 2000 OPNET Technologies, Inc. 2000 OPNET Technologies, Inc.
11
12
B C
Location A Reported block line number: 5 Location B Reported block line number: 8 Location C Reported block line number: 11
Debugging Simulation Models Intro
Title 13
Copyright Copyright 2000 OPNET Technologies, Inc. 2000 OPNET Technologies, Inc.
13
Development Kernel
Same features as Optimized Kernel Plus diagnostic information automatically collected Slower
Development Kernel must be used for most debugging activities In order to see complete FCS, the process models and external files must be compiled with comp_trace_info
Title 14
Copyright Copyright 2000 OPNET Technologies, Inc. 2000 OPNET Technologies, Inc.
14
The kernel_type preference Controls which Simulation Kernel is used during a simulation To set kernel_type to development:
Dont use optimize_simulation environment file Command line: op_runsim -kernel_type development
Preferences: set kernel_type to development Set comp_trace_info environment attribute to TRUE This inserts additional trace information into compiled code Use FIN/FOUT/FRET macros in custom functions
Title 15
Copyright Copyright 2000 OPNET Technologies, Inc. 2000 OPNET Technologies, Inc.
15
Title 16
Copyright Copyright 2000 OPNET Technologies, Inc. 2000 OPNET Technologies, Inc.
16
ODB Features
ODB provides commands that allow user to: Execute single and multiple events Set breakpoints for specific events, times, modules, and processes Trace Kernel Procedures as they are being executed Print out information about the current status of simulation entities Print out statistics of memory usage Affect the course of the simulation by modifying object attributes
Title 17
Copyright Copyright 2000 OPNET Technologies, Inc. 2000 OPNET Technologies, Inc.
17
Example use:
op_runsim -net_name project1-scenario1 -debug
Title 18
Copyright Copyright 2000 OPNET Technologies, Inc. 2000 OPNET Technologies, Inc.
18
Commands can be issued at odb> prompt To end the simulation: quit - terminates the simulation normally (creates output files) exit - immediately exits ODB, no output file created
Debugging Simulation Models Intro
Title 19
Copyright Copyright 2000 OPNET Technologies, Inc. 2000 OPNET Technologies, Inc.
19
20
Title 21
Copyright Copyright 2000 OPNET Technologies, Inc. 2000 OPNET Technologies, Inc.
21
Breakpoints
Interrupt simulation execution Allow the user to issue commands at the odb> prompt Two methods of advancing simulation execution within ODB: Single event execution Continuation of event
noitucexE tnevE elpitluM
5 0: 0 0 1 2: 0 0 1 3: 0 0 5 4: 0 0
txen txen
1 2: 0 0
tniopkaerb tes
1 3: 0 0
txen
1 5: 0 0
tniopkaerb tes
9 5: 0 0 5 4: 0 0
txen txen
1 5: 0 0
Title 22
Copyright Copyright 2000 OPNET Technologies, Inc. 2000 OPNET Technologies, Inc.
22
txen
1 2: 0 0
tniopkaerb tes
1 3: 0 0
txen
gnidnep tniopkaerb
1 5: 0 0
tniopkaerb tes
9 5: 0 0 5 4: 0 0
txen txen
1 5: 0 0
Title 23
Copyright Copyright 2000 OPNET Technologies, Inc. 2000 OPNET Technologies, Inc.
23
Simulation time associated with the event Event ID associated with the event Type of interrupt that will be delivered Module generating the interrupt Other information associated with the event Simulation object where the event will occur
Title 24
Copyright Copyright 2000 OPNET Technologies, Inc. 2000 OPNET Technologies, Inc.
24
tstop
mstop prostop intstop
Copyright Copyright 2000 OPNET Technologies, Inc. 2000 OPNET Technologies, Inc.
25
Breakpoints: Reviewing
status command displays all pending breakpoints
odb> evstop 34 odb> tstop 40 odb> status Breakpoints : 1) 2)
Traces :
None
Title 26
Copyright Copyright 2000 OPNET Technologies, Inc. 2000 OPNET Technologies, Inc.
26
Title 27
Copyright Copyright 2000 OPNET Technologies, Inc. 2000 OPNET Technologies, Inc.
27
Traces
A list of KPs called by a process Used to print detailed information about event execution Typical traces display details of Kernel Procedures KP name Argument names Argument values Return value Contain information about the process being executed Once activated, a trace remains active until deactivated
Title 28
Copyright Copyright 2000 OPNET Technologies, Inc. 2000 OPNET Technologies, Inc.
28
Traces: Interpretation
Process invocation State banner
* invoking process (pk_sink) __________state (st_0): exit executives__________
(0)
KP invocations
* op_pk_get (instrm_index) strm. index (0) packet ID (1) * op_pk_destroy (pkptr) packet ID
(1)
Title 29
Copyright Copyright 2000 OPNET Technologies, Inc. 2000 OPNET Technologies, Inc.
29
Title 30
Copyright Copyright 2000 OPNET Technologies, Inc. 2000 OPNET Technologies, Inc.
30
Title 31
Copyright Copyright 2000 OPNET Technologies, Inc. 2000 OPNET Technologies, Inc.
31
Traces: Reviewing
status command displays all pending traces
odb> pktrace 5 odb> mtrace 11 odb> protrace 0 odb> status Breakpoints : None
Traces : 0) 1) 2) trace on packet with ID (5) (packet not in system) trace on module (top.pksw1.node_0.proc) trace on process (0)
Title 32
Copyright Copyright 2000 OPNET Technologies, Inc. 2000 OPNET Technologies, Inc.
32
Title 33
Copyright Copyright 2000 OPNET Technologies, Inc. 2000 OPNET Technologies, Inc.
33
Labels
Established by process model code Allow traces restricted to classes of activity Print values of state, temporary variables Print results of statements User-defined trace statements may be added to a process model Many OPNET standard models use labels e.g. TCP, ATM
Title 34
Copyright Copyright 2000 OPNET Technologies, Inc. 2000 OPNET Technologies, Inc.
34
Title 35
Copyright Copyright 2000 OPNET Technologies, Inc. 2000 OPNET Technologies, Inc.
35
Output when running a simulation with the TCP trace turned on (ltrace tcp):
____________________________ (ODB 7.0.B: Event) ____________________________ * * * * > Time Event Source Data Module : : : : : 972.409334997 sec, [00d 00h 16m 12s . 409ms 334us 997ns 496ps] execution ID (15204), schedule ID (#15605), type (remote intrpt) execution ID (15203), top.Office network.DEVELOPMENT.tcp (processor) code (10) top.Office network.DEVELOPMENT.tcp (processor) | Removing connection (14) from TCB list.
Title 36
Copyright Copyright 2000 OPNET Technologies, Inc. 2000 OPNET Technologies, Inc.
36
Copyright Copyright 2000 OPNET Technologies, Inc. 2000 OPNET Technologies, Inc.
37
node_0 model
hub model
38
3. Note: Event ID 6
Debugging Simulation Models Intro
Title 39
Copyright Copyright 2000 OPNET Technologies, Inc. 2000 OPNET Technologies, Inc.
39
40
6. Observe: packet arrived on stream 1, but op_pk_get() attempts to access stream 0 7. quit to quit ODB
Debugging Simulation Models Intro
Title 41
Copyright Copyright 2000 OPNET Technologies, Inc. 2000 OPNET Technologies, Inc.
41
42
Copyright Copyright 2000 OPNET Technologies, Inc. 2000 OPNET Technologies, Inc.
43
Break
Title 44
Copyright Copyright 2000 OPNET Technologies, Inc. 2000 OPNET Technologies, Inc.
44
Maps
A list of simulation objects corresponding to some criteria Provides object IDs and corresponding topological location Objects are identified by name or object ID Inspect state of simulation objects and packets Typically: Selection of a specific object (RIP process at Router_4) Selection of all objects of a specific type (map of all queue objects in the
simulation, packets from the same packet tree)
Title 45
Copyright Copyright 2000 OPNET Technologies, Inc. 2000 OPNET Technologies, Inc.
45
Unique integer identifying object Hierarchical name of object Description of class of object Object ID of parent object
Title 46
Copyright Copyright 2000 OPNET Technologies, Inc. 2000 OPNET Technologies, Inc.
46
promap
objid
objassoc pkmap ptmap
Copyright Copyright 2000 OPNET Technologies, Inc. 2000 OPNET Technologies, Inc.
47
Entity Information
Commands can be applied to objects to display verbose information about the state of the object Examples: Current state of a subqueue, including list of packets it contains Contents of packet fields
Title 48
Copyright Copyright 2000 OPNET Technologies, Inc. 2000 OPNET Technologies, Inc.
48
Copyright Copyright 2000 OPNET Technologies, Inc. 2000 OPNET Technologies, Inc.
49
: : : : : :
0 1 2 3 4 5
64 48 48 16 12000 0
Title 50
Copyright Copyright 2000 OPNET Technologies, Inc. 2000 OPNET Technologies, Inc.
50
Title 51
Copyright Copyright 2000 OPNET Technologies, Inc. 2000 OPNET Technologies, Inc.
51
The error may indicate a problem with setting destination address field in packets Use pkprint to investigate contents of packet fields
Debugging Simulation Models Intro
Title 52
Copyright Copyright 2000 OPNET Technologies, Inc. 2000 OPNET Technologies, Inc.
52
Copyright Copyright 2000 OPNET Technologies, Inc. 2000 OPNET Technologies, Inc.
53
2. Set pktrace for packet 0 (pktrace 0) 3. next until event involving packet 0 is encountered
* * * * > Time Event Source Data Module : : : : : 8.9356938109 sec, [00d 00h 00m 08s . 935ms 693us 810ns 900ps] execution ID (5), schedule ID (#10), type (self intrpt) execution ID (-1), top.pksw1.node_1.src (ideal generator) code (0) top.pksw1.node_1.src (ideal generator)
odb> next * THREAD 305: generating packet THREAD 305: packet ID THREAD 305: bulk size THREAD 305: total size
Copyright Copyright 2000 OPNET Technologies, Inc. 2000 OPNET Technologies, Inc.
54
Title 55
Copyright Copyright 2000 OPNET Technologies, Inc. 2000 OPNET Technologies, Inc.
55
: 0 : 0 : 0x8AAB90 : pksw_format : top.pksw1.node_1.src : 8.93569 : top.pksw1.node_1.src : 8.93569 : 9600 : 9600 : top.pksw1.node_1.strm_2 : NONE : on : off : NONE Type Value integer 1
Size 0
Title 56
Copyright Copyright 2000 OPNET Technologies, Inc. 2000 OPNET Technologies, Inc.
56
odb> evstop 15 odb> cont . . . ____________________________ (ODB 7.0.B: Event) ____________________________ * * * * > Time Event Source Data Module : : : : : 9.9356938109 sec, [00d 00h 00m 09s . 935ms 693us 810ns 900ps] execution ID (15), schedule ID (#25), type (stream intrpt) execution ID (14), top.pksw1.hub.rcv3 (pt-pt receiver) instrm (3), packet ID (0) top.pksw1.hub.hub (processor)
Title 57
Copyright Copyright 2000 OPNET Technologies, Inc. 2000 OPNET Technologies, Inc.
57
Copyright Copyright 2000 OPNET Technologies, Inc. 2000 OPNET Technologies, Inc.
58
: : : : : : : : : : : : : : :
0 0 0x8AAB90 pksw_format top.pksw1.node_1.src 8.93569 top.pksw1.node_1.src 8.93569 9600 9600 top.pksw1.hub.strm_8 NONE on off NONE
Type integer Value 0 Size 0
Name dest_address
Title 59
Copyright Copyright 2000 OPNET Technologies, Inc. 2000 OPNET Technologies, Inc.
59
Title 60
Copyright Copyright 2000 OPNET Technologies, Inc. 2000 OPNET Technologies, Inc.
60
to
op_pk_nfd_get (pkptr, dest_address, &dest_address);
61
Title 62
Copyright Copyright 2000 OPNET Technologies, Inc. 2000 OPNET Technologies, Inc.
62
Diagnostic Block
Process model code that may be invoked via an ODB command Statements that display state information of interest values of state variables Contents of key data structures (example TCP Transmission Control Block,
routing tables)
Diagnostic block may be invoked from any breakpoint Created in Process Editor Diagnostic block button
Title 63
Copyright Copyright 2000 OPNET Technologies, Inc. 2000 OPNET Technologies, Inc.
63
Text in ODB:
| | | | TCB list: Connection (1) information: state (LISTEN) Application objid (26034), Type of Service: As Requested by Client, traffic through stream (1)
Title 64
Copyright Copyright 2000 OPNET Technologies, Inc. 2000 OPNET Technologies, Inc.
64
Title 65
Copyright Copyright 2000 OPNET Technologies, Inc. 2000 OPNET Technologies, Inc.
65
Example: objmap proc rip gives the list of all rip modules
Locate desired node and note module ID of interest 2. Find object ID of the process of interest Use promap objid where objid is the module of interest
3. Run the simulation in debug mode; stop it at some time 4. Print the information from the diagnostic block
Copyright Copyright 2000 OPNET Technologies, Inc. 2000 OPNET Technologies, Inc.
66
Memory
Simulation Kernel tracks memory allocation organized by source categories
Display of memory categories Identify areas of memory buildup Example: Packets received but never destroyed
Title 67
Copyright Copyright 2000 OPNET Technologies, Inc. 2000 OPNET Technologies, Inc.
67
Memory: Commands
memstats Displays a list of statistics for memory categories High-level Can be limited to categories accounting for more than
a specified amount of memory
Advanced: memsrc: Displays list of allocation sources for a memory category memsnk: Displays list of deallocation sinks for a memory category
Title 68
Copyright Copyright 2000 OPNET Technologies, Inc. 2000 OPNET Technologies, Inc.
68
Title 69
Copyright Copyright 2000 OPNET Technologies, Inc. 2000 OPNET Technologies, Inc.
69
Title 70
Copyright Copyright 2000 OPNET Technologies, Inc. 2000 OPNET Technologies, Inc.
70
Title 71
Copyright Copyright 2000 OPNET Technologies, Inc. 2000 OPNET Technologies, Inc.
71
Summary
Determine the nature of the problem first
help evstop, tstop, mstop next, cont fulltrace, mtrace, pktrace pkmap, objmap pkprint, objprint
Debugging Simulation Models Intro
Title 72
Copyright Copyright 2000 OPNET Technologies, Inc. 2000 OPNET Technologies, Inc.
72
Reference
All ODB documentation Simx chapter of External Interfaces Manual OPNET Simulation Debugger section
General ODB Concepts ODB Concepts ODB Command Reference ODB Command Reference
Title 73
Copyright Copyright 2000 OPNET Technologies, Inc. 2000 OPNET Technologies, Inc.
73
Title 74
Copyright Copyright 2000 OPNET Technologies, Inc. 2000 OPNET Technologies, Inc.
74