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 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

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