Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C2096C6FD1D for ; Wed, 22 Mar 2023 01:39:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229810AbjCVBi7 (ORCPT ); Tue, 21 Mar 2023 21:38:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37210 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229639AbjCVBi6 (ORCPT ); Tue, 21 Mar 2023 21:38:58 -0400 Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D4E51ACFD for ; Tue, 21 Mar 2023 18:38:45 -0700 (PDT) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id CB0535C010F; Tue, 21 Mar 2023 21:38:33 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Tue, 21 Mar 2023 21:38:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; t=1679449113; x=1679535513; bh=28iTrOxGZLknK 21rfhrGQLQr9y5rOLCQcw5qVzDwZxg=; b=gLP+9x/OUgG0Dr6nYBB6QAccgTPiX dn/awhavym6rxTMLUpFkNHgjpnr2/zqWt7/qYIYZ0T3XGnuGWWBMd+3DEZT5ibb2 tx3C3e7lCBXwSq5nshk2GLyVrNT7wleCFw3M2M0p1beM1AhCTT0xPfQnp/E3GWoJ B77VG74UBBTNXfap6IGS5tcmVX90LADlDoaMM0VJvZMklqF5YbNxc4af3F8AXFww i6InD3HlwfcJKL2fIEniPbya3bvzyjiUi9nScXuT8/zurco2K+SecsfjUrax9tDz 8faIXYcgIdxWIlIqPMIvVMZ62po1npaX2qHIEZ/95pBr+/vrQ7MIlVkoA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrvdeguddgfeelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpeffhffvufgjkfhfgggtsehttdertd dttddvnecuhfhrohhmpefhihhnnhcuvfhhrghinhcuoehfthhhrghinheslhhinhhugidq mheikehkrdhorhhgqeenucggtffrrghtthgvrhhnpeeiveejgfekueelveeulefggeefhf fhffefkeetvdeiueefjeeuieehjeetvdelfeenucffohhmrghinhepghhnuhdrohhrghdp uggvsghirghnrdhorhhgnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrg hilhhfrhhomhepfhhthhgrihhnsehlihhnuhigqdhmieekkhdrohhrgh X-ME-Proxy: Feedback-ID: i58a146ae:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 21 Mar 2023 21:38:30 -0400 (EDT) Date: Wed, 22 Mar 2023 12:41:24 +1100 (AEDT) From: Finn Thain To: debian-68k@lists.debian.org, linux-m68k@lists.linux-m68k.org Subject: Re: gdb failure: "core file format not supported" In-Reply-To: Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-m68k@vger.kernel.org [Cc: linux-m68k] On Fri, 10 Mar 2023, I wrote: > root@panmac:~# gdb --core core.0 > GNU gdb (Debian 13.1-2) 13.1 > Copyright (C) 2023 Free Software Foundation, Inc. > License GPLv3+: GNU GPL version 3 or later > > 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 "m68k-linux-gnu". > Type "show configuration" for configuration details. > For bug reporting instructions, please see: > . > Find the GDB manual and other documentation resources online at: > . > > For help, type "help". > Type "apropos word" to search for commands related to "word". > "/root/core.0": Core file format not supported > (gdb) quit I was able to run gdb under gdb to get a few hints. Here's the error message: if (!m_core_gdbarch || !gdbarch_iterate_over_regset_sections_p (m_core_gdbarch)) error (_("\"%s\": Core file format not supported"), bfd_get_filename (core_bfd)); And the reason for the message: bool gdbarch_iterate_over_regset_sections_p (struct gdbarch *gdbarch) { gdb_assert (gdbarch != NULL); return gdbarch->iterate_over_regset_sections != NULL; } So gdbarch->iterate_over_regset_sections == NULL somehow: (gdb) print *m_core_gdbarch $3 = {initialized_p = true, obstack = { = {chunk_size = 4064, chunk = 0x8092bf80, object_base = 0x8092bfb8 "", next_free = 0x8092bfb8 "", chunk_limit = 0x8092cf60 "", temp = { i = 853591194, p = 0x32e0c49a}, alignment_mask = 1, chunkfun = { plain = 0x800791d8 , extra = 0x800791d8 }, freefun = { plain = 0x8007b5d2 (void*)>, extra = 0x8007b5d2 (void*)>}, extra_arg = 0x3300c49a, use_extra_arg = 0, maybe_empty_object = 0, alloc_failed = 0}, }, registry_fields = { m_fields = std::vector of length 23, capacity 23 = {0x0, 0x0, 0x0, 0x0, 0x8090b608, 0x8090b5f8, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}}, bfd_arch_info = 0x80795aae , byte_order = BFD_ENDIAN_BIG, byte_order_for_code = BFD_ENDIAN_BIG, osabi = GDB_OSABI_SVR4, target_desc = 0x0, tdep = 0x808e7fb0, dump_tdep = 0x8028c242 , nr_data = 0, data = 0x0, short_bit = 16, int_bit = 32, long_bit = 32, long_long_bit = 64, bfloat16_bit = 16, bfloat16_format = 0x807b545a , half_bit = 16, half_format = 0x807b54ba , float_bit = 32, float_format = 0x807b54b2 , double_bit = 64, double_format = 0x807b54aa , long_double_bit = 96, long_double_format = 0x807b548a , wchar_bit = 32, wchar_signed = 1, floatformat_for_type = 0x8007d812 , ptr_bit = 32, addr_bit = 32, dwarf2_addr_size = 4, char_signed = 1, read_pc = 0x0, write_pc = 0x0, virtual_frame_pointer = 0x8007f5c2 , pseudo_register_read = 0x0, pseudo_register_read_value = 0x0, pseudo_register_write = 0x0, num_regs = 29, num_pseudo_regs = 0, ax_pseudo_register_collect = 0x0, ax_pseudo_register_push_stack = 0x0, report_signal_info = 0x0, sp_regnum = 15, pc_regnum = 17, ps_regnum = 16, fp0_regnum = 18, stab_reg_to_regnum = 0x8007b4ba , ecoff_reg_to_regnum = 0x8007b4ba , sdb_reg_to_regnum = 0x8007b4ba , dwarf2_reg_to_regnum = 0x8028c298 , register_name = 0x8028c248 , register_type = 0x8028ca62 , dummy_id = 0x8028e526 , deprecated_fp_regnum = -1, push_dummy_call = 0x8028c838 , call_dummy_location = AT_ENTRY_POINT, push_dummy_code = 0x0, code_of_frame_writable = 0x8007b4a2 , print_registers_info = 0x8022edfc , print_float_info = 0x8022f840 , print_vector_info = 0x0, register_sim_regno = 0x8007f228 , cannot_fetch_register = 0x8007b4dc , cannot_store_register = 0x8007b4dc , get_longjmp_target = 0x0, believe_pcc_promotion = 1, convert_register_p = 0x8028cd58 , register_to_value = 0x8028e926 , value_to_register = 0x8028e700 , value_from_register = 0x801f5370 , pointer_to_address = 0x801f5092 , address_to_pointer = 0x801f50ee , integer_to_address = 0x0, return_value = 0x8028c04a , get_return_buf_addr = 0x8007b50e , return_in_first_hidden_param_p = 0x8028bc3c , skip_prologue = 0x8028c7e2 , skip_main_prologue = 0x0, skip_entrypoint = 0x0, inner_than = 0x8007b984 , breakpoint_from_pc = 0x80081c1c , breakpoint_kind_from_pc = 0x8028bc56 ::kind_from_pc(gdbarch*, CORE_ADDR*)>, sw_breakpoint_from_kind = 0x8028bc5a ::bp_from_kind(gdbarch*, int, int*)>, breakpoint_kind_from_current_state = 0x80081b28 , adjust_breakpoint_address = 0x0, memory_insert_breakpoint = 0x802a5ba4 , memory_remove_breakpoint = 0x802a5c34 , decr_pc_after_break = 0, deprecated_function_start_offset = 0, remote_register_number = 0x8007b770 , fetch_tls_load_module_address = 0x0, get_thread_local_address = 0x0, frame_args_skip = 8, unwind_pc = 0x8028e442 , unwind_sp = 0x801fa23c , frame_num_args = 0x0, frame_align = 0x8028bc30 , stabs_argument_has_addr = 0x8007b4e4 , frame_red_zone_size = 0, convert_from_func_ptr_addr = 0x8007b4b0 , addr_bits_remove = 0x8007b4a6 , remove_non_address_bits = 0x8007b756 , memtag_to_string = 0x8007b514 , tagged_address_p = 0x8007b47c , memtag_matches_p = 0x8007b480 , set_memtags = 0x8007b484 > > const&, memtag_type)>, get_memtag = 0x8007b488 , memtag_granule_size = 0, software_single_step = 0x0, single_step_through_delay = 0x0, print_insn = 0x8007b696 , skip_trampoline_code = 0x8007b48e , so_ops = 0x80791610 , skip_solib_resolver = 0x8007b494 , in_solib_return_trampoline = 0x8007b49a , in_indirect_branch_thunk = 0x8007b502 , stack_frame_destroyed_p = 0x8007b49e , elf_make_msymbol_special = 0x0, coff_make_msymbol_special = 0x8007b4c0 , make_symbol_special = 0x8007b4c2 , adjust_dwarf2_addr = 0x8007b4c4 , adjust_dwarf2_line = 0x8007b4ce , cannot_step_breakpoint = 0, have_nonsteppable_watchpoint = 0, address_class_type_flags = 0x0, address_class_type_flags_to_name = 0x0, execute_dwarf_cfa_vendor_op = 0x8007b4d8 , address_class_name_to_type_flags = 0x0, register_reggroup_p = 0x80351864 , fetch_pointer_argument = 0x0, iterate_over_regset_sections = 0x0, make_corefile_notes = 0x0, find_memory_regions = 0x0, create_memtag_section = 0x0, fill_memtag_section = 0x0, decode_memtag_section = 0x0, core_xfer_shared_libraries = 0x0, core_xfer_shared_libraries_aix = 0x0, core_pid_to_str = 0x0, core_thread_name = 0x0, core_xfer_siginfo = 0x0, gcore_bfd_target = 0x0, vtable_function_descriptors = 0, vbit_in_delta = 0, skip_permanent_breakpoint = 0x80081932 , max_insn_length = 0, displaced_step_copy_insn = 0x0, displaced_step_hw_singlestep = 0x80083572 , displaced_step_fixup = 0x0, displaced_step_prepare = 0x0, displaced_step_finish = 0x0, displaced_step_copy_insn_closure_by_addr = 0x0, displaced_step_restore_all_in_ptid = 0x0, relocate_instruction = 0x0, overlay_update = 0x0, core_read_description = 0x0, sofun_address_maybe_missing = 0, process_record = 0x0, process_record_signal = 0x0, gdb_signal_from_target = 0x0, gdb_signal_to_target = 0x0, get_siginfo_type = 0x0, record_special_symbol = 0x0, get_syscall_number = 0x0, xml_syscall_file = 0x0, syscalls_info = 0x0, stap_integer_prefixes = 0x0, stap_integer_suffixes = 0x0, stap_register_prefixes = 0x0, stap_register_suffixes = 0x0, stap_register_indirection_prefixes = 0x0, stap_register_indirection_suffixes = 0x0, stap_gdb_register_prefix = 0x0, stap_gdb_register_suffix = 0x0, stap_is_single_operand = 0x0, stap_parse_special_token = 0x0, stap_adjust_register = 0x0, dtrace_parse_probe_argument = 0x0, dtrace_probe_is_enabled = 0x0, dtrace_enable_probe = 0x0, dtrace_disable_probe = 0x0, has_global_solist = 0, has_global_breakpoints = 0, has_shared_address_space = 0x8007b4e8 , fast_tracepoint_valid_at = 0x8007b4ec , std::allocator >*)>, guess_tracepoint_registers = 0x8007eb92 , auto_charset = 0x800f3e5a , auto_wide_charset = 0x800f3e74 , solib_symbols_extension = 0x0, has_dos_based_file_system = 0, gen_return_address = 0x8007b534 , info_proc = 0x0, core_info_proc = 0x0, iterate_over_objfiles_in_search_order = 0x802d77dc , objfile*)>, ravenscar_ops = 0x0, insn_is_call = 0x8007b760 , insn_is_ret = 0x8007b764 , insn_is_jump = 0x8007b768 , program_breakpoint_here_p = 0x800819a2 , auxv_parse = 0x0, print_auxv_entry = 0x80096fda , vsyscall_range = 0x8007b76c , infcall_mmap = 0x8007b554 , infcall_munmap = 0x8007b500 , gcc_target_options = 0x8007dbbe , gnu_triplet_regexp = 0x8007ce2e , addressable_memory_unit_size = 0x8007ce42 , disassembler_options_implicit = 0x0, disassembler_options = 0x0, valid_disassembler_options = 0x0, type_align = 0x8007b506 , get_pc_address_flags = 0x8007b776 , read_core_file_mappings = 0x8007b50c , gdb::function_view)>} (gdb) (gdb) But it should get initialized in m68k_linux_init_abi()... https://sources.debian.org/src/gdb/13.1-2/gdb/m68k-linux-tdep.c/?hl=385#L385 set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target); /* Core file support. */ set_gdbarch_iterate_over_regset_sections (gdbarch, m68k_linux_iterate_over_regset_sections); Yet somehow iterate_over_regset_sections ends up NULL. I could not see why that happened so I built the current upstream snapshot (at the time), gdb-14.0.50.20230316. That took a few attempts and a couple of days of building, but it has the same problem: # /opt/gdb-14.0.50.20230316/bin/gdb GNU gdb (GDB) 14.0.50.20230316-git Copyright (C) 2023 Free Software Foundation, Inc. ... (gdb) core ~/core.0 "/root/core.0": Core file format not supported (gdb) I guess the next step will be a formal bug report.