> On Jul 21, 2025, at 5:13 PM, Thomas Klausner <w...@netbsd.org> wrote: > > Hi! > > I've tried packaging Guitar (see wip/Guitar). But when I run it, it > fails with > > ctype(3) isupper: invalid input: -61 > > I tried running it in gdb, but then gdb hangs or dumps core too. > > I looked at all isupper() uses in the Guitar tarball itself, but they > look fine, so I suspect one of the used libraries is unsafe or gets > passed invalid data, but I'm not sure how to investigate it further. > > Does gdb work on this for anyone else? > Or can someone please fix gdb? :-) > > That's on a 2025-06-24 10.99.14/x86_64. > Thomas
I've run into the same problem trying to debug vlc. I've had some success using devel/gdb. Below is a regular backtrace from a crash of gdb. If I try to get a full backtrace, the enclosing gdb crashes, so after the first backtrace I have tacked on another gdb to get a regular backtrace of the gdb that fails when trying to get a full backtrace of the gdb that fails when trying to debug vlc. thinkpad$ TERM=dumb /usr/pkg/bin/gdb --args gdb vlc GNU gdb (GDB) 10.1 Copyright (C) 2020 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 "x86_64--netbsd". 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"... Reading symbols from gdb... Reading symbols from /usr/libdata/debug//usr/bin/gdb.debug... (gdb) r Starting program: /usr/bin/gdb vlc [New process 28438] [New LWP 17188 of process 28438] [New LWP 28834 of process 28438] [New LWP 16270 of process 28438] GNU gdb (GDB) 15.1 Copyright (C) 2024 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 "x86_64--netbsd". 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"... Reading symbols from vlc... (gdb) r Starting program: /usr/pkg/bin/vlc [New process 28438] [New process 28438] VLC media player 3.0.21 Vetinari (revision 3.0.21-0-gdd8bfdbabe8) [New process 28438] ctype(3) isupper: invalid input: -61 ctype(3) isupper: invalid input: -61 Thread 4 "gdb worker" received signal SIGABRT, Aborted. [Switching to LWP 28834 of process 28438] 0x000074897bcec4da in _lwp_kill () from /usr/lib/libc.so.12 (gdb) bt #0 0x000074897bcec4da in _lwp_kill () from /usr/lib/libc.so.12 #1 0x000074897bcf7914 in abort () at /usr/netbsd/current/src/lib/libc/stdlib/abort.c:74 #2 0x000074897bce7c13 in ctype_nasaldemon ( func=func@entry=0x74897bd13718 <__func__.7> "isupper", c=<optimized out>) at /usr/netbsd/current/src/lib/libc/gen/isctype.c:65 #3 0x000074897bce8035 in ctype_check (c=<optimized out>, func=0x74897bd13718 <__func__.7> "isupper") at /usr/netbsd/current/src/lib/libc/gen/isctype.c:73 #4 isupper (c=<optimized out>) at /usr/netbsd/current/src/lib/libc/gen/isctype.c:102 #5 0x0000000000fbed82 in ada_decode[abi:cxx11](char const*, bool, bool, bool) () at /usr/netbsd/current/src/external/gpl3/gdb/lib/libgdb/../../dist/gdb/ada-lang.c:1563 #6 0x000000000130e235 in ada_language::sniff_from_mangled_name () at /usr/netbsd/current/src/external/gpl3/gdb/lib/libgdb/../../dist/gdb/ada-lang.c:13531 #7 0x0000000000e045f9 in symbol_find_demangled_name () at /usr/netbsd/current/src/external/gpl3/gdb/lib/libgdb/../../dist/gdb/symtab.c:961 #8 0x0000000000e5d0f0 in operator() () at /usr/netbsd/current/src/external/gpl3/gdb/lib/libgdb/../../dist/gdb/mins--Type <RET> for more, q to quit, c to continue without paging--c yms.c:1494 #9 0x00000000012da6b1 in std::function<void ()>::operator()() const () at /usr/netbsd/current/build/THINKPAD/destdir.amd64/usr/include/g++/bits/std_function.h:591 #10 std::__invoke_impl<void, std::function<void ()>&>(std::__invoke_other, std::function<void ()>&) () at /usr/netbsd/current/build/THINKPAD/destdir.amd64/usr/include/g++/bits/invoke.h:61 #11 std::__invoke_r<void, std::function<void ()>&>(std::function<void ()>&) () at /usr/netbsd/current/build/THINKPAD/destdir.amd64/usr/include/g++/bits/invoke.h:111 #12 std::__future_base::_Task_state<std::function<void ()>, std::allocator<int>, void ()>::_M_run()::{lambda()#1}::operator()() const () at /usr/netbsd/current/build/THINKPAD/destdir.amd64/usr/include/g++/future:1489 #13 std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<void>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::function<void ()>, std::allocator<int>, void ()>::_M_run()::{lambda()#1}, void>::operator()() const () at /usr/netbsd/current/build/THINKPAD/destdir.amd64/usr/include/g++/future:1430 #14 std::__invoke_impl<std::unique_ptr<std::__future_base::_Result<void>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<void>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::function<void ()>, std::allocator<int>, void ()>::_M_run()::{lambda()#1}, void>&>(std::__invoke_other, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<void>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::function<void ()>, std::allocator<int>, void ()>::_M_run()::{lambda()#1}, void>&) () at /usr/netbsd/current/build/THINKPAD/destdir.amd64/usr/include/g++/bits/invoke.h:61 #15 std::__invoke_r<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<void>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::function<void ()>, std::allocator<int>, void ()>::_M_run()::{lambda()#1}, void>&>(std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<void>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::function<void ()>, std::allocator<int>, void ()>::_M_run()::{lambda()#1}, void>&) () at /usr/netbsd/current/build/THINKPAD/destdir.amd64/usr/include/g++/bits/invoke.h:116 #16 std::_Function_handler<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> (), std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<void>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::function<void ()>, std::allocator<int>, void ()>::_M_run()::{lambda()#1}, void> >::_M_invoke(std::_Any_data const&) () at /usr/netbsd/current/build/THINKPAD/destdir.amd64/usr/include/g++/bits/std_function.h:291 #17 0x00000000012da62f in std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>::operator()() const () at /usr/netbsd/current/build/THINKPAD/destdir.amd64/usr/include/g++/bits/std_function.h:591 #18 std::__future_base::_State_baseV2::_M_do_set(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*) () at /usr/netbsd/current/build/THINKPAD/destdir.amd64/usr/include/g++/future:587 #19 0x000074897c20d711 in pthread_once (once_control=0x748971c8b388, routine=0x74897c0a3bca <std::__once_proxy()>) at /usr/netbsd/current/src/lib/libpthread/pthread_once.c:66 #20 0x00000000012dab1f in __gthread_once () at /usr/netbsd/current/build/THINKPAD/destdir.amd64/usr/include/g++/bits/gthr-posix.h:703 #21 std::call_once<void (std::__future_base::_State_baseV2::*)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*>(std::once_flag&, void (std::__future_base::_State_baseV2::*&&)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*&&, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*&&, bool*&&) () at /usr/netbsd/current/build/THINKPAD/destdir.amd64/usr/include/g++/mutex:891 #22 0x00000000011bed99 in std::__future_base::_State_baseV2::_M_set_result(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>, bool) () at /usr/netbsd/current/build/THINKPAD/destdir.amd64/usr/include/g++/future:426 #23 std::__future_base::_Task_state<std::function<void ()>, std::allocator<int>, void ()>::_M_run() () at /usr/netbsd/current/build/THINKPAD/destdir.amd64/usr/include/g++/future:1492 #24 std::packaged_task<void ()>::operator()() () at /usr/netbsd/current/build/THINKPAD/destdir.amd64/usr/include/g++/future:1626 #25 gdb::thread_pool::thread_function () at /usr/netbsd/current/src/external/gpl3/gdb/lib/libgdbsupport/../../dist/gdbsupport/thread-pool.cc:245 #26 0x000074897c0a2d3b in std::execute_native_thread_routine (__p=0x74897b940ca0) at /usr/netbsd/current/src/external/gpl3/gcc/dist/libstdc++-v3/src/c++11/thread.cc:82 #27 0x000074897c2122e1 in pthread__create_tramp (cookie=0x74897b92a800) at /usr/netbsd/current/src/lib/libpthread/pthread.c:605 #28 0x000074897bbd16e0 in ?? () from /usr/lib/libc.so.12 #29 0x0000000000200000 in ?? () #30 0x0000000000000000 in ?? () (gdb) q A debugging session is active. Inferior 1 [process 28438] will be killed. Quit anyway? (y or n) y [ 34828.6641265] sorry, pid 22659 was killed: orphaned traced process thinkpad$ ------- thinkpad$ TERM=dumb /usr/pkg/bin/gdb --args /usr/pkg/bin/gdb --args gdb vlc GNU gdb (GDB) 10.1 Copyright (C) 2020 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 "x86_64--netbsd". 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"... Reading symbols from /usr/pkg/bin/gdb... (gdb) r Starting program: /usr/pkg/bin/gdb --args gdb vlc [New LWP 16310 of process 15916] [New LWP 13695 of process 15916] [New LWP 28626 of process 15916] [New LWP 20662 of process 15916] GNU gdb (GDB) 10.1 Copyright (C) 2020 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 "x86_64--netbsd". 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"... Reading symbols from gdb... Reading symbols from /usr/libdata/debug//usr/bin/gdb.debug... (gdb) r Starting program: /usr/bin/gdb vlc [New process 15916] [New process 20006] [New LWP 27361 of process 20006] [New LWP 6565 of process 20006] [New LWP 13159 of process 20006] GNU gdb (GDB) 15.1 Copyright (C) 2024 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 "x86_64--netbsd". 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"... Reading symbols from vlc... (gdb) r Starting program: /usr/pkg/bin/vlc [New process 20006] [New process 20006] VLC media player 3.0.21 Vetinari (revision 3.0.21-0-gdd8bfdbabe8) [New process 20006] ctype(3) isupper: invalid input: -61 Thread 4 "gdb worker" received signal SIGABRT, Aborted. [Switching to LWP 6565 of process 20006] 0x00007539008474da in _lwp_kill () from /usr/lib/libc.so.12 (gdb) bt full #0 0x00007539008474da in _lwp_kill () from /usr/lib/libc.so.12 No symbol table info available. #1 0x0000753900852914 in abort () at /usr/netbsd/current/src/lib/libc/stdlib/abort.c:74 mask = {__bits = {4294967263, 4294967295, 4294967295, 4294967295}} #2 0x0000753900842c13 in ctype_nasaldemon ( func=func@entry=0x75390086e718 <__func__.7> "isupper", c=<optimized out>) at /usr/netbsd/current/src/lib/libc/gen/isctype.c:65 ctype(3) isprint: invalid input: -127 Thread 1 "" received signal SIGABRT, Aborted. 0x00007a2a785f94da in _lwp_kill () from /usr/lib/libc.so.12 (gdb) bt #0 0x00007a2a785f94da in _lwp_kill () from /usr/lib/libc.so.12 #1 0x00007a2a78604914 in abort () at /usr/netbsd/current/src/lib/libc/stdlib/abort.c:74 #2 0x00007a2a785f4c13 in ctype_nasaldemon ( func=func@entry=0x7a2a78620760 <__func__.13> "isprint", c=<optimized out>) at /usr/netbsd/current/src/lib/libc/gen/isctype.c:65 #3 0x00007a2a785f4f05 in ctype_check (c=<optimized out>, func=0x7a2a78620760 <__func__.13> "isprint") at /usr/netbsd/current/src/lib/libc/gen/isctype.c:73 #4 isprint (c=<optimized out>) at /usr/netbsd/current/src/lib/libc/gen/isctype.c:99 #5 0x0000000000b69402 in wchar_printable(char) () #6 0x0000000000b6973d in print_wchar(int, unsigned char const*, int, int, bfd_endian, obstack*, int, int*) () #7 0x0000000000b6daae in generic_printstr(ui_file*, type*, unsigned char const*, unsigned int, char const*, int, int, int, value_print_options const*) () #8 0x0000000000830f85 in c_printstr(ui_file*, type*, unsigned char const*, unsigned int, char const*, int, value_print_options const*) () #9 0x0000000000835d51 in c_value_print_inner(value*, ui_file*, int, value_print_options const*) () #10 0x0000000000b6a23b in common_val_print(value*, ui_file*, int, value_print_options const*, language_defn const*) () #11 0x0000000000a29837 in print_variable_and_value(char const*, symbol*, frame_info*, ui_file*, int) () #12 0x0000000000ae531b in do_print_variable_and_value(char const*, symbol*, void*) () #13 0x0000000000aea358 in iterate_over_block_local_vars(block const*, void (*)(char const*, symbol*, void*), void*) () #14 0x0000000000aea579 in print_frame_local_vars(frame_info*, bool, char const*, char const*, int, ui_file*) () #15 0x0000000000aea9d9 in backtrace_command(char const*, int) () #16 0x0000000000842393 in cmd_func(cmd_list_element*, char const*, int) () #17 0x0000000000b2e995 in execute_command(char const*, int) () #18 0x00000000008eaeeb in command_handler(char const*) () #19 0x00000000008eb22a in command_line_handler(std::unique_ptr<char, gdb::xfree_deleter<char> >&&) () #20 0x00000000008eb71d in gdb_rl_callback_handler(char*) () #21 0x0000000000ba3daa in rl_callback_read_char () #22 0x00000000008eb8c5 in gdb_rl_callback_read_char_wrapper_noexcept() () #23 0x00000000008ebb31 in gdb_rl_callback_read_char_wrapper(void*) () #24 0x00000000008ea383 in stdin_event_handler(int, void*) () --Type <RET> for more, q to quit, c to continue without paging--c #25 0x0000000000fe28d9 in gdb_wait_for_event(int) [clone .part.0] () #26 0x0000000000fe2be5 in gdb_do_one_event() () #27 0x000000000099a9c0 in captured_command_loop() () #28 0x000000000099cdc6 in gdb_main(captured_main_args*) () #29 0x0000000001037d32 in main () (gdb) q A debugging session is active. Inferior 1 [process 15916] will be killed. Quit anyway? (y or n) y [ 35533.8424050] sorry, pid 20006 was killed: orphaned traced process thinkpad$ [ 35533.8724048] sorry, pid 11845 was killed: orphaned traced process thinkpad$