Presentation is loading. Please wait.

Presentation is loading. Please wait.

® 4-2 CrossWind 4.1Overview Starting A Debugging Session Basic Debugging System-Level Debugging.

Similar presentations


Presentation on theme: "® 4-2 CrossWind 4.1Overview Starting A Debugging Session Basic Debugging System-Level Debugging."— Presentation transcript:

1 ® 4-2 CrossWind 4.1Overview Starting A Debugging Session Basic Debugging System-Level Debugging

2 ® 4-3 Overview Allows debugging at source and assembly levels. CrossWind executes on host; code executes on target. Based on GNU debugger GDB: –Debug engine customized for VxWorks multitasking and Tornado target server communication strategy. –Graphical user interface added. Windows and Unix GUIs differ. CrossWind uses the WTX protocol to communicate with the target server.

3 ® 4-4 Customization The Debugger is easy to customize: –Extend or modify user interface –Add new debugger commands To customize the user interface: Use Tcl language. crosswind.tcl –Put Tcl commands in crosswind.tcl –Interpreted by GUI Tcl interpreter To customize the debug engine: gdb.tcl –Put Tcl commands in gdb.tcl –Interpreted by debug engine Tcl interpreter.gdbinit –Put GDB commands in.gdbinit WRS extensions provide access to the WTX protocol via Tcl functions.

4 ® 4-5 Task vs. System Level Debugging Task level debugging: –Can debug tasks only, not ISRs. –By default, breakpoints affect only the attached task. Global task breakpoints may also be set. –When the attached task is stopped, other tasks and ISRs in the system continue executing. –Communication with WDB agent is interrupt driven. System level debugging: –Can debug tasks, ISRs, and pre-kernel execution. –Default breakpoints stop the whole system. Task-specific breakpoints may be set. –When system stopped, external WDB agent runs with interrupts locked out. During this time, communication with WDB agent is in polled mode.

5 ® 4-6 CrossWind Overview 4.2Starting A Debugging Session Basic Debugging System-Level Debugging

6 ® 4-7 Executing CrossWind -g -O0 Compile code with the -g option to generate debug symbols. Specifying -O0 is also recommended. Select a target server. To invoke the debugger: –Use the launcher CrossWind button(UNIX) –Use Tools => Debugger or button.(Windows) To exit the debugger: –Select File => Quit from the debugger menu.(UNIX) –Select Debug => Stop Debugging from the Tornado menu bar, or use button.(Windows)

7 ® 4-8 Locating Code CrossWind needs to access both object and source code for modules to be debugged symbolically. Usually it can locate such modules automatically. Modules may be downloaded to the target via Download –Project Facility Download button or menu item. ldload –WindSh ld() command, CrossWind load command, or any other Tornado tool which can load modules. When GDB starts, it querries the target server for the file path to each object module loaded on the target. -g –The object module contains symbolic debug information if compiled with -g. –If debug information is found, CrossWind searches its source path for the corresponding source code.

8 ® 4-9 Listing Source Displays the C or/and assembly source code centered at location. Without argument, displays source: (gdb) list Used to get source into source display window. This happens automatically when GDB attaches to a task. Examples, using argument: (gdb) list foo.c:1 First few lines of foo.c (gdb) list 25 Line 25 in foo.c (gdb) list mySub Location can be a function.

9 ® 4-10 Debugging a Task Use CrossWind to create a new task tDbgTask that runs the function to debug: run – (gdb) run function arg1 arg2... Debug->Run –Windows users may use Debug->Run or the button. –You may set breakpoints before running the task. To debug a task already running on the target, GDB must attach to the task. –Targets->Attach Task... –Targets->Attach Task... in CrossWind (UNIX) –Debug->Attach... –Debug->Attach... in Tornado (Windows) attach – (gdb) attach taskId –The task is suspended wherever it is executing. (Windows users may override this default.)

10 ® 4-11 Debugging Multiple Tasks At task level, a CrossWind instance may be attached to a single task at a time. To debug multiple tasks, either detach from one and attach to another, use system level debugging, or start multiple debugger instances. To detach from a task, resuming it, use –Targets->Detach Task/System –Targets->Detach Task/System(UNIX) –Detach and Resume –Detach and Resume (Windows) – detach – detach from the GDB command line. To detach from a task, leaving it in its current state, use –Debug->Detach –Debug->Detach(Windows) –detach –detach auto from the GDB command line. sdetach (GDB) sdetach detaches, leaving the task suspended.

11 ® 4-12 Automatic Attachment (Windows) In Windows, CrossWind may be configured to automatically attach to a task which generates an exception or hits a breakpoint. Tools => Options => Debugger Use Tools => Options => Debugger dialog. Three choices: –Never auto-attach. –Auto-attach only if not already attached. –Auto-attach even if already attached. The last choice, always auto-attach, can lead to flurries of reattachments when several tasks hit a global breakpoint.

12 ® 4-13 CrossWind Overview Starting A Debugging Session 4.3Basic Debugging System-Level Debugging

13 ® 4-14 Debugging Tools Examples of debugger functionality: –Set/delete breakpoints. –Step to next line of code. –Step over a function call. –Continue program execution. –Finish current subroutine. –Move up or down stack frames. –Monitor variables or other expressions. –De-reference pointers. –Call up editor (UNIX). For a complete list of debugger tools and GUI access methods, see the Tornado User’s Guide.

14 ® 4-15 Make it Go! Make it Stop! step next continue finish interrupt WindowsUnix

15 ® 4-16 A View of the Stack Click on the desired frame to select it. info locals. The selected frame is used in informational commands such as info locals. finish It also also affect the stopping address of finish.

16 ® 4-17 Breakpoints Default breakpoints: –Stop attached task, or whole system in system mode. Global breakpoints: –Stop any breakable task. Good for stopping tasks spawned by the task being debugged. Hardware breakpoints on some architectures. –Halts on instruction access or various sorts of data access to specified address. Limited in number. –PPC 603, 603e, 604, 860, 403; Mips R4650; x86; i960 CA, JX, HX Temporary breakpoints: –Effective once, then deleted (default) or disabled.

17 ® 4-18 Breakpoints, Continued. Conditional breakpoints: –Effective if specified expression is true, otherwise task hitting breakpoint is automatically resumed. break snafu.c:228 if fbCount > 4 – (gdb) break snafu.c:228 if fbCount > 4 –Debug => Breakpoints => Advanced –Debug => Breakpoints => Advanced (Windows) Listing breakpoints: info breakpoints (i b) –GDB info breakpoints (i b) command. –Debug->Breakpoints –Debug->Breakpoints dialog.(Windows)

18 ® 4-19 Information Displaying variables and expressions: –Watch windows - extendable, editable, dockable, hierarchical display. (Windows) –Inspect windows - hierarchical display. Following pointers opens additional inspect windows.(UNIX) display /W – (GDB) display /W expr print – (GDB) print expr Other display windows: –Backtrace, Registers(UNIX, Windows) –Locals, Memory dump (Windows)

19 ® 4-20 UNIX: The Graphical Interface Menu Bar Toolbar Program Display Panel Command Panel

20 ® 4-21 PC: The Graphical Interface

21 ® 4-22 CrossWind Overview Starting A Debugging Session Basic Debugging 4.4System-Level Debugging

22 ® 4-23 Overview System-level debugging supports: –Debugging ISRs. –Debugging before the kernel is started. –Multitask debugging. In system mode, VxWorks and all application tasks and ISRs stop when a breakpoint is hit. The external WDB agent runs with interrupts locked out when VxWorks is stopped. WDB system debugging VxWorks configuration must include the WDB system debugging component.

23 ® 4-24 Debugging In System Mode To enter system mode: attach system (gdb) attach system Attaching to system. 0x407ae in wdbSuspendSystemHere () To exit system mode: detach (gdb) detach While in system mode, one can use normal debugger features: –Step/continue –Set breakpoints –Display expressions

24 ® 4-25 Selecting a Thread To Debug info threads To display all threads (the GDB term for VxWorks contexts), use the info threads command: i th (gdb) i th 5 task 0x3e8984 tExcTask 0x72e50 in qJobGet() 4 task 0x3e605c tLogTask 0x72e50 in qJobGet() 3 task 0x3b349c + tNetTask 0x38e44 in wdbSuspendSystemHere() 2 task 0x389de4 tPortmapd 0x3c36a in noSemQPutEvt() 1 task 0x3881c0 tWdbTask 0x3c36a in noSemQPutEvt() To select the current thread, for information display: thread 4 (gdb) thread 4 [Switching to task 0x3e605c tLogTask ] #0 0x72e50 in qJobGet ()

25 ® 4-26 Examining a Thread Use normal debugger tools to examine a thread. To set a thread-specific breakpoint: breakthread (gdb) break location thread threadNumber –If the breakpoint is hit by a different thread, the system is resumed automatically. Step, Next, Finish, Continue Resume execution of the system with Step, Next, Finish, or Continue from the debugger menu. –When you continue the system, VxWorks controls scheduling. step, nextfinish –You may not be in the same task after a step, next, or finish command completes. Such commands may involve setting a breakpoint and resuming the system.

26 ® 4-27 Caveats Cannot create a new task with run. Can only step or continue from where system is stopped. Cannot use multiple debuggers per target.

27 ® 4-28 Summary Tornado supports a source-code debugger which: –Executes on host while code executes on target –Provides source-level debugging -g -O0-O Code must be compiled with -g option. For easiest debugging, also specify -O0 (or no -O flags). System-level debugging: –Is useful for debugging ISRs and BSPs. –Is useful for multitask debugging. –VxWorks and application freeze when breakpoint is hit. –WDB agent uses polled-mode communication when system suspended, as interrupts are locked out.


Download ppt "® 4-2 CrossWind 4.1Overview Starting A Debugging Session Basic Debugging System-Level Debugging."

Similar presentations


Ads by Google