Setting different breakpoints in GDB while debugging

This post, is in continuation with “Using GDB to debug functions defined in another file in C” from where will be using add.c and helloworld.c as source code and “Debugging ARM binary on Ubuntu Host using qemu ARM and GDB” from where we will be using the debugging environment for ARM. so, lets assume we … Read more

Debugging ARM binary on Ubuntu Host using qemu ARM and GDB

In our previous two posts, “How to use gdb for debugging application programs” and “Using GDB to debug functions defined in another file in C” we have shown some basic steps for how you can use GDB to debug your programs running on X86 based desktops. In this post, we will show you how you … Read more

Solved: compilation error for ARM toolchain “undefined reference to `_exit'”

Our ARM toolchain was extracted at “/home/devlab/Desktop/helloworld/assembly/gcc-arm-none-eabi-10-2020-q4-major/” hence lets first try to add this toolchain to terminal path as, Now, we had written simple helloworld.c program, which we tried to compile as, But we got the compilation error as, Solution This error can be solved by adding “–specs=nosys.specs” at the end of the command as, … Read more

Using GDB to debug functions defined in another file in C

In our previous post “How to use gdb for debugging application programs ( On Ubuntu Linux using C program )” we seen how we can debug the C program where all of the code is written in single C file. In this post, we will show you how you can debug the C function written … Read more

Detect memory leaks using Valgrind in Linux

Valgrind is an instrumentation framework for building dynamic analysis tools. There are Valgrind tools that can automatically detect many memory management and threading bugs, and profile your programs in detail. You can also use Valgrind to build new tools. We will need to install valgrind for ubuntu, $ sudo apt-get install valgrind Reading package lists… … Read more

Using electric fence for debugging memory leaks in Linux

Create a test program which has some memory leaks for understanding how to debug memory leaks with electric fence, $ vim efence.c [c] #include <stdio.h> #include <stdlib.h> int main() { char *ptr = (char *) malloc(1024); ptr[0] = 0; /* Now write beyond the block */ ptr[1024] = 0; exit(0); } [/c] Now, we will … Read more

Opensource Linux Tools for debugging and performance measurements

Opensource Linux Tools for debugging and performance measurements Kernel Debugging ============== 1) printks – dmesg 2) proc file system 3) gdb Reference’s         http://www.linuxjournal.com/article/9252         http://www.ibm.com/developerworks/linux/library/l-debug/ 4) kgdb Kernel Tracing ============ 1) Function trace Reference – http://elinux.org/Ftrace_Function_Graph_ARM sourceforge.net/projects/lkst/ 2) System Tap Reference – http://lwn.net/Articles/353842/ Application ========= 1) GDB – http://www.gnu.org/software/gdb/http://en.wikipedia.org/wiki/Gdb2) System call tracer … Read more

USB Ethernet Testing – Measuring network throughput using iperf

Cross Compile Iperf for ARM $ git clone https://github.com/esnet/iperf.git $ cd iperf/ Assuming toolchain is located at /home/devlab/devlab/linaro/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf $ export PATH=$PATH:/home/devlab/devlab/linaro/gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf/bin $ mkdir out $ ./configure –host=arm-linux-gnueabihf –prefix=/home/devlab/devlab/iperf/out $ make $ make install * copy ./out/bin/iperf to /usr/local/bin of BeagleBoard(ARM platform) RFS. On linux host :~$ iperf -s ———————————————————— Server listening on TCP port 5001 … Read more

How to Test USB Mass Storage Device Read/Write Speed ?

Following description show how to test linux usb mass-storage drivers/devices Simple mass-storage bench-marking – Mount usb mass-storage device at /mnt/usb (Note: for embedded target, you may need to use “su” to switch to root user for necessary mount permissions OR For desktop, you will need to use sudo) $ sudo mount /dev/sdb1 /mnt/usb Use dd … Read more

How to test USB to RS-232 Serial Adaptor ?

Following description show how to test linux usb serial drivers/devices Getting Console over USB: Refer to Serial_Console_over_USB_to_OTG FAQ – Q1. How to change the COM port number(s) assigned to USB to serial adapter by Windows 2000/XP? A. To change the COM port number assigned to a USB to RS-232 Serial Adaptor follow the steps below: … Read more