1#!/bin/bash 2# Copyright 2021 The gRPC Authors 3# 4# Licensed under the Apache License, Version 2.0 (the "License"); 5# you may not use this file except in compliance with the License. 6# You may obtain a copy of the License at 7# 8# http://www.apache.org/licenses/LICENSE-2.0 9# 10# Unless required by applicable law or agreed to in writing, software 11# distributed under the License is distributed on an "AS IS" BASIS, 12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13# See the License for the specific language governing permissions and 14# limitations under the License. 15 16set -ex 17 18# change to grpc repo root 19cd "$(dirname "$0")/../../.." 20 21# Use the docker image used as the default for C++ by run_tests.py 22# To use the correct docker image for your experiments, 23# note that every invocation of run_tests.py with "--use_docker" 24# prints the docker image used as a debug message at the end of the run. 25# This is expecially important when --compiler/--arch params are 26# use, since they usually influence with docker image will be used 27# by run_tests.py 28export DOCKERFILE_DIR=tools/dockerfile/test/cxx_debian11_x64 29 30# "--privileged" docker arg is required to be able to update /proc/sys/kernel/core_pattern 31export DOCKER_EXTRA_ARGS="--privileged" 32 33# start the docker container with interactive shell 34tools/docker_runners/run_in_docker.sh bash 35 36# Run these commands under the docker container 37# 38# Install gdb (or similar command for non-debian based distros) 39# $ apt-get update && apt-get install -y gdb 40# 41# No limit for coredump size 42# $ ulimit -c unlimited 43# 44# Coredumps will be stored to /tmp/coredumps (inside the docker container) 45# mkdir /tmp/coredumps 46# echo "/tmp/coredumps/core.%p" | tee /proc/sys/kernel/core_pattern 47# 48# Build e.g. the C tests 49# $ ./tools/run_tests/run_tests.py -l c -c dbg --build_only 50# 51# Run a test that crashes, it will create a coredump. 52# $ cmake/build/foo_bar_test 53# 54# Open coredump under gdb 55# $ gdb cmake/build/foo_bar_test /tmp/coredumps/core.XYZ 56