RDK Resources
[*RDK Preferred*]
Code Management Facility
RDK Forums
[RDK Conferences]
RDK Support
Archives
Papers & Presentations Archive
Build requirements- After repo steps needed below changes to install gdb in the image
In <image.bbappend>
IMAGE_INSTALL_append = " gdb "
For license related issues,
WHITELIST_GPL-3.0 += " gdb" INCOMPATIBLE_LICENSE = "GPL-3.0 LGPL-3.0 AGPL-3.0" PACKAGECONFIG_remove_pn-gdb = "readline" EXTRA_IMAGE_FEATURES = "tools-debug debug-tweaks dbg-pkgs"
Command to be executed to analyse,
gdb ./<binary of component>
Example,
root@RaspberryPi-Gateway:/usr/bin# gdb ./CcspPandMSsp Options:- run [args] or r [args] : This command runs the current executable file. quit or q : To quit the gdb console, either quit or q can be used. help : It launches the manual of gdb along with all list of classes of individual commands. break : The command break [function name] helps to pause the program during execution when it starts to execute the function. It helps to debug the program at that point. continue : This command helps to resume the current executable after it is paused by the breakpoint. next or n : This command helps to execute the next instruction after it encounters the breakpoint. delete : This command helps to deletes the breakpoints and checkpoints. clear : This command deletes the breakpoint which is at a particular function with the name FUNCTION_NAME. info : When the info breakpoints in invoked, the breakpoint number, type, display, status, address, the location will be displayed. If the breakpoint number is specified, only the information about that particular breakpoint will be displayed.
Example :-
root@RaspberryPi-Gateway:/usr/bin# gdb ./CcspPandMSsp GNU gdb (GDB) 9.1 Copyright (C) 2020 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "aarch64-rdk-linux". Type "show configuration" for configuration details. For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from ./CcspPandMSsp... (gdb) b getuid Breakpoint 1 at 0x7ff7b5dd40: file ../sysdeps/unix/syscall-template.S, line 91. (gdb) r Starting program: /usr/bin/CcspPandMSsp 10 [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/libthread_db.so.1". Conf file /etc/debug.ini open success rdk_dyn_log_initg_dl_socket = 3 __progname = CcspPandMSsp rdk_logger_init /etc/debug.ini Already Stack Level Logging processed... not processing again. Breakpoint 1, getuid () at ../sysdeps/unix/syscall-template.S:91 91 ../sysdeps/unix/syscall-template.S: No such file or directory. (gdb) b 609 No line 609 in the current file. Make breakpoint pending on future shared library load? (y or [n]) n (gdb) b strcmp Breakpoint 2 at 0x7ff7b3cc00: file ../sysdeps/aarch64/strcmp.S, line 54. (gdb) r The program being debugged has been started already. Start it from the beginning? (y or n) y Starting program: /usr/bin/CcspPandMSsp 10 Breakpoint 2, strcmp () at ../sysdeps/aarch64/strcmp.S:54 54 ../sysdeps/aarch64/strcmp.S: No such file or directory. (gdb) info b Num Type Disp Enb Address What 1 breakpoint keep y 0x0000000000403334 <getuid@plt+4> 2 breakpoint keep y 0x0000007ff7fe4e80 ../sysdeps/aarch64/strcmp.S:54 breakpoint already hit 1 time