Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Bug#1034611: arm64: thread.c:85: Assertion `current_thread_ != nullptr'

258 views
Skip to first unread message

Adit Sahasrabudhe

unread,
Apr 19, 2023, 2:40:05 PM4/19/23
to
Package: gdb
Version: 13.1-2
Severity: important

Dear Maintainer,

On my bookworm install (in a Parallels VM), any attempt to debug a program results in the error:

thread.c:85: internal-error: inferior_thread: Assertion `current_thread_ != nullptr' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.

I downloaded v13.1 source, and built it with "-g -O0", and here is the backtrace I get when running a simple hello world:

----- Backtrace -----
0xaaaacee2ff5b gdb_internal_backtrace_1
/home/asahasra/code/gdb-13.1/gdb/bt-utils.c:122
0xaaaacee2ff5b _Z22gdb_internal_backtracev
/home/asahasra/code/gdb-13.1/gdb/bt-utils.c:168
0xaaaacf1802ef internal_vproblem
/home/asahasra/code/gdb-13.1/gdb/utils.c:396
0xaaaacf180553 _Z15internal_verrorPKciS0_St9__va_list
/home/asahasra/code/gdb-13.1/gdb/utils.c:476
0xaaaacf3f33e3 _Z18internal_error_locPKciS0_z
/home/asahasra/code/gdb-13.1/gdbsupport/errors.cc:58
0xaaaacf13a527 _Z15inferior_threadv
/home/asahasra/code/gdb-13.1/gdb/thread.c:85
0xaaaacf13b0ff _Z15inferior_threadv
/home/asahasra/code/gdb-13.1/gdb/thread.c:84
0xaaaacf085ddb _Z20get_current_regcachev
/home/asahasra/code/gdb-13.1/gdb/regcache.c:428
0xaaaaced7e8f3 aarch64_remove_non_address_bits
/home/asahasra/code/gdb-13.1/gdb/aarch64-linux-tdep.c:2002
0xaaaacf135767 memory_xfer_partial
/home/asahasra/code/gdb-13.1/gdb/target.c:1620
0xaaaacf135767 _Z19target_xfer_partialP10target_ops13target_objectPKcPhPKhmmPm
/home/asahasra/code/gdb-13.1/gdb/target.c:1684
0xaaaacf135c77 target_read_partial
/home/asahasra/code/gdb-13.1/gdb/target.c:1937
0xaaaacf135c77 _Z11target_readP10target_ops13target_objectPKcPhml
/home/asahasra/code/gdb-13.1/gdb/target.c:1977
0xaaaacf135d27 _Z18target_read_memorymPhl
/home/asahasra/code/gdb-13.1/gdb/target.c:1773
0xaaaacf02fb77 ps_xfer_memory
/home/asahasra/code/gdb-13.1/gdb/proc-service.c:90
0xffffa8085387 _td_fetch_value
./nptl_db/fetch-value.c:115
0xffffa808230f td_ta_map_lwp2thr
./nptl_db/td_ta_map_lwp2thr.c:194
0xaaaacefbfb53 thread_from_lwp
/home/asahasra/code/gdb-13.1/gdb/linux-thread-db.c:413
0xaaaacefc1107 _ZN16thread_db_target4waitE6ptid_tP17target_waitstatus10enum_flagsI16target_wait_flagE
/home/asahasra/code/gdb-13.1/gdb/linux-thread-db.c:1420
0xaaaacf137d5f _Z11target_wait6ptid_tP17target_waitstatus10enum_flagsI16target_wait_flagE
/home/asahasra/code/gdb-13.1/gdb/target.c:2579
0xaaaacef830d3 do_target_wait_1
/home/asahasra/code/gdb-13.1/gdb/infrun.c:3736
0xaaaacef93197 operator()
/home/asahasra/code/gdb-13.1/gdb/infrun.c:3795
0xaaaacef93197 do_target_wait
/home/asahasra/code/gdb-13.1/gdb/infrun.c:3814
0xaaaacef93197 _Z20fetch_inferior_eventv
/home/asahasra/code/gdb-13.1/gdb/infrun.c:4172
0xaaaacf3f3863 gdb_wait_for_event
/home/asahasra/code/gdb-13.1/gdbsupport/event-loop.cc:716
0xaaaacf3f4357 _Z16gdb_do_one_eventi
/home/asahasra/code/gdb-13.1/gdbsupport/event-loop.cc:217
0xaaaacefd1e8f start_event_loop
/home/asahasra/code/gdb-13.1/gdb/main.c:411
0xaaaacefd1e8f captured_command_loop
/home/asahasra/code/gdb-13.1/gdb/main.c:471
0xaaaacefd3893 captured_main
/home/asahasra/code/gdb-13.1/gdb/main.c:1330
0xaaaacefd3893 _Z8gdb_mainP18captured_main_args
/home/asahasra/code/gdb-13.1/gdb/main.c:1345
0xaaaaced758f3 main
/home/asahasra/code/gdb-13.1/gdb/gdb.c:32
---------------------

I enabled thread debugging in thread.c and before the assertion, this is what I see:

Starting program: /home/asahasra/code/hello/hello
[threads] add_thread_silent: add thread to inferior 1, ptid 1023755.0.0, target native
[threads] new_thread: creating a new thread object, inferior 1, ptid 1023755.0.0
[threads] switch_to_thread_no_regs: thread = 1023755.0.0
[threads] set_running_thread: thread: 1023755.1023755.0, running? 1 (started)
[threads] switch_to_thread_no_regs: thread = 1023755.1023755.0
[threads] switch_to_thread_no_regs: thread = 1023755.1023755.0
[threads] switch_to_no_thread: thread = NONE
[threads] switch_to_thread_no_regs: thread = 1023755.1023755.0
[threads] switch_to_no_thread: thread = NONE
[threads] switch_to_thread_no_regs: thread = 1023755.1023755.0
[threads] switch_to_no_thread: thread = NONE

The above two statements repeat many times before the assert hits.

Lastly, I tried two other tags:
gdb-12.1-release - this seems to work fine
gdb-13-branchpoint - this fails

That hopefully helps narrow down which commit broke this.


-- System Information:
Debian Release: 12.0
APT prefers testing-security
APT policy: (500, 'testing-security'), (500, 'testing')
Architecture: arm64 (aarch64)
Foreign Architectures: amd64

Kernel: Linux 6.1.0-7-arm64 (SMP w/6 CPU threads)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages gdb depends on:
ii libbabeltrace1 1.5.11-1+b2
ii libc6 2.36-9
ii libdebuginfod1 0.188-2.1
ii libexpat1 2.5.0-1
ii libgcc-s1 12.2.0-14
ii libgmp10 2:6.2.1+dfsg1-1.1
ii liblzma5 5.4.1-0.2
ii libmpfr6 4.2.0-1
ii libncursesw6 6.4-2
ii libpython3.11 3.11.2-6
ii libreadline8 8.2-1.3
ii libsource-highlight4v5 3.1.9-4.2+b3
ii libstdc++6 12.2.0-14
ii libtinfo6 6.4-2
ii libxxhash0 0.8.1-1
ii libzstd1 1.5.4+dfsg2-5
ii zlib1g 1:1.2.13.dfsg-1

Versions of packages gdb recommends:
ii libc6-dbg [libc-dbg] 2.36-9

Versions of packages gdb suggests:
pn gdb-doc <none>
pn gdbserver <none>

-- no debconf information

Adit Sahasrabudhe

unread,
Apr 19, 2023, 3:00:04 PM4/19/23
to
Also I should note that there are no kernel messages in dmesg when this happens.

Adit Sahasrabudhe

unread,
Apr 23, 2023, 12:10:04 AM4/23/23
to

Emanuele Rocca

unread,
May 9, 2023, 4:30:04 AM5/9/23
to
Control: tag -1 pending

Hi Adit,

On 2023-04-22 09:05, Adit Sahasrabudhe wrote:
> And I tested the patch at this link and it worked.
>
> https://sourceware.org/git/?p=binutils-gdb.git;a=patch;h=b3eff3e15576229af9bae026c5c23ee694b90389

Many thanks for finding the patch and trying it out. I can confirm that
it works for me too.

The gdb maintainer mentioned in [1] that an upload is pending, so
tagging this bug accordingly.

[1] https://bugs.debian.org/1035515#12
0 new messages