adamgreen / mri

MRI - Monitor for Remote Inspection. The gdb compatible debug monitor for Cortex-M devices.
Apache License 2.0
155 stars 57 forks source link

Report hwbreak/swbreak in writeTrapReasonToBuffer #23

Closed xiaoxiang781216 closed 2 years ago

adamgreen commented 2 years ago

I explicitly removed hwbreak/swbreak reasons in commit e53d85b2db175b3406625c91827ac5afdbecb77b since GDB can work out the breakpoint reason on its own and it sometimes got confused when these were returned. I just found the user experience to be better without them. If you have found different, then please let me know.

xiaoxiang781216 commented 2 years ago

I explicitly removed hwbreak/swbreak reasons in commit e53d85b since GDB can work out the breakpoint reason on its own and it sometimes got confused when these were returned. I just found the user experience to be better without them. If you have found different, then please let me know.

@adamgreen which branch this patch commit in? I can't find it on master branch.

adamgreen commented 2 years ago

Can't you just click on the commit number (https://github.com/adamgreen/mri/commit/e53d85b2db175b3406625c91827ac5afdbecb77b) in my comment to be taken to the commit in question?

xiaoxiang781216 commented 2 years ago

Yes, I can cherry-pick with https://github.com/adamgreen/mri/commit/e53d85b2db175b3406625c91827ac5afdbecb77b, but I want my upcoming change base on your working branch to avoid the potential conflict.

adamgreen commented 2 years ago

I guess I don't know what you are asking.

That commit is already in master. I made it back in 2020.

This PR of yours was trying to put that functionality back into the code and I was pointing you to the commit where I explicitly removed it. That commit has the reasons I removed it in the first place. It is for those same reasons that I closed this PR without merging it.

xiaoxiang781216 commented 2 years ago

But, I checkout to the master, the related macro still exist in master:

image
adamgreen commented 2 years ago

If you do a git blame on some of the parts that you see in the code now even though they were removed by that commit https://github.com/adamgreen/mri/commit/e53d85b2db175b3406625c91827ac5afdbecb77b, you would see that they were added back in by commit https://github.com/adamgreen/mri/commit/78f21e1b67ac0c9873ae379b69d829abcafee70f where they were added back so that the ranged single stepping code could make sure that the debug stop was caused by single stepping and not some other event such as breakpoints. So the breakpoint reasons are populated into the reason.type field for single stepping but they are still not used to return a more specific stop reason to GDB since I found it caused more problems than it solved.

xiaoxiang781216 commented 2 years ago

Ok, I finally understand what's your mean.