microsoft / microsoft/vscode-cpptools

Disassembly View ARM (Thumb) Instruction Bytes are Backwards

Open
#11,803 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

debugger help wanted
Dominant language
TypeScript
Stars
6.2k
Forks
1.7k
Avg merge
14h 46m
Merged PRs (30d)
61

Description

Environment
  • OS and version: Windows 11
  • VS Code: 1.85.1
  • C/C++ extension: 1.18.5
  • OS and version of remote machine (if applicable):
  • GDB / LLDB version: OpenOCD and arm-none-eabi-gdb.exe
Bug Summary and Steps to Reproduce

Bug Summary:

The bytes are backwards. LDR instruction should be 0x4B01.
image

Correct result in IAR:
image

Steps to reproduce:

  1. Open Disassembly View
  2. View Thumb Instruction (16-bit Word)
Debugger Configurations
tasks.json
{
  "version": "2.0.0",
  "tasks": [
    {
      "label": "Flash",
      "type": "shell",
      "command": "openocd",
      "args": [
        "-f",
        "interface/cmsis-dap.cfg",
        "-f",
        "target/rp2040.cfg",
        "-c",
        "adapter speed 5000; program {${command:cmake.launchTargetPath}} verify reset exit"
      ],
      "problemMatcher": []
    },
    {
      "label": "Build",
      "type": "cmake",
      "command": "build",
      "problemMatcher": "$gcc",
      "group": {
        "kind": "build",
        "isDefault": true
      }
    }
  ]
}

launch.json
{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Pico Debug (Cortex-Debug)",
      "cwd": "${workspaceFolder}",
      "executable": "${command:cmake.launchTargetPath}",
      "request": "launch",
      "type": "cortex-debug",
      "servertype": "openocd",
      "gdbPath": "arm-none-eabi-gdb",
      "device": "RP2040",
      "configFiles": [
        "interface/cmsis-dap.cfg",
        "target/rp2040.cfg"
      ],
      "svdFile": "${env:PICO_SDK_PATH}/src/rp2040/hardware_regs/rp2040.svd",
      "runToEntryPoint": "main",
      "openOCDLaunchCommands": [
        "adapter speed 5000"
      ]
    },
    {
      "name": "Pico Debug (Cortex-Debug with external OpenOCD)",
      "cwd": "${workspaceFolder}",
      "executable": "${command:cmake.launchTargetPath}",
      "request": "launch",
      "type": "cortex-debug",
      "servertype": "external",
      "gdbTarget": "localhost:3333",
      "gdbPath": "arm-none-eabi-gdb",
      "device": "RP2040",
      "svdFile": "${env:PICO_SDK_PATH}/src/rp2040/hardware_regs/rp2040.svd",
      "runToEntryPoint": "main"
    },
    {
      "name": "Pico Debug (C++ Debugger)",
      "type": "cppdbg",
      "request": "launch",
      "cwd": "${workspaceFolder}",
      "program": "${command:cmake.launchTargetPath}",
      "MIMode": "gdb",
      "miDebuggerPath": "arm-none-eabi-gdb",
      "miDebuggerServerAddress": "localhost:3333",
      "debugServerPath": "openocd",
      "debugServerArgs": "-f interface/cmsis-dap.cfg -f target/rp2040.cfg -c \"adapter speed 5000\"",
      "serverStarted": "Listening on port .* for gdb connections",
      "filterStderr": true,
      "stopAtEntry": true,
      "hardwareBreakpoints": {
        "require": true,
        "limit": 4
      },
      "preLaunchTask": "Flash",
      "svdPath": "${env:PICO_SDK_PATH}/src/rp2040/hardware_regs/rp2040.svd"
    }
  ]
}
Debugger Logs
None
Other Extensions

No response

Additional Information

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue in the Disassembly View with the provided ARM Thumb setup, using the tasks.json and launch.json configurations and the 16-bit LDR example. Trace how the instruction bytes are displayed and verify that the displayed word matches the expected 0x4B01 ordering.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, vscode
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.