"Cannot find thread-local storage for Thread" and crash with extended-remote target

Dmitry Antipov <[email protected]>
Newsgroups gmane.comp.gdb.devel
Message-ID <[email protected]>
When debugging Firefox with 'extended-remote' target, gdbserver complains on 'thread apply all bt full':

error reading variable: Cannot find thread-local storage for Thread 2791.2882,
shared library /home/dantipov/tmp/firefox/obj-x86_64-pc-linux-gnu/dist/bin/libxul.so

Next, host gdb unconditionally crashes with:

Program received signal SIGSEGV, Segmentation fault.
0x00000000007a3505 in value_entirely_covered_by_range_vector (value=0x0, ranges=0x90) at ../../gdb/value.c:398
398       if (value->lazy)
(gdb) bt
#0  0x00000000007a3505 in value_entirely_covered_by_range_vector (value=0x0, ranges=0x90) at ../../gdb/value.c:398
#1  0x00000000007a35f5 in value_entirely_optimized_out (value=0x0) at ../../gdb/value.c:423
#2  0x00000000005c4de5 in cp_print_static_field (type=0x2322c090, val=0x0, stream=0x27ac5c0, recurse=5, options=0x7fff9632e500)
     at ../../gdb/cp-valprint.c:634
#3  0x00000000005c3d1e in cp_print_value_fields (type=0x235e2580, real_type=0x235e2580, offset=0, address=139827086354440, stream=0x27ac5c0,
     recurse=4, val=0x858a8d0, options=0x7fff9632e500, dont_print_vb=0x0, dont_print_statmem=0) at ../../gdb/cp-valprint.c:332
#4  0x00000000005c4342 in cp_print_value_fields_rtti (type=0x235e2580, valaddr=0x7b08390 "", offset=0, address=139827086354440,
     stream=0x27ac5c0, recurse=4, val=0x858a8d0, options=0x7fff9632e500, dont_print_vb=0x0, dont_print_statmem=0) at ../../gdb/cp-valprint.c:453
#5  0x00000000005a2834 in c_val_print_struct (type=0x235e2580, valaddr=0x7b08390 "", embedded_offset=0, address=139827086354440,
     stream=0x27ac5c0, recurse=4, original_value=0x858a8d0, options=0x7fff9632e500) at ../../gdb/c-valprint.c:408
#6  0x00000000005a2c4c in c_val_print (type=0x235e2580, embedded_offset=0, address=139827086354440, stream=0x27ac5c0, recurse=4,
     original_value=0x858a8d0, options=0x7fff9632e500) at ../../gdb/c-valprint.c:529
#7  0x000000000079df25 in val_print (type=0x235e2580, embedded_offset=0, address=139827086354440, stream=0x27ac5c0, recurse=4, val=0x858a8d0,
     options=0x7fff9632e610, language=0x9836e0 <cplus_language_defn>) at ../../gdb/valprint.c:1097
#8  0x000000000079e27b in common_val_print (val=0x858a8d0, stream=0x27ac5c0, recurse=4, options=0x7fff9632e610,
     language=0x9836e0 <cplus_language_defn>) at ../../gdb/valprint.c:1186
#9  0x00000000006eefd9 in print_variable_and_value (name=0x7f0499ec9f85 "raiiObject13290", var=0x24e80420, frame=0xa9c38e0, stream=0x27ac5c0,
     indent=4) at ../../gdb/printcmd.c:2192
#10 0x0000000000738892 in do_print_variable_and_value (print_name=0x7f0499ec9f85 "raiiObject13290", sym=0x24e80420, cb_data=0x7fff9632e800)
     at ../../gdb/stack.c:2042
#11 0x00000000007387a3 in iterate_over_block_locals (b=0x24e86420, cb=0x73881c <do_print_variable_and_value(char const*, symbol*, void*)>,
     cb_data=0x7fff9632e800) at ../../gdb/stack.c:1933
#12 0x00000000007387fd in iterate_over_block_local_vars (block=0x24e86420,
     cb=0x73881c <do_print_variable_and_value(char const*, symbol*, void*)>, cb_data=0x7fff9632e800) at ../../gdb/stack.c:2003
#13 0x00000000007389ef in print_frame_local_vars (frame=0xa9c38e0, num_tabs=1, stream=0x27ac5c0) at ../../gdb/stack.c:2090
#14 0x0000000000738306 in backtrace_command_1 (count_exp=0x0, show_locals=1, no_filters=0, from_tty=1) at ../../gdb/stack.c:1812
#15 0x00000000007386b1 in backtrace_command (arg=0x0, from_tty=1) at ../../gdb/stack.c:1904
#16 0x00000000004a5eac in do_cfunc (c=0x27867e0, args=0x9b3e664 "full", from_tty=1) at ../../gdb/cli/cli-decode.c:106
#17 0x00000000004a8f44 in cmd_func (cmd=0x27867e0, args=0x9b3e664 "full", from_tty=1) at ../../gdb/cli/cli-decode.c:1952
#18 0x000000000078008a in execute_command (p=0x9b3e667 "l", from_tty=1) at ../../gdb/top.c:608
#19 0x000000000077b4aa in thread_apply_all_command (cmd=0x9b3e661 "bt full", from_tty=1) at ../../gdb/thread.c:1712
#20 0x00000000004a5eac in do_cfunc (c=0x278d270, args=0x9b3e661 "bt full", from_tty=1) at ../../gdb/cli/cli-decode.c:106
#21 0x00000000004a8f44 in cmd_func (cmd=0x278d270, args=0x9b3e661 "bt full", from_tty=1) at ../../gdb/cli/cli-decode.c:1952
#22 0x000000000078008a in execute_command (p=0x9b3e667 "l", from_tty=1) at ../../gdb/top.c:608
#23 0x0000000000640cb2 in command_handler (command=0x9b3e650 "thread apply all bt full") at ../../gdb/event-top.c:583
#24 0x0000000000641077 in command_line_handler (rl=0x6ec6340 "thread apply all bt full") at ../../gdb/event-top.c:773
#25 0x000000000064051a in gdb_rl_callback_handler (rl=0x6ec6340 "thread apply all bt full") at ../../gdb/event-top.c:213
#26 0x00000000007d98c5 in rl_callback_read_char () at ../../readline/callback.c:220
#27 0x000000000064044c in gdb_rl_callback_read_char_wrapper_noexcept () at ../../gdb/event-top.c:175
#28 0x00000000006404a8 in gdb_rl_callback_read_char_wrapper (client_data=0x2692bb0) at ../../gdb/event-top.c:192
#29 0x0000000000640b55 in stdin_event_handler (error=0, client_data=0x2692bb0) at ../../gdb/event-top.c:511
#30 0x000000000063f016 in handle_file_event (file_ptr=0x27ac600, ready_mask=1) at ../../gdb/event-loop.c:733
#31 0x000000000063f5a1 in gdb_wait_for_event (block=1) at ../../gdb/event-loop.c:859
#32 0x000000000063e4b6 in gdb_do_one_event () at ../../gdb/event-loop.c:347
#33 0x000000000063e4ee in start_event_loop () at ../../gdb/event-loop.c:371
#34 0x00000000006b9aa1 in captured_command_loop () at ../../gdb/main.c:324
#35 0x00000000006badbc in captured_main (data=0x7fff9632f020) at ../../gdb/main.c:1147
#36 0x00000000006bae82 in gdb_main (args=0x7fff9632f020) at ../../gdb/main.c:1163
#37 0x000000000040a75e in main (argc=4, argv=0x7fff9632f128) at ../../gdb/gdb.c:32

Local (attached with 'gdb -p') debugging of the same binaries works just fine.

Any ideas to track this down?

Dmitry
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.