Debian下调试util-linux
通过dpkg-buildpackage覆盖编译选项,按照-g -O0编译
cat /etc/dpkg/buildflags.conf
SET CFLAGS -g -O0 -fdebug-prefix-map=/home/uos/work/util-linux/gerrit/util-linux=. -fstack-protector-strong -Wformat -Werror=format-security
SET CXXFLAGS -g -O0 -fdebug-prefix-map=/home/uos/work/util-linux/gerrit/util-linux=. -fstack-protector-strong -Wformat -Werror=format-security
SET FCFLAGS -g -O0 -fdebug-prefix-map=/home/uos/work/util-linux/gerrit/util-linux=. -fstack-protector-strong
SET FFLAGS -g -O0 -fdebug-prefix-map=/home/uos/work/util-linux/gerrit/util-linux=. -fstack-protector-strong
SET GCJFLAGS -g -O0 -fdebug-prefix-map=/home/uos/work/util-linux/gerrit/util-linux=. -fstack-protector-strong
SET OBJCFLAGS -g -O0 -fdebug-prefix-map=/home/uos/work/util-linux/gerrit/util-linux=. -fstack-protector-strong -Wformat -Werror=format-security
SET OBJCXXFLAGS -g -O0 -fdebug-prefix-map=/home/uos/work/util-linux/gerrit/util-linux=. -fstack-protector-strong -Wformat -Werror=format-security
配置环境变量nostrip
export DEB_BUILD_OPTIONS=nostrip
配置日志等级
export LIBBLKID_DEBUG=all
all [0xffff] : info about all subsystems
cache [0x0004] : blkid tags cache
config [0x0008] : config file utils
dev [0x0010] : device utils
devname [0x0020] : /proc/partitions evaluation
devno [0x0040] : conversions to device name
evaluate [0x0080] : tags resolving
help [0x0001] : this help
lowprobe [0x0100] : superblock/raids/partitions probing
buffer [0x2000] : low-probing buffers
probe [0x0200] : devices verification
read [0x0400] : cache parsing
save [0x0800] : cache writing
tag [0x1000] : tags utils
参考源码中Documentation/howto-debug.txt