Cannot find thread-local storage for process 92798, shared library /lib/x86_64-linux-gnu/libc.so.6:
Cannot find thread-local variables on this target
int main() {
int * p = new int(4);
*p = 7;
return 0;
}
After debugging and searching, it seems for the program above, the ptmalloc will not have "thread-local variables tcache
".
Previously the gdb does not throw exception but now it throws exception. We might need to catch the exception.
Similar issue in cloudburst/libheap#24.
(gdb) bt
#0 0x00007ffff76aed1d in __cxa_throw () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#1 0x000055555573c914 in throw_it(return_reason, errors, const char *, typedef __va_list_tag __va_list_tag *) (reason=RETURN_ERROR,
error=GENERIC_ERROR, fmt=0x555555c787a8 "Cannot find thread-local storage for %s, shared library %s:\n%s", ap=0x7fffffffce30)
at /workspaces/core_analyzer/build/gdb-9.2/build/../gdb/gdbsupport/common-exceptions.c:200
#2 0x000055555573c99d in throw_verror (error=GENERIC_ERROR, fmt=0x555555c787a8 "Cannot find thread-local storage for %s, shared library %s:\n%s",
ap=0x7fffffffce30) at /workspaces/core_analyzer/build/gdb-9.2/build/../gdb/gdbsupport/common-exceptions.c:208
#3 0x0000555555a00d9a in verror (string=0x555555c787a8 "Cannot find thread-local storage for %s, shared library %s:\n%s", args=0x7fffffffce30)
at /workspaces/core_analyzer/build/gdb-9.2/build/../gdb/utils.c:170
#4 0x0000555555741780 in error (fmt=0x555555c787a8 "Cannot find thread-local storage for %s, shared library %s:\n%s")
at /workspaces/core_analyzer/build/gdb-9.2/build/../gdb/gdbsupport/errors.c:43
#5 0x00005555559b0d50 in target_translate_tls_address (objfile=0x555556666b30, offset=64)
at /workspaces/core_analyzer/build/gdb-9.2/build/../gdb/target.c:755
#6 0x0000555555686632 in dwarf_evaluate_loc_desc::get_tls_address (this=0x7fffffffd270, offset=64)
at /workspaces/core_analyzer/build/gdb-9.2/build/../gdb/dwarf2loc.c:608
#7 0x0000555555679fca in dwarf_expr_context::execute_stack_op (this=0x7fffffffd270, op_ptr=0x7ffff60ab0a7 "\006\bNL", op_end=0x7ffff60ab0a7 "\006\bNL")
at /workspaces/core_analyzer/build/gdb-9.2/build/../gdb/dwarf2expr.c:1177
#8 0x0000555555677d2e in dwarf_expr_context::eval (this=0x7fffffffd270, addr=0x7ffff60ab09d "\016@", len=10)
at /workspaces/core_analyzer/build/gdb-9.2/build/../gdb/dwarf2expr.c:302
#9 0x0000555555680f88 in dwarf2_evaluate_loc_desc_full (type=0x555556c81bc0, frame=0x0, data=0x7ffff60ab09d "\016@", size=10, per_cu=0x5555568c12e0,
subobj_type=0x555556c81bc0, subobj_byte_offset=0) at /workspaces/core_analyzer/build/gdb-9.2/build/../gdb/dwarf2loc.c:2166
#10 0x000055555568175d in dwarf2_evaluate_loc_desc (type=0x555556c81bc0, frame=0x0, data=0x7ffff60ab09d "\016@", size=10, per_cu=0x5555568c12e0)
at /workspaces/core_analyzer/build/gdb-9.2/build/../gdb/dwarf2loc.c:2348
#11 0x0000555555683d3f in locexpr_read_variable (symbol=0x555556c81b70, frame=0x0)
at /workspaces/core_analyzer/build/gdb-9.2/build/../gdb/dwarf2loc.c:3524
#12 0x0000555555711a9e in default_read_var_value (var=0x555556c81b70, var_block=0x0, frame=0x0)
at /workspaces/core_analyzer/build/gdb-9.2/build/../gdb/findvar.c:610
#13 0x00005555557125f9 in read_var_value (var=0x555556c81b70, var_block=0x0, frame=0x0)
at /workspaces/core_analyzer/build/gdb-9.2/build/../gdb/findvar.c:815
#14 0x0000555555a108e3 in value_of_variable (var=0x555556c81b70, b=0x0) at /workspaces/core_analyzer/build/gdb-9.2/build/../gdb/valops.c:1293
#15 0x000055555577d275 in thread_tcache (info=0x5555563467a0, data=0x0) at /workspaces/core_analyzer/build/gdb-9.2/build/../gdb/heap_ptmalloc.c:919
#16 0x00005555559cdd7c in iterate_over_threads (callback=0x55555577d1cc <thread_tcache(thread_info*, void*)>, data=0x0)
at /workspaces/core_analyzer/build/gdb-9.2/build/../gdb/thread.c:572
#17 0x000055555577d504 in build_tcache () at /workspaces/core_analyzer/build/gdb-9.2/build/../gdb/heap_ptmalloc.c:969
#18 0x000055555577f4f1 in build_heaps_internal (main_arena_vaddr=140737348127808, mparams_vaddr=140737348125312)
at /workspaces/core_analyzer/build/gdb-9.2/build/../gdb/heap_ptmalloc.c:1483
#19 0x000055555577f7c6 in build_heaps () at /workspaces/core_analyzer/build/gdb-9.2/build/../gdb/heap_ptmalloc.c:1574
#20 0x000055555577b94b in init_heap () at /workspaces/core_analyzer/build/gdb-9.2/build/../gdb/heap_ptmalloc.c:221
---Type <return> to continue, or q <return> to quit---
#21 0x00005555557227c6 in update_memory_segments_and_heaps () at /workspaces/core_analyzer/build/gdb-9.2/build/../gdb/gdb_dep.c:428
#22 0x0000555555780e69 in heap_command (args=0x0, from_tty=1) at /workspaces/core_analyzer/build/gdb-9.2/build/../gdb/heapcmd.c:21
#23 0x00005555555bf9a4 in do_const_cfunc (c=0x5555562a7fa0, args=0x0, from_tty=1)
at /workspaces/core_analyzer/build/gdb-9.2/build/../gdb/cli/cli-decode.c:107
#24 0x00005555555c2ec3 in cmd_func (cmd=0x5555562a7fa0, args=0x0, from_tty=1)
at /workspaces/core_analyzer/build/gdb-9.2/build/../gdb/cli/cli-decode.c:1952
#25 0x00005555559d7c50 in execute_command (p=0x5555562509c4 "", from_tty=1) at /workspaces/core_analyzer/build/gdb-9.2/build/../gdb/top.c:651
#26 0x00005555556fb92a in command_handler (command=0x5555562509c0 "heap") at /workspaces/core_analyzer/build/gdb-9.2/build/../gdb/event-top.c:587
#27 0x00005555556fbda4 in command_line_handler (rl=...) at /workspaces/core_analyzer/build/gdb-9.2/build/../gdb/event-top.c:772
#28 0x00005555556fb08f in gdb_rl_callback_handler (rl=0x5555564f4930 "heap") at /workspaces/core_analyzer/build/gdb-9.2/build/../gdb/event-top.c:218
#29 0x0000555555a59dd2 in rl_callback_read_char () at /workspaces/core_analyzer/build/gdb-9.2/build/../readline/readline/callback.c:281
#30 0x00005555556faeb7 in gdb_rl_callback_read_char_wrapper_noexcept () at /workspaces/core_analyzer/build/gdb-9.2/build/../gdb/event-top.c:176
#31 0x00005555556faf61 in gdb_rl_callback_read_char_wrapper (client_data=0x555556250730)
at /workspaces/core_analyzer/build/gdb-9.2/build/../gdb/event-top.c:193
#32 0x00005555556fb7bc in stdin_event_handler (error=0, client_data=0x555556250730)
at /workspaces/core_analyzer/build/gdb-9.2/build/../gdb/event-top.c:515
#33 0x00005555556f93c8 in handle_file_event (file_ptr=0x555556355d60, ready_mask=1)
at /workspaces/core_analyzer/build/gdb-9.2/build/../gdb/event-loop.c:731
#34 0x00005555556f9991 in gdb_wait_for_event (block=1) at /workspaces/core_analyzer/build/gdb-9.2/build/../gdb/event-loop.c:857
#35 0x00005555556f8797 in gdb_do_one_event () at /workspaces/core_analyzer/build/gdb-9.2/build/../gdb/event-loop.c:346
#36 0x00005555556f87c1 in start_event_loop () at /workspaces/core_analyzer/build/gdb-9.2/build/../gdb/event-loop.c:370
#37 0x000055555582a6e7 in captured_command_loop () at /workspaces/core_analyzer/build/gdb-9.2/build/../gdb/main.c:359
#38 0x000055555582bf6c in captured_main (data=0x7fffffffe010) at /workspaces/core_analyzer/build/gdb-9.2/build/../gdb/main.c:1202
#39 0x000055555582bfd2 in gdb_main (args=0x7fffffffe010) at /workspaces/core_analyzer/build/gdb-9.2/build/../gdb/main.c:1217
#40 0x00005555554c8cb3 in main (argc=1, argv=0x7fffffffe118) at /workspaces/core_analyzer/build/gdb-9.2/build/../gdb/gdb.c:32