[Bug]: gdb 18.1 aarch64 internal-error box_one_message assertion failed
Problem description
Package name: gdb Package version: 18.1 Architecture: aarch64
Describe the bug
When executing gdb ./a, GDB crashes immediately with an internal assertion error before starting debugging.
Error log:
/home/builder/.termux-build/gdb/src/gdb/top.c:1485: internal-error: box_one_message: Assertion `(escape - message.c_str () - n_escape_chars) < width' failed.
A problem internal to GDB has been detected, further debugging may prove unreliable.
Steps to reproduce
- Compile a C program with gcc and get binary
./a(the binary has segmentation fault). - Run command:
gdb ./a - GDB tries to render boxed hint message and hit the assertion failure.
Workaround
Use gdb -nx ./a can skip this crash and work normally.
This bug is related to box message rendering and ANSI escape sequence length calculation.
Error log
~ $ gdb ./a
GNU gdb (GDB) 18.1
Copyright (C) 2026 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "aarch64-linux-android".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
/home/builder/.termux-build/gdb/src/gdb/top.c:1485: internal-error: box_one_message: Assertion `(escape - message.c_str () - n_escape_chars) < width' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
----- Backtrace -----
0x63c859642b _Z22gdb_internal_backtracev
0x63c88bfb2f ???
0x63c88bf99f _Z15internal_verrorPKciS0_St9__va_list
0x63c89f04f3 _Z18internal_error_locPKciS0_z
0x63c8891ba7 _Z15print_gdb_hintsP7ui_file
0x63c8743723 _Z8gdb_mainP18captured_main_args
0x63c84e9cbb main
---------------------
/home/builder/.termux-build/gdb/src/gdb/top.c:1485: internal-error: box_one_message: Assertion `(escape - message.c_str () - n_escape_chars) < width' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n) run # 运行,程序崩溃会停在出错那一行
Please answer y or n.
/home/builder/.termux-build/gdb/src/gdb/top.c:1485: internal-error: box_one_message: Assertion `(escape - message.c_str () - n_escape_chars) < width' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n) bt # backtrace,打印调用栈,直接看到崩溃位置
Please answer y or n.
/home/builder/.termux-build/gdb/src/gdb/top.c:1485: internal-error: box_one_message: Assertion `(escape - message.c_str () - n_escape_chars) < width' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n)
What steps will reproduce the bug?
- Compile a C program by gcc, generate binary file ./a (the binary will trigger segmentation fault when running).
- Run command: gdb ./a
- GDB attempts to render the box hint message and crashes with the assertion failure immediately.
What is the expected behavior?
GDB should start normally and enter interactive shell, allow me to debug the binary ./a, instead of crashing with internal assertion error.
System information
~ $ termux-info
Termux Variables:
TERMUX_APP_PACKAGE_MANAGER=apt
TERMUX_APP__APK_FILE=/data/app/~~VJ2w5WIM8OPDKCd3sXlqiQ==/com.termux-tXuUOkppDwiNBrEGKvExZg==/base.apk
TERMUX_APP__APK_RELEASE=UNKNOWN
TERMUX_APP__APP_VERSION_CODE=1022
TERMUX_APP__APP_VERSION_NAME=0.119.0-beta.3
TERMUX_APP__DATA_DIR=/data/user/0/com.termux
TERMUX_APP__IS_DEBUGGABLE_BUILD=false
TERMUX_APP__IS_INSTALLED_ON_EXTERNAL_STORAGE=false
TERMUX_APP__LEGACY_DATA_DIR=/data/data/com.termux
TERMUX_APP__PACKAGE_NAME=com.termux
TERMUX_APP__PID=8622
TERMUX_APP__SE_FILE_CONTEXT=u:object_r:app_data_file:s0:c121,c257,c512,c768
TERMUX_APP__SE_INFO=default:targetSdkVersion=28:complete
TERMUX_APP__TARGET_SDK=28
TERMUX_VERSION=0.119.0-beta.3
TERMUX__APPS_DIR=/data/user/0/com.termux/termux/apps
TERMUX__HOME=/data/data/com.termux/files/home
TERMUX__PREFIX=/data/data/com.termux/files/usr
TERMUX__ROOTFS_DIR=/data/data/com.termux/files
TERMUX__SE_PROCESS_CONTEXT=u:r:untrusted_app_27:s0:c121,c257,c512,c768
TERMUX__UID=10377
TERMUX__USER_ID=0
Packages CPU architecture:
aarch64
Subscribed repositories:
# sources.list
deb https://mirror.sjtu.edu.cn/termux/termux-main/ stable main
# sources.list.d/pointless.list
deb https://its-pointless.github.io/files/21 termux extras
# tur-repo (sources.list.d/tur.list)
deb https://tur.kcubeterm.com tur-packages tur tur-on-device tur-continuous
# x11-repo (sources.list.d/x11.list)
deb https://mirror.sjtu.edu.cn/termux/termux-x11/ x11 main
# root-repo (sources.list.d/root.list)
deb https://mirror.sjtu.edu.cn/termux/termux-root/ root stable
# glibc-repo (sources.list.d/glibc.list)
deb https://packages-cf.termux.dev/apt/termux-glibc/ glibc stable
Updatable packages:
command-not-found/stable 3.5.0-13 aarch64 [upgradable from: 3.5.0-12]
gspell/x11 1.14.5 aarch64 [upgradable from: 1.14.4]
termux-tools version:
1.45.0
Android version:
14
Kernel build information:
Linux localhost 4.19.191+ #1 SMP PREEMPT Mon Jul 6 20:52:26 CST 2026 aarch64 Android
Device manufacturer:
OPPO
Device model:
PJU110
Supported ABIs:
SUPPORTED_ABIS: arm64-v8a,armeabi-v7a,armeabi
SUPPORTED_32_BIT_ABIS: armeabi-v7a,armeabi
SUPPORTED_64_BIT_ABIS: arm64-v8a
LD Variables:
LD_LIBRARY_PATH=
LD_PRELOAD=/data/data/com.termux/files/usr/lib/libtermux-exec-ld-preload.so
Installed termux plugins:
com.termux.api versionCode:1002
com.termux.boot versionCode:1000
com.termux.x11 versionCode:15
~ $
Can you please install artifacts from https://github.com/termux/termux-packages/actions/runs/36305705295 and tell if it solves the problem?
@1234562026 ?
Sorry for the late reply. I was busy pulling the source code locally and trying to fix this bug myself, so I didn't notice this comment. I will download and test this artifact build now.
I have tested this CI build of gdb 18.1-1 for aarch64.
✅ The original box_one_message internal-error crash no longer reproduces.
Test summary:
- TUI mode can be enabled normally.
- Breakpoint setting,
run,nextsingle stepping work fine. - TUI layout switching works, no text overlap, no window rendering corruption.
- When the test program hits SIGSEGV in its own cccc() function, GDB correctly catches the fault, and
btbacktrace command works as expected. This segfault comes from the test program itself, not GDB. - The warnings about missing sections in .gnu_debugdata for Android system libraries are pre-existing, unrelated to this patch.
No new crash or rendering bug found in GDB. The patch works as expected.