Skip to content

Commit 9a305a7

Browse files
chore(ci): Better coredumps handling
1 parent 1768791 commit 9a305a7

File tree

3 files changed

+3847
-19
lines changed

3 files changed

+3847
-19
lines changed

build/prepare_test_stage.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ source "$SCRIPT_LOCATION"/utils.sh
1111
echo "Arguments received: $@"
1212

1313
optparse.define short=c long=container-name desc="Name of the Docker container to run tests in" variable=CONTAINER_NAME
14-
optparse.define short=i long=docker-image desc="Docker image name to start container from" variable=DOCKER_IMAGE
15-
optparse.define short=r long=result-path desc="Name suffix used in core dump file path" variable=RESULT
16-
optparse.define short=s long=do-setup desc="Run setup-repo.sh inside the container" variable=DO_SETUP
17-
optparse.define short=u long=packages-url desc="Packages url" variable=PACKAGES_URL
14+
optparse.define short=i long=docker-image desc="Docker image name to start container from" variable=DOCKER_IMAGE
15+
optparse.define short=r long=result-path desc="Name suffix used in core dump file path" variable=RESULT
16+
optparse.define short=s long=do-setup desc="Run setup-repo.sh inside the container" variable=DO_SETUP
17+
optparse.define short=u long=packages-url desc="Packages url" variable=PACKAGES_URL
1818
source $(optparse.build)
1919

2020
if [[ "$EUID" -ne 0 ]]; then
@@ -104,10 +104,10 @@ fi
104104

105105
# install deps
106106
if [[ "$RESULT" == *rocky* ]]; then
107-
execInnerDockerWithRetry "$CONTAINER_NAME" 'yum update -y && yum install -y cracklib-dicts diffutils elfutils epel-release findutils iproute gawk gcc-c++ gdb hostname lz4 patch perl procps-ng rsyslog sudo tar wget which'
107+
execInnerDockerWithRetry "$CONTAINER_NAME" 'yum update -y && yum install -y cracklib-dicts diffutils elfutils epel-release expect findutils iproute gawk gcc-c++ gdb hostname lz4 patch perl procps-ng rsyslog sudo tar wget which'
108108
else
109109
change_ubuntu_mirror_in_docker "$CONTAINER_NAME" "us"
110-
execInnerDockerWithRetry "$CONTAINER_NAME" 'apt update -y && apt install -y elfutils findutils iproute2 g++ gawk gdb hostname liblz4-tool patch procps rsyslog sudo tar wget'
110+
execInnerDockerWithRetry "$CONTAINER_NAME" 'apt update -y && apt install -y elfutils expect findutils iproute2 g++ gawk gdb hostname liblz4-tool patch procps rsyslog sudo tar wget'
111111
fi
112112

113113
# Configure core dump naming pattern

core_dumps/core_dump_format.sh

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,24 @@ SCRIPT_LOCATION=$(dirname "$0")
99
DUMPNAME=$4
1010
STEP_NAME=$5
1111

12-
save_ansi_to_html ()
13-
{
14-
echo "<b> $1 </b>" >> "${FILENAME}";
15-
cat "$DUMPNAME" | bash "${SCRIPT_LOCATION}"/ansi2html.sh --palette=solarized >> "${FILENAME}"
16-
}
12+
save_ansi_to_html() {
1713

18-
invoke_gdb_command ()
19-
{
20-
echo "gdb -q ${BINARY} --core ${COREDUMP} -ex '$1' -ex quit"
14+
echo "<h2> $1 </h2>" >>"${FILENAME}"
15+
cat "$DUMPNAME" | bash "${SCRIPT_LOCATION}"/ansi2html.sh --palette=solarized >>"${FILENAME}"
16+
}
17+
invoke_gdb_command() {
18+
unbuffer gdb -x "${SCRIPT_LOCATION}"/gdbinit -q ${BINARY} --core ${COREDUMP} -ex "$1" -ex quit >>"$DUMPNAME"
2119
}
2220

21+
echo "<h1> Step: ${STEP_NAME}<br> Binary name: ${BINARY}<br> </h1>" >>"${FILENAME}"
2322

24-
gdb -q "${BINARY}" --core ${COREDUMP} -ex 'bt' -ex quit >> "$DUMPNAME"
25-
gdb -q "${BINARY}" --core ${COREDUMP} -ex 'info args' -ex quit >> "$DUMPNAME"
26-
gdb -q "${BINARY}" --core ${COREDUMP} -ex 'info locals' -ex quit >> "$DUMPNAME"
27-
28-
echo "<b> Step: ${STEP_NAME}<br> Binary name: ${BINARY}<br> </b>" >> "${FILENAME}";
23+
invoke_gdb_command 'bt full'
2924
save_ansi_to_html "Backtrace"
25+
26+
invoke_gdb_command "info args"
3027
save_ansi_to_html "Arguments"
28+
29+
invoke_gdb_command "info locals"
3130
save_ansi_to_html "Locals"
3231

3332
gzip -5 "${COREDUMP}"

0 commit comments

Comments
 (0)