Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added debug symbols to many debug dockers. #3098

Merged
merged 5 commits into from
Jul 4, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions build_debian.sh
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,28 @@ fi
sudo sed -i 's/EBTABLES_LOAD_ON_START="no"/EBTABLES_LOAD_ON_START="yes"/g' ${FILESYSTEM_ROOT}/etc/default/ebtables
sudo cp files/image_config/ebtables/ebtables.filter ${FILESYSTEM_ROOT}/etc

## Debug Image specific changes
## Update motd for debug image
if [ "$DEBUG_IMG" == "y" ]
then
sudo LANG=C chroot $FILESYSTEM_ROOT /bin/bash -c "echo '**************' >> /etc/motd"
sudo LANG=C chroot $FILESYSTEM_ROOT /bin/bash -c "echo 'Running DEBUG image' >> /etc/motd"
sudo LANG=C chroot $FILESYSTEM_ROOT /bin/bash -c "echo '**************' >> /etc/motd"
sudo LANG=C chroot $FILESYSTEM_ROOT /bin/bash -c "echo '/src has the sources' >> /etc/motd"
sudo LANG=C chroot $FILESYSTEM_ROOT /bin/bash -c "echo '/src is mounted in each docker' >> /etc/motd"
sudo LANG=C chroot $FILESYSTEM_ROOT /bin/bash -c "echo '/debug is created for core files or temp files' >> /etc/motd"
sudo LANG=C chroot $FILESYSTEM_ROOT /bin/bash -c "echo 'Create a subdir under /debug to upload your files' >> /etc/motd"
sudo LANG=C chroot $FILESYSTEM_ROOT /bin/bash -c "echo '/debug is mounted in each docker' >> /etc/motd"

mkdir -p $FILESYSTEM_ROOT/src
pushd src
../dbg_files.sh | tar -cvzf ../$FILESYSTEM_ROOT/src/sonic_src.tar.gz -T -
renukamanavalan marked this conversation as resolved.
Show resolved Hide resolved
popd

mkdir -p $FILESYSTEM_ROOT/debug

fi

## Remove gcc and python dev pkgs
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y remove gcc libpython2.7-dev

Expand Down
29 changes: 29 additions & 0 deletions dbg_files.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash

# Provie file paths to archive for debug image as relative to src subdir
#
SRC_DIR_LIST="\
renukamanavalan marked this conversation as resolved.
Show resolved Hide resolved
libteam \
lldpd \
lm-sensors \
libnl3 \
radvd \
redis \
snmpd \
sonic-daemon-base \
sonic-dbsyncd \
sonic-frr \
sonic-platform-common \
sonic-platform-daemons \
renukamanavalan marked this conversation as resolved.
Show resolved Hide resolved
sonic-py-swsssdk \
sonic-sairedis \
sonic-snmpagent \
renukamanavalan marked this conversation as resolved.
Show resolved Hide resolved
sonic-swss \
sonic-swss-common \
tacacs"

for i in $SRC_DIR_LIST
do
find $i/ -name "*.c" -o -name "*.cpp" -o -name "*.h" -o -name "*.hpp" -type f
done

7 changes: 0 additions & 7 deletions dockers/docker-base-stretch/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,6 @@ RUN apt-get -y purge \
{{ install_debian_packages(docker_base_stretch_debs.split(' ')) }}
{%- endif %}

{% if docker_base_stretch_dbgs.strip() -%}
# Install common debug-packages
RUN apt-get -y install docker_base_stretch_dbgs.split(' ') | join(' ')
{% else %}
RUN ln /usr/bin/vim.tiny /usr/bin/vim
{%- endif %}

# Clean up apt
# Remove /var/lib/apt/lists/*, could be obsoleted for derived images
RUN apt-get clean -y && \
Expand Down
3 changes: 3 additions & 0 deletions files/build_templates/docker_image_ctl.j2
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,9 @@ start() {
# TODO: Mellanox will remove the --tmpfs exception after SDK socket path changed in new SDK version
{%- endif %}
docker create {{docker_image_run_opt}} \
{%- if install_debug_image == "y" %}
-v /src:/src:ro -v /debug:/debug:rw \
{%- endif %}
{%- if '--log-driver=json-file' in docker_image_run_opt or '--log-driver' not in docker_image_run_opt %}
--log-opt max-size=2M --log-opt max-file=5 \
{%- endif %}
Expand Down
3 changes: 0 additions & 3 deletions rules/docker-base-stretch.mk
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ OPENSSH = openssh-client
SSHPASS = sshpass
STRACE = strace
$(DOCKER_BASE_STRETCH)_DBG_IMAGE_PACKAGES += $(GDB) $(GDBSERVER) $(VIM) $(OPENSSH) $(SSHPASS) $(STRACE)
ifeq ($(INSTALL_DEBUG_TOOLS),y)
$(DOCKER_BASE_STRETCH)_DBG_PACKAGES += $($(DOCKER_BASE_STRETCH)_DBG_IMAGE_PACKAGES)
endif

SONIC_DOCKER_IMAGES += $(DOCKER_BASE_STRETCH)
SONIC_STRETCH_DOCKERS += $(DOCKER_BASE_STRETCH)
1 change: 1 addition & 0 deletions rules/docker-database.mk
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ $(DOCKER_DATABASE)_PATH = $(DOCKERS_PATH)/$(DOCKER_DATABASE_STEM)

$(DOCKER_DATABASE)_DEPENDS += $(REDIS_TOOLS) $(REDIS_SERVER)
$(DOCKER_DATABASE)_DBG_DEPENDS = $($(DOCKER_CONFIG_ENGINE_STRETCH)_DBG_DEPENDS)
$(DOCKER_DATABASE)_DBG_DEPENDS += $(REDIS_SERVER_DBG)

$(DOCKER_DATABASE)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_STRETCH)_DBG_IMAGE_PACKAGES)

Expand Down
4 changes: 3 additions & 1 deletion rules/docker-platform-monitor.mk
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ $(DOCKER_PLATFORM_MONITOR)_PYTHON_WHEELS += $(SONIC_PLATFORM_API_PY2)
$(DOCKER_PLATFORM_MONITOR)_PYTHON_WHEELS += $(SONIC_DAEMON_BASE_PY2)

$(DOCKER_PLATFORM_MONITOR)_DBG_DEPENDS = $($(DOCKER_CONFIG_ENGINE_STRETCH)_DBG_DEPENDS)
$(DOCKER_PLATFORM_MONITOR)_DBG_DEPENDS += $(LIBSWSSCOMMON_DBG)
$(DOCKER_PLATFORM_MONITOR)_DBG_DEPENDS += $(LIBSWSSCOMMON_DBG) $(LIBSENSORS_DBG)
$(DOCKER_PLATFORM_MONITOR)_DBG_DEPENDS += $(LM_SENSORS_DBG) $(SENSORD_DBG)

$(DOCKER_PLATFORM_MONITOR)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_STRETCH)_DBG_IMAGE_PACKAGES)

$(DOCKER_PLATFORM_MONITOR)_LOAD_DOCKERS = $(DOCKER_CONFIG_ENGINE_STRETCH)
Expand Down
2 changes: 2 additions & 0 deletions rules/docker-router-advertiser.mk
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ $(DOCKER_ROUTER_ADVERTISER)_PATH = $(DOCKERS_PATH)/$(DOCKER_ROUTER_ADVERTISER_ST

$(DOCKER_ROUTER_ADVERTISER)_DEPENDS += $(RADVD) $(REDIS_TOOLS)
$(DOCKER_ROUTER_ADVERTISER)_DBG_DEPENDS = $($(DOCKER_CONFIG_ENGINE_STRETCH)_DBG_DEPENDS)
$(DOCKER_ROUTER_ADVERTISER)_DBG_DEPENDS += $(RADVD_DBG)

$(DOCKER_ROUTER_ADVERTISER)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_STRETCH)_DBG_IMAGE_PACKAGES)

$(DOCKER_ROUTER_ADVERTISER)_LOAD_DOCKERS = $(DOCKER_CONFIG_ENGINE_STRETCH)
Expand Down
2 changes: 2 additions & 0 deletions rules/docker-teamd.mk
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ $(DOCKER_TEAMD)_PATH = $(DOCKERS_PATH)/$(DOCKER_TEAMD_STEM)
$(DOCKER_TEAMD)_DEPENDS += $(SWSS) $(LIBTEAMDCT) $(LIBTEAM_UTILS) $(REDIS_TOOLS)
$(DOCKER_TEAMD)_DBG_DEPENDS = $($(DOCKER_CONFIG_ENGINE_STRETCH)_DBG_DEPENDS)
$(DOCKER_TEAMD)_DBG_DEPENDS += $(SWSS_DBG) $(LIBSWSSCOMMON_DBG)
$(DOCKER_TEAMD)_DBG_DEPENDS += $(LIBTEAMDCT_DBG) $(LIBTEAM_UTILS_DBG) $(REDIS_TOOLS)
renukamanavalan marked this conversation as resolved.
Show resolved Hide resolved

$(DOCKER_TEAMD)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_STRETCH)_DBG_IMAGE_PACKAGES)

$(DOCKER_TEAMD)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_STRETCH)
Expand Down
9 changes: 9 additions & 0 deletions rules/libteam.mk
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,22 @@ $(LIBTEAM)_SRC_PATH = $(SRC_PATH)/libteam
$(LIBTEAM)_DEPENDS += $(LIBNL_GENL3_DEV) $(LIBNL_CLI_DEV)
SONIC_MAKE_DEBS += $(LIBTEAM)

LIBTEAM_DBG = libteam5-dbgsym_$(LIBTEAM_VERSION)_amd64.deb
$(eval $(call add_derived_package,$(LIBTEAM),$(LIBTEAM_DBG)))

LIBTEAM_DEV = libteam-dev_$(LIBTEAM_VERSION)_amd64.deb
$(LIBTEAM_DEV)_DEPENDS += $(LIBTEAMDCT)
$(eval $(call add_derived_package,$(LIBTEAM),$(LIBTEAM_DEV)))

LIBTEAMDCT = libteamdctl0_$(LIBTEAM_VERSION)_amd64.deb
$(eval $(call add_derived_package,$(LIBTEAM),$(LIBTEAMDCT)))

LIBTEAMDCT_DBG = libteamdctl0-dbgsym_$(LIBTEAM_VERSION)_amd64.deb
$(eval $(call add_derived_package,$(LIBTEAMDCT),$(LIBTEAMDCT_DBG)))

LIBTEAM_UTILS = libteam-utils_$(LIBTEAM_VERSION)_amd64.deb
$(LIBTEAM_UTILS)_DEPENDS += $(LIBTEAMDCT)
$(eval $(call add_derived_package,$(LIBTEAM),$(LIBTEAM_UTILS)))

LIBTEAM_UTILS_DBG = libteam-utils-dbgsym_$(LIBTEAM_VERSION)_amd64.deb
$(eval $(call add_derived_package,$(LIBTEAM_UTILS),$(LIBTEAM_UTILS_DBG)))
12 changes: 12 additions & 0 deletions rules/lm-sensors.mk
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,25 @@ LM_SENSORS_VERSION_FULL=$(LM_SENSORS_VERSION)-4
LM_SENSORS = lm-sensors_$(LM_SENSORS_VERSION_FULL)_amd64.deb
$(LM_SENSORS)_SRC_PATH = $(SRC_PATH)/lm-sensors

LM_SENSORS_DBG = lm-sensors-dbgsym_$(LM_SENSORS_VERSION_FULL)_amd64.deb
$(eval $(call add_derived_package,$(LM_SENSORS),$(LM_SENSORS_DBG)))

FANCONTROL = fancontrol_$(LM_SENSORS_VERSION_FULL)_all.deb
$(eval $(call add_derived_package,$(LM_SENSORS),$(FANCONTROL)))

LIBSENSORS = libsensors4_$(LM_SENSORS_VERSION_FULL)_amd64.deb
$(eval $(call add_derived_package,$(LM_SENSORS),$(LIBSENSORS)))

LIBSENSORS_DBG = libsensors4-dbgsym_$(LM_SENSORS_VERSION_FULL)_amd64.deb
$(eval $(call add_derived_package,$(LIBSENSORS),$(LIBSENSORS_DBG)))

SENSORD = sensord_$(LM_SENSORS_VERSION_FULL)_amd64.deb
$(eval $(call add_derived_package,$(LM_SENSORS),$(SENSORD)))
$(SENSORD)_DEPENDS += $(LIBSENSORS) $(LM_SENSORS)

SENSORD_DBG = sensord-dbgsym_$(LM_SENSORS_VERSION_FULL)_amd64.deb
$(eval $(call add_derived_package,$(SENSORD),$(SENSORD_DBG)))

SONIC_MAKE_DEBS += $(LM_SENSORS)

export LM_SENSORS
Expand All @@ -24,3 +33,6 @@ export LIBSENSORS
export SENSORD
export LM_SENSORS_VERSION
export LM_SENSORS_VERSION_FULL
export LM_SENSORS_DBG
export LIBSENSORS_DBG
export SENSORD_DBG
3 changes: 3 additions & 0 deletions rules/radvd.mk
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ RADVD = radvd_$(RADVD_VERSION)_amd64.deb
$(RADVD)_SRC_PATH = $(SRC_PATH)/radvd
SONIC_MAKE_DEBS += $(RADVD)
SONIC_STRETCH_DEBS += $(RADVD)

RADVD_DBG = radvd-dbgsym_$(RADVD_VERSION)_amd64.deb
$(eval $(call add_derived_package,$(RADVD),$(RADVD_DBG)))
3 changes: 3 additions & 0 deletions rules/redis.mk
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ SONIC_MAKE_DEBS += $(REDIS_TOOLS)
REDIS_SERVER = redis-server_$(REDIS_VERSION)_amd64.deb
$(eval $(call add_derived_package,$(REDIS_TOOLS),$(REDIS_SERVER)))

REDIS_SERVER_DBG = redis-server-dbgsym_$(REDIS_VERSION)_amd64.deb
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In recent builds, redis-server-dbgsym package is NOT found.

dpkg-deb: building package 'redis' in '../redis_5.0.3-3~bpo9+2_all.deb'.
dpkg-deb: building package 'redis-tools-dbgsym' in '../redis-tools-dbgsym_5.0.3-3~bpo9+2_amd64.deb'.
dpkg-deb: building package 'redis-tools' in '../redis-tools_5.0.3-3~bpo9+2_amd64.deb'.
dpkg-deb: building package 'redis-sentinel' in '../redis-sentinel_5.0.3-3~bpo9+2_amd64.deb'.
dpkg-deb: building package 'redis-server' in '../redis-server_5.0.3-3~bpo9+2_amd64.deb'.
make[2]: Leaving directory '/sonic/src/redis/redis_build/redis-5.0.3'
 dpkg-genbuildinfo --build=binary
 dpkg-genchanges --build=binary >../redis_5.0.3-3~bpo9+2_amd64.changes
dpkg-genchanges: info: binary-only upload (no source code included)
 dpkg-source --after-build redis-5.0.3
dpkg-source: info: using options from redis-5.0.3/debian/source/options: --extend-diff-ignore=^\.travis\.yml$
dpkg-buildpackage: info: binary-only upload (no source included)
/sonic/src/redis/redis_build /sonic/src/redis
mv: cannot stat 'redis-server-dbgsym_5.0.3-3~bpo9+2_amd64.deb': No such file or directory
Makefile:14: recipe for target '/sonic/target/debs/stretch/redis-server_5.0.3-3~bpo9+2_amd64.deb' failed

$(eval $(call add_derived_package,$(REDIS_SERVER),$(REDIS_SERVER_DBG)))

REDIS_SENTINEL = redis-sentinel_$(REDIS_VERSION)_amd64.deb
$(REDIS_SENTINEL)_DEPENDS += $(REDIS_SERVER)
$(REDIS_SENTINEL)_RDEPENDS += $(REDIS_SERVER)
Expand Down
2 changes: 2 additions & 0 deletions slave.mk
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \
export swsssdk_py2_wheel_path="$(addprefix $(PYTHON_WHEELS_PATH)/,$(SWSSSDK_PY2))"
export platform_common_py2_wheel_path="$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_PLATFORM_COMMON_PY2))"
export redis_dump_load_py2_wheel_path="$(addprefix $(PYTHON_WHEELS_PATH)/,$(REDIS_DUMP_LOAD_PY2))"
export install_debug_image="$(INSTALL_DEBUG_TOOLS)"

$(foreach docker, $($*_DOCKERS),\
export docker_image="$(docker)"
Expand Down Expand Up @@ -649,6 +650,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \
chmod +x sonic_debian_extension.sh,
)

DEBUG_IMG="$(INSTALL_DEBUG_TOOLS)" \
USERNAME="$(USERNAME)" \
PASSWORD="$(PASSWORD)" \
./build_debian.sh $(LOG)
Expand Down
5 changes: 4 additions & 1 deletion src/libteam/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ SHELL = /bin/bash
MAIN_TARGET = libteam5_$(LIBTEAM_VERSION)_amd64.deb
DERIVED_TARGETS = libteam-dev_$(LIBTEAM_VERSION)_amd64.deb \
libteamdctl0_$(LIBTEAM_VERSION)_amd64.deb \
libteam-utils_$(LIBTEAM_VERSION)_amd64.deb
libteam-utils_$(LIBTEAM_VERSION)_amd64.deb \
libteam5-dbgsym_$(LIBTEAM_VERSION)_amd64.deb \
libteamdctl0-dbgsym_$(LIBTEAM_VERSION)_amd64.deb \
libteam-utils-dbgsym_$(LIBTEAM_VERSION)_amd64.deb

$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% :
# Obtain libteam
Expand Down
5 changes: 4 additions & 1 deletion src/lm-sensors/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ SHELL = /bin/bash
MAIN_TARGET = $(LM_SENSORS)
DERIVED_TARGETS = fancontrol_$(LM_SENSORS_VERSION_FULL)_all.deb \
libsensors4_$(LM_SENSORS_VERSION_FULL)_amd64.deb \
sensord_$(LM_SENSORS_VERSION_FULL)_amd64.deb
sensord_$(LM_SENSORS_VERSION_FULL)_amd64.deb \
$(LM_SENSORS_DBG) \
$(LIBSENSORS_DBG) \
$(SENSORD_DBG)

$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% :
rm -rf lm-sensors-$(LM_SENSORS_VERSION)
Expand Down
3 changes: 2 additions & 1 deletion src/radvd/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ SHELL = /bin/bash
.SHELLFLAGS += -e

MAIN_TARGET = radvd_$(RADVD_VERSION)_amd64.deb
DERIVED_TARGETS = radvd-dbgsym_$(RADVD_VERSION)_amd64.deb

$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% :
# Remove any stale files
Expand All @@ -28,4 +29,4 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% :
popd

# Move the newly-built .deb package to the destination directory
mv $* $(DEST)/
mv $(DERIVED_TARGETS) $* $(DEST)/
3 changes: 2 additions & 1 deletion src/redis/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ REDIS_VERSION_FULL = $(REDIS_VERSION)-1~bpo8+1

MAIN_TARGET = redis-server_$(REDIS_VERSION_FULL)_amd64.deb
DERIVED_TARGETS = redis-tools_$(REDIS_VERSION_FULL)_amd64.deb \
redis-sentinel_$(REDIS_VERSION_FULL)_amd64.deb
redis-sentinel_$(REDIS_VERSION_FULL)_amd64.deb \
redis-server-dbgsym_$(REDIS_VERSION_FULL)_amd64.deb

$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% :
rm -rf redis_build
Expand Down