Skip to content

Comments

armv8m: make the debugger handle better faults through ICSR#2187

Merged
dragonmux merged 1 commit intoblackmagic-debug:mainfrom
mean00:better_handle_armv8_faults_v2
Feb 11, 2026
Merged

armv8m: make the debugger handle better faults through ICSR#2187
dragonmux merged 1 commit intoblackmagic-debug:mainfrom
mean00:better_handle_armv8_faults_v2

Conversation

@mean00
Copy link

@mean00 mean00 commented Feb 1, 2026

Detailed description

The ArmV8m does not handle faults the same way. The two main differences are :

  • The fault will trigger BEFORE executing the fault rather than after
  • The info is split between between DFSR and the new ICSR

As a result the current code does not handle fault very well.
Put a breakpoint on a fault (for example asm("udf #0") and try to "si" on it.

Gdb will appear to get stuck there because the debugger will see the state BEFORE the fault is actually executed and as a result not detect the fault.

The MR adds a separate path that , for ArmV8M, it checks if a fault is pending on ICSR
The "si" command on a fault now works and you proceed on to the handler.

I tested it on a RP2350 and on another CortexM33 successfully.
I'm not convinced all cases are covered as some parts are configurable, but at least it's working better.

Not sure either if the new two new registers should be renamed with V8M in the name or something.

Your checklist for this pull request

Closing issues

N/A

Copy link
Member

@dragonmux dragonmux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got a few notes on going through this PR - with them fixed though we'll be happy to merge this.

@mean00
Copy link
Author

mean00 commented Feb 4, 2026

I'll update the MR this weekend
Thank you

@dragonmux dragonmux added this to the v2.1 release milestone Feb 4, 2026
@dragonmux dragonmux added Bug Confirmed bug Enhancement General project improvement labels Feb 4, 2026
@mean00
Copy link
Author

mean00 commented Feb 7, 2026

I think i got all the remarks as a separate commit for easy review
If that's ok, i'll squash them, it takes 10 sec to do so
Thank you

Copy link
Member

@dragonmux dragonmux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking better - there is one small note we have and once that's been addressed, we'll approve and merge this.

@mean00 mean00 force-pushed the better_handle_armv8_faults_v2 branch from 805d315 to 46e86b9 Compare February 10, 2026 18:50
@mean00
Copy link
Author

mean00 commented Feb 10, 2026

This time i think it's correct. I've squashed it as the last change was really small & easy to check.
(slightly altered the commit comment to be in line with the naming for ARMv8-M)
Thank you.

@dragonmux
Copy link
Member

It would technically be cortexm: for the commit message suffix as it's not based on the concept touched, but which file is touched.. however, we're going to approve and merge this as it stands as it looks good.

Copy link
Member

@dragonmux dragonmux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thank you for the contribution!

We'll do some cleanup after in a follow-up PR we have to do anyway (comment style, if with assign to true into straight truthy assignment) but this looks all functional which is the important part.

@dragonmux dragonmux force-pushed the better_handle_armv8_faults_v2 branch from 46e86b9 to 141b476 Compare February 11, 2026 12:03
@dragonmux dragonmux merged commit 141b476 into blackmagic-debug:main Feb 11, 2026
38 of 39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Confirmed bug Enhancement General project improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants