llvm / llvm/llvm-project

[LLDB, gdb-remote] LLDB shows breakpoint opcodes in disassembly when debugging ARM Cortex-M0 with OpenOCD/gdb-remote

Open
#197,564 11 comments 0 reactions 0 assignees View on GitHub
lldb
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

When using LLDB with OpenOCD to debug ARM Cortex-M0 targets via the gdb-remote protocol, breakpoint opcodes (e.g., bkpt instructions) appear in the disassembly output instead of the original instructions. This makes debugging difficult as the displayed code does not match the actual program.

**Environment:**
- Target: ARM Cortex-M0
- Debug server: OpenOCD
- Protocol: gdb-remote

**Steps to Reproduce:**
1. Connect LLDB to an ARM Cortex-M0 target via OpenOCD using gdb-remote protocol
2. Set one or more software breakpoints in the code
3. Run the program until it hits a breakpoint
4. Execute disassemble command or view disassembly around breakpoint locations

**Expected Behavior:**
The disassembly should show the original instructions that were replaced by breakpoint opcodes, allowing developers to
see the actual program code.

**Actual Behavior:**
The disassembly shows breakpoint opcodes ( as seen in the screenshot below) instead of the original instructions at breakpoint
locations.

Image

I have a potential fix for this issue and would like to submit a patch.

Contributor guide

Open the contributing guide

Research direction

Start by tracing LLDB's gdb-remote software-breakpoint handling for ARM Cortex-M0 and the path used by the disassemble command. Reproduce the issue with OpenOCD, then inspect how breakpoint locations are read and displayed. Done means disassembly around software breakpoints shows the original instructions rather than bkpt opcodes.

Written by the indexing model from the issue text.

Assessment

Domain
devtools, embedded-iot
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.