Bug 276376 - arm64 ddb: the disassembler does not recognise STP instructions
Summary: arm64 ddb: the disassembler does not recognise STP instructions
Status: In Progress
Alias: None
Product: Base System
Classification: Unclassified
Component: arm (show other bugs)
Version: 14.0-RELEASE
Hardware: arm64 Any
: --- Affects Some People
Assignee: Mitchell Horne
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-01-16 14:01 UTC by dfr
Modified: 2024-01-24 16:21 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description dfr 2024-01-16 14:01:09 UTC
Comparing DDB with gdb:


# sysctl debug.kdb.enter=1
debug.kdb.enKDB: enter: sysctl debug.kdb.enter
[ thread pid 873 tid 100293 ]
Stopped at      kdb_sysctl_enter+0x98:  str     xzr, [x19, #256]
db> x/i pci_add_child,10
pci_add_child:  undefined       a9ba7bfd
pci_add_child+0x4:      str     x27, [sp, #16]
pci_add_child+0x8:      undefined       a90267fa
pci_add_child+0xc:      undefined       a9035ff8
pci_add_child+0x10:     undefined       a90457f6
pci_add_child+0x14:     undefined       a9054ff4
pci_add_child+0x18:     mov     x29, sp
pci_add_child+0x1c:     mov     x21, x1
pci_add_child+0x20:     mov     x1, xzr
pci_add_child+0x24:     undefined       12800002
pci_add_child+0x28:     mov     x22, x0
pci_add_child+0x2c:     undefined       940b8a7b
pci_add_child+0x30:     mov     x19, x21
pci_add_child+0x34:     mov     x1, x21
pci_add_child+0x38:     mov     x20, x0
pci_add_child+0x3c:     str     x0, [x19, #24]!
db> c
ter: 0 -> 0
# kgdb ./kernel.full
GNU gdb (GDB) 13.2 [GDB v13.2 for FreeBSD]
Copyright (C) 2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
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 "aarch64-portbld-freebsd14.0".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./kernel.full...
(kgdb) x/10i pci_add_child
   0xffff000000223194 <pci_add_child>:      stp       x29, x30, [sp, #-96]!
   0xffff000000223198 <pci_add_child+4>:    str       x27, [sp, #16]
   0xffff00000022319c <pci_add_child+8>:    stp       x26, x25, [sp, #32]
   0xffff0000002231a0 <pci_add_child+12>:   stp       x24, x23, [sp, #48]
   0xffff0000002231a4 <pci_add_child+16>:   stp       x22, x21, [sp, #64]
   0xffff0000002231a8 <pci_add_child+20>:   stp       x20, x19, [sp, #80]
   0xffff0000002231ac <pci_add_child+24>:   mov       x29, sp
   0xffff0000002231b0 <pci_add_child+28>:   mov       x21, x1
   0xffff0000002231b4 <pci_add_child+32>:   mov       x1, xzr
   0xffff0000002231b8 <pci_add_child+36>:   mov       w2, #0xffffffff               // #-1
(kgdb) q
Comment 1 dfr 2024-01-23 17:15:04 UTC
I have since realised that the disassembler is missing support for many other instructions, including arithmetic immediate forms, most branches and probably more. I can work around this with some effort so its not super high priority.
Comment 2 Mitchell Horne freebsd_committer freebsd_triage 2024-01-24 16:21:57 UTC
(In reply to dfr from comment #1)

Indeed. There is someone who has been actively working on adding new instruction definitions to the disassembler, so I forwarded the bug to them (no bz account).