Вы находитесь на странице: 1из 49

Session 1503

Debugging Simulation Models Advanced


Network R&D
CONFIDENTIAL RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc. 2008 OPNET Technologies, Inc.

1503 Debugging Simulation Models Advanced

Agenda
1502 - Debugging Simulation Models Review Why use a C/C++ debugger Understanding process model code How to debug a program abort Scientific approach to debugging Using a C/C++ debugger with ODB Advanced C/C++ debugger techniques Using execution traces to validate changes Memory leak tracking

CONFIDENTIAL RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc. 2008 OPNET Technologies, Inc.

1503 Debugging Simulation Models Advanced

1502 Review Dissecting an Error Message

Event Number

Hierarchical Name

|----------------------------------------------------------------| | This node does not have any valid IP interfaces | | Assign a valid address to at least one interface | | T (0), EV (1593), MOD (top.DCI Network.FR_Cloud.ip), | | PROC (ip_dispatch_intf_table_create (total_interfaces)) | |----------------------------------------------------------------|

Simulation Time

Function Name

CONFIDENTIAL RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc. 2008 OPNET Technologies, Inc.

1503 Debugging Simulation Models Advanced

1502 Review Function Call Stack


* Function call stack: (builds down) -----------------------------------------------------------Call Block Count Line# Function -----------------------------------------------------------0) 1 152 0xd84a6f08 [name not available] 1) 1 2211 0x00004c00 [name not available] 2) 1 1358 0x0000c400 [name not available] Kernel 3) 1 291 m3_main 4) 1 1106 sim_main 5) 1 2706 sim_ev_loop 6) 1565 531 sim_obj_qps_intrpt 7) 69 15 ip_dispatch [wait -> cmn_rte_tbl : SELF_NOTIFICATION / ip_dispatch_init_phase_2 ()] 8) 9 1791 ip_dispatch_init_phase_2 () 9) 9 7364 ip_dispatch_intf_table_create (total_interfaces) 10) 1 649 op_sim_error (gravity, line1, line2) -----------------------------------------------------------CONFIDENTIAL RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc. 2008 OPNET Technologies, Inc.

1503 Debugging Simulation Models Advanced

Block Line Numbers


21 static void 22 ip_encap_pk_destroy (Packet* pkptr) 23 { 24 Ici* intf_iciptr; 25 IpT_Rte_Ind_Ici_Fields* intf_ici_struct_ptr; 26 27 /** Destroys the IP datagram received from lower **/ 28 /** layer and the associated ip_rte_ind_v4 ICI **/ 29 FIN (ip_encap_pk_destory (pkptr)); 30 31 /* Get the ICI associated with the packet. */ 32 intf_iciptr = op_pk_ici_get (pkptr); 33 34 /* Destroy the ICI and its fields */ 35 if (intf_iciptr != OPC_NIL) 36 { 37 op_ici_attr_get (intf_iciptr, 38 "rte_info_fields", &intf_ici_struct_ptr); 39 ip_rte_ind_ici_fdstruct_destroy (intf_ici_struct_ptr); 40 op_ici_destroy (intf_iciptr); 41 } 42 43 /* Destroy the packet. */ 44 op_pk_destroy (pkptr); 45 46 FOUT; 47 }

CONFIDENTIAL RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc. 2008 OPNET Technologies, Inc.

1503 Debugging Simulation Models Advanced

FIN, FOUT, and FRET Macros


How does OPNET know what to put in the function call stack?
Process model states automatic Need to add a macro for complete functions Function Block External C/C++ code Pipeline Stages

FIN - Macro used to label a function


C: Place after local variables C++: First statement in the function

When using FIN macro, replace return keyword with


FOUT replaces return; FRET(value); replaces return(value);

Using FIN without FOUT / FRET in C results in Standard Function Stack Imbalance error message No overhead when models compiled with comp_trace_info preference set to FALSE (Optimized Kernel compile) FIN required in Function Block functions if using state variables
CONFIDENTIAL RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc. 2008 OPNET Technologies, Inc.

1503 Debugging Simulation Models Advanced

Why Use a C/C++ Debugger?


Benefits
View values and types of C/C++ variables View execution at a more fine-grained level Data-based breakpoints

Caveats
Requires familiarity with C/C++ Requires familiarity with OPNET generated code

Proper C/C++ compilation flags for debugging are set by default automatically when working with development kernel NOTE: C/C++ Debugger also referred to as Symbolic Debugger or Source-Level Debugger
CONFIDENTIAL RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc. 2008 OPNET Technologies, Inc.

1503 Debugging Simulation Models Advanced

Example Debuggers

Name
CDB GDB Visual Studio

Platform
Windows Linux Windows

Use
Integrated w/OPNET GUI Integrated w/OPNET GUI Separate GUI

Tutorial
This session OPNETWORK 2006 OPNETWORK 2005

CONFIDENTIAL RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc. 2008 OPNET Technologies, Inc.

1503 Debugging Simulation Models Advanced

Process Model Code Structure


Compiling a process model generates a C/C++ file
<model_name>.pr.c <model_name>.pr.cpp

Header Block State Variable Structure State Variable Macros Function Block void <model name> () Temporary Variables Finite State Machine _op_<model name>_diag ()

CONFIDENTIAL RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc. 2008 OPNET Technologies, Inc.

1503 Debugging Simulation Models Advanced

Process Model Code Structure (cont.) Header block inserted at top of file
Header file #includes Global definitions (variables, typedefs, etc.)

CONFIDENTIAL RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc. 2008 OPNET Technologies, Inc.

10

1503 Debugging Simulation Models Advanced

Process Model Code Structure (cont.)


State variables structure declaration block follows the header block State variables packed into a single structure that is pointed to by the op_sv_ptr variable
op_sv_ptr is implicitly declared and obtained from the simulation kernel by the FIN statements Any function that use state variables MUST start with a FIN statement

CONFIDENTIAL RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc. 2008 OPNET Technologies, Inc.

11

1503 Debugging Simulation Models Advanced

Process Model Code Structure (cont.) Function block inserted above primary function
State variable definitions available

CONFIDENTIAL RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc. 2008 OPNET Technologies, Inc.

12

1503 Debugging Simulation Models Advanced

Process Model Code Structure (cont.)


Temporary variable block local variables

CONFIDENTIAL RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc. 2008 OPNET Technologies, Inc.

13

1503 Debugging Simulation Models Advanced

Process Model Code Structure (cont.)


Primary function has same name as model

Executives and transitions are implemented as macros

CONFIDENTIAL RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc. 2008 OPNET Technologies, Inc.

14

1503 Debugging Simulation Models Advanced

Process Model Code Structure (cont.) Diagnostic, termination blocks helper functions
Temporary variable block local variables Other helper functions generated by OPNET

CONFIDENTIAL RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc. 2008 OPNET Technologies, Inc.

15

1503 Debugging Simulation Models Advanced

Compiler Warnings
Results of kept in:
<home>/op_admin/tmp/cc_err_<compiled process id>

Compiler warnings can identify:


Uninitialized variables Non-prototyped functions = in test, or == not in test Statements with no effect printf type mismatches
char * char_ptr; strcpy (char_ptr, "hello world");
warning C4700: local variable 'char_ptr used without having been initialized

Preference Show Compilation Output to TRUE


Always show compiler output instead of just when there are errors

CONFIDENTIAL RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc. 2008 OPNET Technologies, Inc.

16

1503 Debugging Simulation Models Advanced

Debugging a Program Abort


Run simulation, see an abort message

Make sure code is compiled with debugging symbols (automatic in development kernel). CDB/GDB
Run simulation with development kernel and ODB enabled In simulation execution window, select Windows: Simulation > Attach Windows Debugger (CDB) Linux: Simulation > Attach GDB Hit Continue button in console window, source code will appear on abort

CONFIDENTIAL RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc. 2008 OPNET Technologies, Inc.

17

1503 Debugging Simulation Models Advanced

Debugging a Program Abort (cont.)


Visual Studio
In Configure/Run DES dialog, select Execution -> Troubleshooting and set Prevent OPNET from handling and logging its exceptions to Yes Run simulation The following dialog box will come up. Select Debug to launch Visual Studio and attach it to the crashed simulation process Dialog will not appear if CDB or another source debugger is already attached

CONFIDENTIAL RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc. 2008 OPNET Technologies, Inc.

18

1503 Debugging Simulation Models Advanced

Lab 1: Using a Debugger to Investigate a Simulation Abort


Description:
Run a simulation, and notice that the simulation crashes. Use a C/C++ debugger to diagnose the problem and find a solution.

Recap
C/C++ debuggers can help tracking down program aborts by bringing you to the point of the abort

CONFIDENTIAL RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc. 2008 OPNET Technologies, Inc.

19

1503 Debugging Simulation Models Advanced

Agenda
1502 - Debugging Simulation Models Review Why use a C/C++ debugger Understanding process model code How to debug a program abort Scientific approach to debugging Using a C/C++ debugger with ODB Advanced C/C++ debugger techniques Using execution traces to validate changes Memory leak tracking

CONFIDENTIAL RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc. 2008 OPNET Technologies, Inc.

20

1503 Debugging Simulation Models Advanced

The Approach: Scientific Method


Create controlled environment
Reproducibility is critical

Establish the knowns (define the error) Collect circumstantial evidence Develop hypotheses Design experiments
Understand what each experiment will answer Does it or does it not confirm hypothesis?

Run experiments (one at a time) Iterate as necessary

CONFIDENTIAL RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc. 2008 OPNET Technologies, Inc.

21

1503 Debugging Simulation Models Advanced

Difficult to Debug Problems


Problem cannot be reproduced consistently
Memory corruption Uninitialized variables

Problem does not appear when using debugger


Side-effects of debugger (printing, tracing, displaying variables) alters environment

Problem only occurs late in a large simulation

CONFIDENTIAL RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc. 2008 OPNET Technologies, Inc.

22

1503 Debugging Simulation Models Advanced

Debugging Techniques
Goal: Make the problem occur at an earlier time and systematically Approach: Destabilize the system Techniques
Vary simulation seed Change object order (cut/paste) Change attribute or parameter values Change environment (OS, 32/64 bit, compiler version) -mem_optimize FALSE (Disable OPNET memory management optimizations) -mem_shred TRUE (Set contents of freed memory to 0xDF) Use third-party memory corruption detection tools such as purify, valgrind etc. Make sure to use -mem_optimize FALSE Search OPNET FAQs for particular tool integration instructions

CONFIDENTIAL RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc. 2008 OPNET Technologies, Inc.

23

1503 Debugging Simulation Models Advanced

Using a C/C++ Debugger With ODB


In order to stop a debugger at a point in a simulation that is not an abort:
1. 2. 3. 4. 5. 6. 1. 2. 3. 4. Run the simulation with the OPNET Debugger enabled Wait for the simulation to load and stop before the first event Attach the C/C++ debugger to the simulation Set breakpoints in ODB or the C/C++ debugger (CDB/GDB) Click Continue in Simulation Execution dialog (Visual Studio only) Continue C/C++ debugger, then Continue in ODB ODB stops on event boundaries C/C++ debugger stops on lines of code Set breakpoints in both, simulation will run to whatever breakpoint is next (Visual Studio only) Continuing in C/C++ debugger may bring you back to a paused state in ODB

Using ODB and the C/C++ debugger together

CONFIDENTIAL RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc. 2008 OPNET Technologies, Inc.

24

1503 Debugging Simulation Models Advanced

Conditional Breakpoints
Problem:
You want to set a breakpoint at a line of code that is executed quite often. You only want to break on line of code under a certain situation

Solution: Conditional breakpoints.


The breakpoint is triggered only if a defined C/C++ expression evaluates to TRUE

CDB
Command: bp Example:

GDB
Command: break to set a breakpoint, followed by cond to assign a condition Example:
break my_process.pr.c:383 cond <breakpoint ID> (op_sv_ptr->my_process_id == 49)
CONFIDENTIAL RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc. 2008 OPNET Technologies, Inc.

25

1503 Debugging Simulation Models Advanced

Conditional Breakpoints (cont.)


Visual Studio
Define a new breakpoint (Ctrl-B, or click on New in the Breakpoint window) Click on Condition Type in conditional expression (op_sv_ptr->my_process_id == 49)

CONFIDENTIAL RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc. 2008 OPNET Technologies, Inc.

26

1503 Debugging Simulation Models Advanced

Watchpoints
Problem: You want simulation to stop when a variable value changes unexpectedly; this is a common source of bugs Solution: Use watchpoints. They stop execution of a simulation when a chosen variable value changes How to set a watchpoint on a state variable CDB (refer to Lab 2) GDB (refer to OPNETWORK 2006 Lab 3)
GDB> print &op_sv_ptr->my_tpal_objid <address> GDB> watch *((int *) <address>)

CONFIDENTIAL RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc. 2008 OPNET Technologies, Inc.

27

1503 Debugging Simulation Models Advanced

Watchpoints (cont.)
Visual Studio
Define a new breakpoint (Ctrl-B, or click on New in the Breakpoint window) Select the Data tab Enter expression to watch in the Variable: field Example: *(int *) 0x038472fc

CONFIDENTIAL RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc. 2008 OPNET Technologies, Inc.

28

1503 Debugging Simulation Models Advanced

Getting Debugger Help


CDB

GDB: Type help at command prompt Visual Studio: Help menu

CONFIDENTIAL RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc. 2008 OPNET Technologies, Inc.

29

1503 Debugging Simulation Models Advanced

Lab 2: Using a C Debugger and ODB Advanced


This lab shows advanced C/C++ debugger techniques:
Conditional breakpoints Watchpoints

Difficult error: bug and error message are separated by many events

Long lab with tricky parts The most advanced lab at this conference

CONFIDENTIAL RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc. 2008 OPNET Technologies, Inc.

30

1503 Debugging Simulation Models Advanced

Lab 2: Recap
Error reported when models was run Developed two hypotheses:
Variable initialized improperly (demonstrated to be false) Variable changed unexpectedly elsewhere (demonstrated to be true)

Used conditional breakpoint to stop at a particular process Used watchpoint facility to pinpoint when bug occurred Conditional breakpoints and watchpoints can turn good debuggers into expert debuggers

CONFIDENTIAL RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc. 2008 OPNET Technologies, Inc.

31

1503 Debugging Simulation Models Advanced

Agenda
1502 - Debugging Simulation Models Review Why use a C/C++ debugger Understanding process model code How to debug a program abort Scientific approach to debugging Using a C/C++ debugger with ODB Advanced C/C++ debugger techniques Using execution traces to validate changes Memory leak tracking

CONFIDENTIAL RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc. 2008 OPNET Technologies, Inc.

32

1503 Debugging Simulation Models Advanced

Using Execution Trace to Validate Changes


Model changes / optimizations typically not supposed to change the results Finding the exact point where two simulations that supposed to produce identical results begin to diverge can be difficult Execution Trace captures basic simulation kernel actions such as packet creation and interrupt scheduling Simulation execution can be compared against a previously captured Execution Trace. Simulation will stop at the first encountered difference in basic simulation actions

CONFIDENTIAL RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc. 2008 OPNET Technologies, Inc.

33

1503 Debugging Simulation Models Advanced

Execution Trace Discrepancy Report Example

CONFIDENTIAL RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc. 2008 OPNET Technologies, Inc.

34

1503 Debugging Simulation Models Advanced

Execution Trace Configuration


Run simulation with -etrace_dump <FILE_PATH> on the command line to capture the trace Run simulation with -etrace_diff <FILE_PATH> on the command line to compare execution against the captured trace Additional options to trim the range of events that are captured / compared:
-etrace_start_time <SIM_TIME> will start capturing / comparing actions once simulation time goes past the specified number -etrace_end_time <SIM_TIME> will stop capturing / comparing actions once simulation time goes past the specified number

CONFIDENTIAL RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc. 2008 OPNET Technologies, Inc.

35

1503 Debugging Simulation Models Advanced

Lab 3: Using Execution Trace to Validate Changes


The task is to validate a model change with little knowledge about the model or the nature of the change Use simulation Execution Trace to find an event where simulations that for some reason produce different results diverge Use ODB trace to find a piece of source code that is responsible for the difference Fix the code

CONFIDENTIAL RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc. 2008 OPNET Technologies, Inc.

36

1503 Debugging Simulation Models Advanced

Agenda
1502 - Debugging Simulation Models Review Why use a C/C++ debugger Understanding process model code How to debug a program abort Scientific approach to debugging Using a C/C++ debugger with ODB Advanced C/C++ debugger techniques Using execution traces to validate changes Memory leak tracking

CONFIDENTIAL RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc. 2008 OPNET Technologies, Inc.

37

1503 Debugging Simulation Models Advanced

Problem: Memory Leak


Missing deallocation of memory no longer referenced by the simulation Approach
Identify what type of memory is leaking Identify sources of allocations (modules and function call stacks)

Use the Memory Usage and Memory Stats tabs in Simulation dialog
Statistics are updated live in the Simulation Progress Window as simulation runs

Use advanced simulation memory tracking features


Tracks simulation objects by module source and function call stack source Memory Usage tab shows per-category memory growth

CONFIDENTIAL RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc. 2008 OPNET Technologies, Inc.

38

1503 Debugging Simulation Models Advanced

Memory Sources: Track Active Memory with Allocation Source

View source of memory allocation by process state / function Sort by Bytes to identify largest memory users Default grouping by process state machine source Invert function call stack to group by offending KP
CONFIDENTIAL RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc. 2008 OPNET Technologies, Inc.

39

1503 Debugging Simulation Models Advanced

Memory Sources: Block by Block

New blocks since last update appear in RED


CONFIDENTIAL RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc. 2008 OPNET Technologies, Inc.

40

1503 Debugging Simulation Models Advanced

Memory Sources: Configuration

Track all sources:

Or, enter specific categories:


CONFIDENTIAL RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc. 2008 OPNET Technologies, Inc.

41

1503 Debugging Simulation Models Advanced

Lab 4: Using Advanced Memory Features in ODB


Use the memory tracking features from within the Simulation Execution dialog to track down a memory leak Use Memory Stats and Memory Usage tabs on simulation dialog to track memory problems within the Project Editor Use advanced memory tracking to view the creator of simulation objects that might be leaking

CONFIDENTIAL RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc. 2008 OPNET Technologies, Inc.

42

1503 Debugging Simulation Models Advanced

Documentation References
ODB in the Simulation Execution chapter of the External Interfaces Manual Process Model Domain Definition, Modeling Concepts Manual Your C/C++ debugger manual

CONFIDENTIAL RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc. 2008 OPNET Technologies, Inc.

43

1503 Debugging Simulation Models Advanced

Additional Optional Labs


From OPNETWORK 2005: Debugging on Visual C++ (6.0), Visual Studio .NET 2003, UNIX debugging using dbx (Solaris) From OPNETWORK 2006: Debugging on Linux

CONFIDENTIAL RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc. 2008 OPNET Technologies, Inc.

44

1503 Debugging Simulation Models Advanced

Supported Compiler and Debuggers


gdb 6.3 and newer gcc 3.4 and newer Visual C++ 6, Visual Studio .NET 2003, 2005 and 2008 Microsoft Debugging Tools for Windows version 6.6.7.5 or newer Intel compiler ICL 8.0 or newer OK on Windows and Linux (not currently supported, but works)

CONFIDENTIAL RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc. 2008 OPNET Technologies, Inc.

45

1503 Debugging Simulation Models Advanced

Consider Linux
Reach set of free and reliable software development tools GDB commands are more intuitive than CDB commands Checkpoint / Restart simulation feature is only available on Linux Virtual Machine is an efficient way of using the same PC for both bureaucracy under Windows and serious simulation debugging under Linux Same OPNET license covers all platforms
OPNET license server can serve the same OPNET licenses to both Windows and Linux clients

CONFIDENTIAL RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc. 2008 OPNET Technologies, Inc.

46

1503 Debugging Simulation Models Advanced

Some Useful Debugging FAQs on Support Site


841: When using a C/C++ debugger, how do I set a breakpoint for a particular states enter/exit execs 195/1219/1686: What are the proper system environment settings for Visual C++ 6.0/.NET 2003/.NET 2005 1667: How can I use gdb, dbx or other UNIX source level debuggers to debug simulations (apart from gdb integration) 517: How can I use Purify with OPNET to debug a memory corruption, memory leak, or crash? For identical simulation runs, why does my simulation crash in different places, maybe even "inside" the simulation kernel? 554: How can I solve the problem that my simulation uses a large amount of memory? What is some general advice for tracking down memory leaks or queues that grow without bound?

CONFIDENTIAL RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc. 2008 OPNET Technologies, Inc.

47

1503 Debugging Simulation Models Advanced

OPNET Solutions for Debugging Simulation Models Advanced

CONFIDENTIAL RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc. 2008 OPNET Technologies, Inc.

48

1503 Debugging Simulation Models Advanced

Take-Away Points
Any OPNET simulation is easily debugged with a source code debugger Take advantage of the ODB and source debugger integration Analyze errors to start the debugging process Use the Scientific Method to debug Advanced debugger features (conditional breakpoints, watchpoints) turn a difficult debugging problem into an easy debugging problem Execution tracing is a powerful model change validation tool Memory tracking is a useful tool for detecting memory leaks Next steps:
Build simulation with debug information Next bug that comes up will put you in the debugger

CONFIDENTIAL RESTRICTED ACCESS: This information may not be disclosed, copied, or transmitted in any format without the prior written consent of OPNET Technologies, Inc. 2008 OPNET Technologies, Inc.

49

Вам также может понравиться