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 Now, we will need to install electric-fence package on ubuntu as, $ sudo apt-get install electric-fence Reading package lists… Done Building dependency tree Reading state information… Done The following NEW packages will be … 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 4) kgdb Kernel Tracing ============ 1) Function trace Reference – 2) System Tap Reference – Application ========= 1) GDB – System call tracer … Read more

USB Ethernet Testing – Measuring network throughput using iperf

Cross Compile Iperf for ARM $ git clone $ 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

How to use gdb for debugging application programs ( On ubuntu Linux using C program )

$ understand_gdb.c To prepare our program for debugging with gdb, we must compile it with the -g flag. $ gcc -g -o understand_gdb understand_gdb.c $ file understand_gdb understand_gdb: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /lib/, for GNU/Linux 2.6.32, BuildID[sha1]=a809bdb50d85d34feba9ccad8677ec15ee7d3882, not stripped $ gdb ./understand_gdbGNU gdb (Ubuntu 7.11.1-0ubuntu1~16.5) 7.11.1Copyright (C) … Read more

C application to interact with frame buffer devices / Linux test case for framebuffer driver

Screen information are queried by applications using the FBIOGET_FSCREENINFOand FBIOGET_VSCREENINFO ioctls. Those ioctls take a pointer to afb_fix_screeninfo and fb_var_screeninfo structure respectively. struct fb_fix_screeninfo stores device independent unchangeable informationabout the frame buffer device and the current format. Those information can’tbe directly modified by applications, but can be changed by the driver when anapplication modifies the … Read more