public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "cjn at google dot com" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug tdep/28653] New: "set arch armv7e-m" doesn't actually make gdb think it's connected to an m-profile target
Date: Mon, 06 Dec 2021 04:59:51 +0000	[thread overview]
Message-ID: <bug-28653-4717@http.sourceware.org/bugzilla/> (raw)

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

            Bug ID: 28653
           Summary: "set arch armv7e-m" doesn't actually make gdb think
                    it's connected to an m-profile target
           Product: gdb
           Version: HEAD
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: tdep
          Assignee: unassigned at sourceware dot org
          Reporter: cjn at google dot com
  Target Milestone: ---

"arm_psr_thumb_bit" and "arm_pc_is_thumb" rely on the "is_m" flag being set
inside "arm_gdbarch_init".

That only can happen if an m-profile executable file is loaded or a complete
target description is available, though. "arm_gdbarch_init" doesn't actually
pay attention if explicitly told: "set archicecture armv7e-m" - the "is_m" flag
remains zero, and so software single stepping can be weird, and the register
dumps show "cpsr" rather than the expected "xpsr".

I added a print where the "tdep->is_m" flag is set near the end of
"arm_gdbarch_init" and get this output:

    (gdb) set architecture armv7e-m
    arm_gdbarch_init:9293: is_m = 0
    The target architecture is set to "armv7e-m".

Setting the architecture indirectly via a "file" command, does work around the
problem:

    (gdb) show architecture
    The target architecture is set to "auto" (currently "i386").
    (gdb) file example.elf
    arm_gdbarch_init:9293: is_m = 1
    Reading symbols from example.elf...
    (gdb) show architecture
    The target architecture is set to "auto" (currently "armv7e-m").

There are other m-profile architectures available via "set architecture" that
should also be fixed.

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

             reply	other threads:[~2021-12-06  4:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-06  4:59 cjn at google dot com [this message]
2021-12-06  5:01 ` [Bug tdep/28653] " cjn at google dot com
2021-12-06  5:35 ` cjn at google dot com
2021-12-06 17:36 ` cjn at google dot com
2021-12-06 17:36 ` cjn at google dot com
2022-10-27 23:53 ` luis.machado at arm dot com

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-28653-4717@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).