public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Maximilian Schneider <max@schneidersoft.net>
To: gdb@sourceware.org
Subject: Incorrect thumb disassembly/detection
Date: Sat, 11 Sep 2021 11:41:21 +0100	[thread overview]
Message-ID: <b0168020bfc43b68ed3a4c2b9b8d6147b7d81809.camel@schneidersoft.net> (raw)

Hello,

I am working on some code for a cortex-M33 and see that the gdb
disassembly does not match that of objdump, but only when a target is
connected.

$ arm-none-eabi-objdump -d bin/usb_cdc.elf | awk -v RS=
'/^[[:xdigit:]]+ <main>/'
00000cb8 <main>:
     cb8:	b500      	push	{lr}
     cba:	b085      	sub	sp, #20
     cbc:	ab03      	add	r3, sp, #12
[-snip-]

$ gdb-multiarch bin/usb_cdc.elf 
GNU gdb (Debian 8.2.1-2+b3) 8.2.1
[-snip-]
(gdb) disas main
Dump of assembler code for function main:
   0x00000cb8 <+0>:	push	{lr}
   0x00000cba <+2>:	sub	sp, #20
   0x00000cbc <+4>:	add	r3, sp, #12
[-snip-]
End of assembler dump.
(gdb) target remote localhost:2331
Remote debugging using localhost:2331
0x00000000 in __isr_vector ()
(gdb) disas main
Dump of assembler code for function main:
   0x00000cb8 <+0>:	bl	0xd6e4 <USB__IsHighSpeedCapable+12>
   0x00000cbc <+4>:	cbz	r0, 0xcc8 <main+16>
   0x00000cbe <+6>:	ldrb.w	r1, [sp, #6]
[-snip-]
End of assembler dump.

stepping instructions increments the program counter by 2 indicating
thumb mode. So i expect the disassembly also to be thumb.

What is causeing the disasembly to change to arm mode when a target is
used?

Best Regards!


             reply	other threads:[~2021-09-11 10:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-11 10:41 Maximilian Schneider [this message]
2021-09-13 19:31 ` Tom de Vries

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=b0168020bfc43b68ed3a4c2b9b8d6147b7d81809.camel@schneidersoft.net \
    --to=max@schneidersoft.net \
    --cc=gdb@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).