public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "vries at gcc dot gnu.org" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug gdb/27891] maintenance selftest fail when an executable is loaded
Date: Mon, 13 Sep 2021 10:32:12 +0000	[thread overview]
Message-ID: <bug-27891-4717-E1J8VE6AcH@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-27891-4717@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=27891

Tom de Vries <vries at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |alahay01 at gcc dot gnu.org,
                   |                            |luis.machado at linaro dot org,
                   |                            |vries at gcc dot gnu.org

--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Andrew Burgess from comment #0)
>  Self test failed: arch armv8.1-m.main: self-test failed at
> ../../src/gdb/disasm-selftests.c:165

The first error I run into is this one, and I've debugged it.

1. With exec.

In gdb_print_insn_arm, we run into this and set info->flags |=
USER_SPECIFIED_MACHINE_TYPE:
...
  /* GDB is able to get bfd_mach from the exe_bfd, info->mach is                
     accurate, so mark USER_SPECIFIED_MACHINE_TYPE bit.  Otherwise,             
     opcodes/arm-dis.c:print_insn reset info->mach, and it will trigger         
     the assert on the mismatch of info->mach and                               
     bfd_get_mach (current_program_space->exec_bfd ()) in                       
     default_print_insn.  */
  if (current_program_space->exec_bfd () != NULL)
    info->flags |= USER_SPECIFIED_MACHINE_TYPE;
...
and consequently we don't do this in print_insn:
...
      if ((info->flags & USER_SPECIFIED_MACHINE_TYPE) == 0)
          info->mach = bfd_mach_arm_unknown;
...
so we end up doing this in select_arm_features:
...
    case bfd_mach_arm_8_1M_MAIN:
      ARM_SET_FEATURES (ARM_ARCH_V8_1M_MAIN);
      arm_feature_set mve_all
        = ARM_FEATURE_CORE_HIGH (ARM_EXT2_MVE | ARM_EXT2_MVE_FP);
      ARM_MERGE_FEATURE_SETS (arch_fset, arch_fset, mve_all);
      force_thumb = 1;
      break;
...

With force_thumb set, we disassemble only two bytes, and the selftest fails.

2. Without exec.

- in gdb_print_insn_arm, we don't set
  info->flags |= USER_SPECIFIED_MACHINE_TYPE.
- in print_insn, we do bfd_mach_arm_unknown
- in select_arm_features, we don't set force_thumb

Without force_thumb set, we disassemble four bytes, and the selftest passes.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

  reply	other threads:[~2021-09-13 10:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-20 13:21 [Bug gdb/27891] New: " andrew.burgess at embecosm dot com
2021-09-13 10:32 ` vries at gcc dot gnu.org [this message]
2021-09-13 11:23 ` [Bug gdb/27891] " vries at gcc dot gnu.org
2021-09-13 12:14 ` luis.machado at linaro dot org
2021-09-13 19:43 ` vries at gcc dot gnu.org
2021-09-13 19:45 ` luis.machado at linaro dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-27891-4717-E1J8VE6AcH@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).