Jun 25, 2014

Read auxv

LD_SHOW_AUXV=1 /bin/true
or

Jun 24, 2014

Elfutils

https://access.redhat.com/site/documentation/en-US/Red_Hat_Developer_Toolset/1/html/User_Guide/chap-elfutils.html
sudo apt-get install elfutils
eu-readelf --all /lib/x86_64-linux-gnu/libc.so.6

gcc dumpspecs

gcc -dumpspecs
# ...
# *startfile:
# %{!mandroid|tno-android-ld:%{!shared: %{pg|p|profile:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}}    crti.o%s # %{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s};:%{shared: crtbegin_so%O%s;:  %{static: crtbegin_static%O%s;: crtbegin_dynamic%O%s}}}
# ...
http://gcc.gnu.org/onlinedocs/gcc-4.7.2/gcc/Spec-Files.html#Spec-Files

ld --verbose
#...
# OUTPUT_ARCH(i386:x86-64)
# ENTRY(_start)
# SEARCH_DIR("/usr/x86_64-linux-gnu/lib64"); SEARCH_DIR("=/usr/local/lib/x86_64-linux-gnu"); SEARCH_DIR("=/usr/local/lib64"); SEARCH_DIR("=/lib/x86_64-linux-gnu"); SEARCH_DIR("=/lib64"); SEARCH_DIR("=/usr/lib/x86_64-linux-gnu"); SEARCH_DIR("=/usr/lib64"); SEARCH_DIR("=/usr/local/lib"); SEARCH_DIR("=/lib"); # SEARCH_DIR("=/usr/lib");
SECTIONS
# ...
https://sourceware.org/binutils/docs/ld/

Core dump

Allow core dump
Permanent:
sudo vi /etc/security/limits.conf
#add line
#YOUR_USERNAME     soft    core            1000000
Temporary:
ulimit -c unlimited
Core dump
sleep 30
# Type Control-\
Quit (core dumped)
kill -ABRT <PID>
# 11602 abort (core dumped)
In C
abort()
Core dump misc
cat /proc/sys/kernel/core_pattern
man 5 core
cat /proc/PID/coredump_filter

Jun 13, 2014

Software architecture design principles

GRASP - General Responsibility Assignment Software Patterns (or Principles) consists of guidelines for assigning responsibility to classes and objects in object-oriented design. The different patterns and principles used in GRASP are: Controller, Creator, Indirection, Information Expert, High Cohesion, Low Coupling, Polymorphism, Protected Variations, and Pure Fabrication.
SOLID (ru)
KISS Keep it simple, stupid
DRY Don't repeat yourself
YAGNI You aren't gonna need it
Worse is better
Law of Demeter, LoD Each unit should have only limited knowledge about other units: only units "closely" related to the current unit. Each unit should only talk to its friends; don't talk to strangers. Only talk to your immediate friends.