lundi 13 juin 2016

[debug] getting valgrind full backtrace when debugging a dynamically loaded library

Little tip:

If you are getting something like this in valgrind while debugging a dynamically loaded library, it is because the symbols from the library have been deleted when the program called dl_close.


==23759==
==23759== HEAP SUMMARY:
==23759== in use at exit: 39,684 bytes in 23 blocks
==23759== total heap usage: 2,433 allocs, 2,410 frees, 6,965,904 bytes allocated
==23759==
==23759== 24 bytes in 1 blocks are definitely lost in loss record 4 of 15
==23759== at 0x402C1BC: malloc (vg_replace_malloc.c:299)
==23759== by 0x4873C87: ???
==23759== by 0x4873DD7: ???
==23759== by 0x48662E5: ???
==23759== by 0x4866324: ???
==23759== by 0x486625D: ???
==23759== by 0x485F5A8: ???
==23759== by 0x485CC73: ???
==23759== by 0x485BCF5: ???
==23759== by 0x804BCE3: setPortParameters() (main.cpp:147)
==23759== by 0x805070D: safeMain(int, char**) (main.cpp:588)
==23759== by 0x8051E8A: main (main.cpp:661)


You need to remove the dl_close call to get a full stack trace.

lundi 4 avril 2016

[Kernel] Initramfs is too big ...


Kernel is not booting...

You then realize that your initramfs is very big : 200MB ...

A normal initramfs can range between 2MB to ~20MB in general.
If your initramfs is too big, then the kernel will not be able to map it in memory and it won't boot.

You can remove all the things your computer won't use anyway from the bloated initramfs.

Edit /etc/initramfs-tools/initramfs.conf
and set MODULES=dep instead of MODULES=most

You can then rebuild your kernel.

Sources

http://askubuntu.com/questions/299396/how-to-reduce-the-size-of-initrd-img-on-ubuntu-13-04

[cmdline] MoreUtils

The errno util


Just a quick note to praise the moreutils package.

When programming userspace application that communicate with drivers, you will always get some errno number or somme perror formated strings.

errno is just the tool that make it easy to get the information about the error.

$ errno 12
ENOMEM 12 Cannot allocate memory



$ errno -s memory
ENOMEM 12 Cannot allocate memory
EHWPOISON 133 Memory page has hardware error



You don't need this site anymore.

Source:

https://joeyh.name/code/moreutils/