RTEMS Source Builder | gdb has problems with x86_64 due to TLS patch (#217)
Christian Mauderer (@c-mauderer)
gitlab at rtems.org
Mon Nov 2 14:28:55 UTC 2026
Issue created by Christian Mauderer: https://gitlab.rtems.org/rtems/tools/rtems-source-builder/-/work_items/217
## Summary
I try to use the x86_64-rtems-gdb together with qemu to debug an application. Unfortunately, gdb crashes when it tries to connect to qemu.
I start qemu with the following line:
```
> qemu-system-x86_64 -net none -m 1024 -serial vc --bios OVMF.4m.fd -drive file=fat:RTEMS-GRUB,format=raw,snapshot=on -gdb tcp::1234 -no-shutdown
```
`RTEMS-GRUB` is a directory with a GRUB in EFI format and the application. But it shouldn't matter for this bug whether GRUB, FreeBSD loader or any other variant is used.
Then I start gdb:
```
> ../rtems-install/bin/x86_64-rtems7-gdb
GNU gdb (GDB) 17.2
Copyright (C) 2025 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 "--host=x86_64-linux-gnu --target=x86_64-rtems7".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".
(gdb) target remote localhost:1234
Remote debugging using localhost:1234
⚠️ warning: No executable has been specified and target does not support
determining executable automatically. Try using the "file" command.
0x000000003e69aadb in ?? ()
(gdb) file RTEMS-GRUB/rtems.exe
A program is being debugged already.
Are you sure you want to change the file? (y or n) y
../../gdb-17.2/gdb/osabi.c:196: internal-error: gdbarch_lookup_osabi: multiple specific OS ABI match for architecture i386 flavour 5: first match "RTEMS", second match "RTEMS"
A problem internal to GDB has been detected,
further debugging may prove unreliable.
----- Backtrace -----
0x4fb439 gdb_internal_backtrace_1
../../gdb-17.2/gdb/bt-utils.c:122
0x4fb439 _Z22gdb_internal_backtracev
../../gdb-17.2/gdb/bt-utils.c:175
0x8b4494 internal_vproblem
../../gdb-17.2/gdb/utils.c:423
0x8b4838 _Z15internal_verrorPKciS0_P13__va_list_tag
../../gdb-17.2/gdb/utils.c:503
0xa017d1 _Z18internal_error_locPKciS0_z
../../gdb-17.2/gdbsupport/errors.cc:57
0x718f09 _Z20gdbarch_lookup_osabiP3bfd
../../gdb-17.2/gdb/osabi.c:196
0x4a72a8 _Z17gdbarch_info_fillP12gdbarch_info
../../gdb-17.2/gdb/arch-utils.c:824
0x4b4d0a _Z20gdbarch_find_by_info12gdbarch_info
../../gdb-17.2/gdb/arch-utils.c:1393
0x4b5c35 _Z21set_gdbarch_from_fileP3bfd
../../gdb-17.2/gdb/arch-utils.c:659
0x620ffe _Z16exec_file_attachPKci
../../gdb-17.2/gdb/exec.c:503
0x621e83 exec_file_command
../../gdb-17.2/gdb/exec.c:563
0x621f10 file_command
../../gdb-17.2/gdb/exec.c:578
0x531597 _Z8cmd_funcP16cmd_list_elementPKci
../../gdb-17.2/gdb/cli/cli-decode.c:2827
0x8747ac _Z15execute_commandPKci
../../gdb-17.2/gdb/top.c:565
0x61d91f _Z15command_handlerPKc
../../gdb-17.2/gdb/event-top.c:613
0x61f19a _Z20command_line_handlerOSt10unique_ptrIcN3gdb13xfree_deleterIcEEE
../../gdb-17.2/gdb/event-top.c:849
0x61e3dd gdb_rl_callback_handler
../../gdb-17.2/gdb/event-top.c:288
0x901bf8 rl_callback_read_char
../../../gdb-17.2/readline/readline/callback.c:302
0x61e4fd gdb_rl_callback_read_char_wrapper_sjlj
../../gdb-17.2/gdb/event-top.c:197
0x61e68e gdb_rl_callback_read_char_wrapper_noexcept
../../gdb-17.2/gdb/event-top.c:240
0x61e68e gdb_rl_callback_read_char_wrapper
../../gdb-17.2/gdb/event-top.c:252
0x8ae4cf stdin_event_handler
../../gdb-17.2/gdb/ui.c:154
0xa02165 gdb_wait_for_event
../../gdb-17.2/gdbsupport/event-loop.cc:694
0xa02dc3 _Z16gdb_do_one_eventi
../../gdb-17.2/gdbsupport/event-loop.cc:263
0x6d9e91 _ZN6interp12do_one_eventEi
../../gdb-17.2/gdb/interps.h:87
0x6d9e91 start_event_loop
../../gdb-17.2/gdb/main.c:404
0x6d9e91 captured_command_loop
../../gdb-17.2/gdb/main.c:469
0x6dc824 captured_main
../../gdb-17.2/gdb/main.c:1359
0x6dc824 _Z8gdb_mainP18captured_main_args
../../gdb-17.2/gdb/main.c:1378
0x440d9d main
../../gdb-17.2/gdb/gdb.c:38
---------------------
../../gdb-17.2/gdb/osabi.c:196: internal-error: gdbarch_lookup_osabi: multiple specific OS ABI match for architecture i386 flavour 5: first match "RTEMS", second match "RTEMS"
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n) y
This is a bug, please report it. For instructions, see:
<https://www.gnu.org/software/gdb/bugs/>.
../../gdb-17.2/gdb/osabi.c:196: internal-error: gdbarch_lookup_osabi: multiple specific OS ABI match for architecture i386 flavour 5: first match "RTEMS", second match "RTEMS"
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Create a core file of GDB? (y or n) n
…ics-240/rtems-x86_64-env/debug 15:20 >
```
I tracked the problem down to the TLS patch from here: https://gitlab.rtems.org/rtems/tools/rtems-source-builder/-/merge_requests/156
If I compile gdb without it, everything works. The relevant error message seems to be the
```
../../gdb-17.2/gdb/osabi.c:196: internal-error: gdbarch_lookup_osabi: multiple specific OS ABI match for architecture i386 flavour 5: first match "RTEMS", second match "RTEMS"
```
@opticron In case you are working on upstreaming the patch (you mentioned something in the MR), it might be worth to wait a bit till the problem is resolved.
--
View it on GitLab: https://gitlab.rtems.org/rtems/tools/rtems-source-builder/-/work_items/217
You're receiving this email because of your account on gitlab.rtems.org. Unsubscribe from this thread: https://gitlab.rtems.org/-/namespace/14/sent_notifications/6-dm24gblq5n9f2g11gedgfd0e3-e/unsubscribe | Manage all notifications: https://gitlab.rtems.org/-/profile/notifications | Help: https://gitlab.rtems.org/help
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/bugs/attachments/20261102/977a64ac/attachment-0001.htm>
More information about the bugs
mailing list