Re: Index files are not used in the session where they were created

Dmitry Neverov via Gdb <[email protected]>
Newsgroups gmane.comp.gdb.devel
Message-ID <CAEY59_L6agrdhz6-0d-Ur+Tb3RknAZDoZTa9Li5J3KgSm5009A@mail.gmail.com>
I think I found why index files are not used in the debug session
where they are created. Objfile.qf is initialized at

  dwarf2_initialize_objfile read.c:5396
  elf_symfile_read_dwarf2 elfread.c:1199
  elf_symfile_read elfread.c:1343
  read_symbols symfile.c:773
  syms_from_objfile_1 symfile.c:968
  syms_from_objfile symfile.c:985
  symbol_file_add_with_addrs symfile.c:1088
  symbol_file_add_from_bfd symfile.c:1168
  symbol_file_add symfile.c:1181
  symbol_file_add_main_1 symfile.c:1205
  symbol_file_command symfile.c:1653
  file_command exec.c:554
  do_simple_func cli-decode.c:95
  cmd_func cli-decode.c:2543
  execute_command top.c:690
  execute_control_command_1 cli-script.c:537
  execute_control_command cli-script.c:709
  execute_control_commands cli-script.c:410
  execute_user_command cli-script.c:460
  execute_command top.c:664
  command_handler event-top.c:616
  command_line_handler event-top.c:852
  tui_command_line_handler tui-interp.c:104
  gdb_rl_callback_handler event-top.c:246
  rl_callback_read_char callback.c:290
  gdb_rl_callback_read_char_wrapper_noexcept event-top.c:188
  gdb_rl_callback_read_char_wrapper event-top.c:221
  stdin_event_handler event-top.c:541
  handle_file_event event-loop.cc:573
  gdb_wait_for_event event-loop.cc:694
  gdb_do_one_event event-loop.cc:264
  start_event_loop main.c:411
  captured_command_loop main.c:471
  captured_main main.c:1330
  gdb_main main.c:1345
  main gdb.c:32

Since no gdb-index is created yet, qf is updated like this:

objfile->qf.push_front (make_cooked_index_funcs ());

After that the gdb-index is created at

  dwarf2_build_psymtabs read.c:5437
  cooked_index_functions::read_partial_symbols read.c:18601
  objfile::require_partial_symbols symfile-debug.c:582
  read_symbols symfile.c:795
  syms_from_objfile_1 symfile.c:968
  syms_from_objfile symfile.c:985
  symbol_file_add_with_addrs symfile.c:1088
  symbol_file_add_from_bfd symfile.c:1168
  symbol_file_add symfile.c:1181
  symbol_file_add_main_1 symfile.c:1205
  symbol_file_command symfile.c:1653
  file_command exec.c:554
  do_simple_func cli-decode.c:95
  cmd_func cli-decode.c:2543
  execute_command top.c:690
  execute_control_command_1 cli-script.c:537
  execute_control_command cli-script.c:709
  execute_control_commands cli-script.c:410
  execute_user_command cli-script.c:460
  execute_command top.c:664
  command_handler event-top.c:616
  command_line_handler event-top.c:852
  tui_command_line_handler tui-interp.c:104
  gdb_rl_callback_handler event-top.c:246
  rl_callback_read_char callback.c:290
  gdb_rl_callback_read_char_wrapper_noexcept event-top.c:188
  gdb_rl_callback_read_char_wrapper event-top.c:221
  stdin_event_handler event-top.c:541
  handle_file_event event-loop.cc:573
  gdb_wait_for_event event-loop.cc:694
  gdb_do_one_event event-loop.cc:264
  start_event_loop main.c:411
  captured_command_loop main.c:471
  captured_main main.c:1330
  gdb_main main.c:1345
  main gdb.c:32

but objfile.qf is not updated and the gdb-index is not used in
this debug session.

Is it an expected behavior and gdb indexes should be created
before the debug session to be used? Or maybe there is a way to
make gdb to use them?

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.