Skip to content

Commit dd20e91

Browse files
committed
8374521: Support fine-grained native debug levels
Reviewed-by: erikj, krk, clanger
1 parent 640343f commit dd20e91

File tree

5 files changed

+27
-4
lines changed

5 files changed

+27
-4
lines changed

.github/workflows/build-alpine-linux.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ jobs:
9797
--with-zlib=system
9898
--with-jmod-compress=zip-1
9999
--with-external-symbols-in-bundles=none
100+
--with-debug-info-level=1
100101
${{ inputs.extra-conf-options }} ${{ inputs.configure-arguments }} || (
101102
echo "Dumping config.log:" &&
102103
cat config.log &&

.github/workflows/build-cross-compile.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ jobs:
180180
--with-sysroot=sysroot
181181
--with-jmod-compress=zip-1
182182
--with-external-symbols-in-bundles=none
183+
--with-debug-info-level=1
183184
CC=${{ matrix.gnu-arch }}-linux-gnu${{ matrix.gnu-abi}}-gcc-${{ inputs.gcc-major-version }}
184185
CXX=${{ matrix.gnu-arch }}-linux-gnu${{ matrix.gnu-abi}}-g++-${{ inputs.gcc-major-version }}
185186
${{ inputs.extra-conf-options }} ${{ inputs.configure-arguments }} || (

.github/workflows/build-linux.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ jobs:
144144
--with-zlib=system
145145
--with-jmod-compress=zip-1
146146
--with-external-symbols-in-bundles=none
147+
--with-debug-info-level=1
147148
${{ inputs.extra-conf-options }} ${{ inputs.configure-arguments }} || (
148149
echo "Dumping config.log:" &&
149150
cat config.log &&

.github/workflows/build-macos.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ jobs:
111111
--with-zlib=system
112112
--with-jmod-compress=zip-1
113113
--with-external-symbols-in-bundles=none
114+
--with-debug-info-level=1
114115
${{ inputs.extra-conf-options }} ${{ inputs.configure-arguments }} || (
115116
echo "Dumping config.log:" &&
116117
cat config.log &&

make/autoconf/flags-cflags.m4

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,23 @@ AC_DEFUN([FLAGS_SETUP_DEBUG_SYMBOLS],
6969
# Debug prefix mapping if supported by compiler
7070
DEBUG_PREFIX_CFLAGS=
7171
72+
UTIL_ARG_WITH(NAME: debug-info-level, TYPE: string,
73+
DEFAULT: "",
74+
RESULT: DEBUG_INFO_LEVEL,
75+
DESC: [Sets the debug info level, when debug info generation is enabled (GCC and Clang only)],
76+
DEFAULT_DESC: [default])
77+
AC_SUBST(DEBUG_INFO_LEVEL)
78+
79+
if test "x${TOOLCHAIN_TYPE}" = xgcc || \
80+
test "x${TOOLCHAIN_TYPE}" = xclang; then
81+
DEBUG_INFO_LEVEL_FLAGS="-g"
82+
if test "x${DEBUG_INFO_LEVEL}" != "x"; then
83+
DEBUG_INFO_LEVEL_FLAGS="-g${DEBUG_INFO_LEVEL}"
84+
FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [${DEBUG_INFO_LEVEL_FLAGS}],
85+
IF_FALSE: AC_MSG_ERROR("Debug info level ${DEBUG_INFO_LEVEL} is not supported"))
86+
fi
87+
fi
88+
7289
# Debug symbols
7390
if test "x$TOOLCHAIN_TYPE" = xgcc; then
7491
if test "x$ALLOW_ABSOLUTE_PATHS_IN_OUTPUT" = "xfalse"; then
@@ -93,8 +110,9 @@ AC_DEFUN([FLAGS_SETUP_DEBUG_SYMBOLS],
93110
)
94111
fi
95112
96-
CFLAGS_DEBUG_SYMBOLS="-g -gdwarf-4"
97-
ASFLAGS_DEBUG_SYMBOLS="-g"
113+
# Debug info level should follow the debug format to be effective.
114+
CFLAGS_DEBUG_SYMBOLS="-gdwarf-4 ${DEBUG_INFO_LEVEL_FLAGS}"
115+
ASFLAGS_DEBUG_SYMBOLS="${DEBUG_INFO_LEVEL_FLAGS}"
98116
elif test "x$TOOLCHAIN_TYPE" = xclang; then
99117
if test "x$ALLOW_ABSOLUTE_PATHS_IN_OUTPUT" = "xfalse"; then
100118
# Check if compiler supports -fdebug-prefix-map. If so, use that to make
@@ -113,8 +131,9 @@ AC_DEFUN([FLAGS_SETUP_DEBUG_SYMBOLS],
113131
FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [${GDWARF_FLAGS}],
114132
IF_FALSE: [GDWARF_FLAGS=""])
115133
116-
CFLAGS_DEBUG_SYMBOLS="-g ${GDWARF_FLAGS}"
117-
ASFLAGS_DEBUG_SYMBOLS="-g"
134+
# Debug info level should follow the debug format to be effective.
135+
CFLAGS_DEBUG_SYMBOLS="${GDWARF_FLAGS} ${DEBUG_INFO_LEVEL_FLAGS}"
136+
ASFLAGS_DEBUG_SYMBOLS="${DEBUG_INFO_LEVEL_FLAGS}"
118137
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
119138
CFLAGS_DEBUG_SYMBOLS="-Z7"
120139
fi

0 commit comments

Comments
 (0)