Presentation is loading. Please wait.

Presentation is loading. Please wait.

Unit - V. Debugging GNU Debugger helps you in getting information about the following: 1.If a core dump happened, then what statement or expression did.

Similar presentations


Presentation on theme: "Unit - V. Debugging GNU Debugger helps you in getting information about the following: 1.If a core dump happened, then what statement or expression did."— Presentation transcript:

1 Unit - V

2 Debugging GNU Debugger helps you in getting information about the following: 1.If a core dump happened, then what statement or expression did the program crash on? 2.If an error occurs while executing a function, what line of the program contains the call to that function, and what are the parameters? 3.What are the values of program variables at a particular point during execution of the program? 4.What is the result of a particular expression in a program? 5.A Debugging Symbol Table maps instructions in the compiled binary program to their corresponding variable, function, or line in the source code.

3 GDB : GNU Debugger A debugger for several languages, including C and C++ It allows you to inspect what the program is doing at a certain point during execution. Errors like segmentation faults may be easier to find with the help of gdb. GDB uses a simple command line interface. GDB cannot be used for programs that compile with errors and it does not help in fixing those errors.

4 Commands : -g option to enable built-in debugging support gcc –g –o Type “gdb” or “gdb prog1.x.” You’ll get a prompt : (gdb) If you didn’t specify a program to debug, you’ll have to load it in now using file command : (gdb) file To run the program (gdb) run

5 Commands : Breakpoints can be used to stop the program run in the middle, at a designated point : (gdb) break To proceed onto the next breakpoint : (gdb) continue For Single-step execution of code by : (gdb) step Similar to “step,” the “next” command single-steps as well, except this one doesn’t execute each line of a sub-routine, it just treats it as one instruction. (gdb) next

6 Commands : The print command prints the value of the variable specified, and print/x prints the value in hexadecimal: (gdb) print (gdb) print/x Whereas breakpoints interrupt the program at a particular line or function, watchpoints act on variables. They pause the program whenever a watched variable’s value is modified, printing old and new values. (gdb) watch

7 Commands : List out code : (gdb) list (gdb) list, Delete Breakpoints (gdb) delete : Deletes all breakpoints (gdb) delete Info of breakpoints: (gdb) info breakpoints Info of Registers: (gdb) info registers

8 Debugging Core Dump : Core dump is created when program tries to access memory outside its allotted memory space. One of the cases when core dump is created is when segmentation fault occurs (SIGSEGV) To enable core dump file generation (Set size of core dump) ulimit –c unlimited Enabling this options creates file named core which contains program crash data Command to debug core dump files: gdb core

9 GUI Based Debugger : Data Display Debugger (ddd) Cbrowser Cscope symbol database

10 Tracing Tools : strace System call tracing strace strace –c ltrace Library function tracing ltrace ltrace –c mtrace Memory allocation function tracing ps Generates snapshot of Process Status information ps aux

11 SSH :

12 Secured Shell Cryptographic Protocol Remote Login Functionality SFTP Commands: ssh username@address ssh debian@192.168.7.2 sftp username@address sftp debian@192.168.7.2

13 Kernel Debugging : KGDB Kernel Debugging in Embedded Systems Remote GDB agent JTAG Interface Steps in Kernel Debugging 1.Initialization Host Target : Embedded Board Setup 2.KGDB check Enable KGDB 3.Serial Port Initialization 4.Debug trap and kernel debugging

14 Kernel Debugging : Initialization File : /usr/src/linux/.config CONFIG_HAVE_ARCH_KGDB=y CONFIG_KGDB=y CONFIG_KGDB_SERIAL_CONSOLE=y

15 Kernel Debugging : Remote GDB

16 Kernel Debugging : JTAG Interfacing

17 Stepper Motor Controller interfacing using Begale Bone Black Embedded System

18 Stepper Motor :

19 Full Step Execution:

20 DCBA 0001 0010 0100 1000

21 Half Step Execution:

22 DCBA 0001 0011 0010 0110 0100 1100 1000 1001

23 BBB interfacing : Initialization Export Input Direction Logic Changing the values Output Direction

24 BBB interfacing : Initialization Export echo 30 > /sys/class/gpio/export Setting Input Direction echo in > /sys/class/gpio/gpio30/direction Logic Changing the values echo out > /sys/class/gpio/gpio30/direction Setting Output Direction echo 0/1 > /sys/class/gpio/gpio30/value

25 BBB interfacing with Stepper Motor Connector Number BBB PIN Number PIN Description PIN connects to stepper motor connected FRC Function P91,2GNDGND(25pin)GND P95VCC(5V)VCC(26pin)VCC P911GPIO--0[30]FRC-21pinOut P912GPIO--1[28]FRC-22pinOut P913GPIO--0[31]FRC-19pinOut P914GPIO--1[18]FRC-20pinOut

26 Multimedia Tools : Mini GUI OpenGL OpenSL


Download ppt "Unit - V. Debugging GNU Debugger helps you in getting information about the following: 1.If a core dump happened, then what statement or expression did."

Similar presentations


Ads by Google