7
31
Fork
You've already forked blackmagic
23

WIP: Fix: cortexar hardware breakpoints #1894

Draft
litui wants to merge 1 commit from litui/fix/cortexar-resume-after-load into main
pull from: litui/fix/cortexar-resume-after-load
merge into: blackmagic-debug:main
blackmagic-debug:main
blackmagic-debug:feature/bmda-remote-comms
blackmagic-debug:ALTracer/feature/aarch64-ident
blackmagic-debug:feature/better-meson-optimisation-handling
blackmagic-debug:feature/am335x-support
blackmagic-debug:feature/esp32-c3-support
blackmagic-debug:feature/cortex-ar-software-breakpoints
blackmagic-debug:feature/unit-testing
blackmagic-debug:feature/windows-usb-serial-interface-naming
blackmagic-debug:fix/bmp-external-spi
blackmagic-debug:ALTracer/feature/bluepillplus-platform
blackmagic-debug:ALTracer/feature/at32f43x-unrdp
blackmagic-debug:feature/const-correctness
blackmagic-debug:ALTracer/feature/fault_handlers
blackmagic-debug:ALTracer/feature/hazard3-ice40-support
blackmagic-debug:fix/ci-cleanup
blackmagic-debug:ALTracer/fix/gdb-10-12-thread
blackmagic-debug:ALTracer/feature/blackpill-f4-adc
blackmagic-debug:ALTracer/fix/cortex-desc-allocfail-report
blackmagic-debug:ALTracer/feature/spi-perf
blackmagic-debug:ALTracer/feature/calibrate_swd
blackmagic-debug:ALTracer/feature/blank-check
blackmagic-debug:feature/avr
blackmagic-debug:v2.0
blackmagic-debug:v1.9
blackmagic-debug:v1.10
blackmagic-debug:v1.8
litui commented 2024年08月15日 00:16:37 +02:00 (Migrated from github.com)
Copy link

Detailed description

  • Hardware breakpoints are now working by bypassing the MMU at the top of the virt_to_phys function when an address is located in RAM. Without this bypass, RAM addresses were being mangled due to inaccurate phys_addr being supplied by the address translation machinery.
  • Overriding soft breakpoints to hard breakpoints because GDB automatically selects soft breakpoints when a) a memory map xml is provided, and b) the address is located in RAM. This is not incorrect behaviour, but an override is necessary unless/until soft breakpoints are implemented for cortexar on BMP.

Your checklist for this pull request

Closing issues

<!-- Filling this template is mandatory --> ## Detailed description <!-- Explain the **details** for making this change. * Is a new feature implemented? * What existing problem(s) does the pull request solve? * How does the pull request solve these problems? Please provide enough information so that others can review your pull request. Information embedded in the description part of the commits doesn't count. --> * Hardware breakpoints are now working by bypassing the MMU at the top of the `virt_to_phys` function when an address is located in RAM. Without this bypass, RAM addresses were being mangled due to inaccurate `phys_addr` being supplied by the address translation machinery. * Overriding soft breakpoints to hard breakpoints because GDB automatically selects soft breakpoints when a) a memory map xml is provided, and b) the address is located in RAM. This is not incorrect behaviour, but an override is necessary unless/until soft breakpoints are implemented for cortexar on BMP. ## Your checklist for this pull request * [x] I've read the [Code of Conduct](https://github.com/blackmagic-debug/blackmagic/blob/main/CODE_OF_CONDUCT.md) * [x] I've read the [guidelines for contributing](https://github.com/blackmagic-debug/blackmagic/blob/main/CONTRIBUTING.md) to this repository * [x] It builds for hardware native (see [Building the firmware](https://github.com/blackmagic-debug/blackmagic?tab=readme-ov-file#building-black-magic-debug-firmware)) * [x] It builds as BMDA (see [Building the BMDA](https://github.com/blackmagic-debug/blackmagic?tab=readme-ov-file#building-black-magic-debug-app)) * [ ] I've tested it to the best of my ability * [x] My commit messages provide a useful short description of what the commits do ## Closing issues <!-- put "fixes #XXXX" here to auto-close the issue(s) that your PR fixes (if any). -->
litui commented 2024年08月15日 11:09:22 +02:00 (Migrated from github.com)
Copy link

There, more or less fixed things back to the way I found them with the exception of the RAM address fix. Tested and continuation from a load works, and breakpoints appear to land in the correct places with the check of the address against the RAM. Will look over it all again tomorrow when I'm awake.

There, more or less fixed things back to the way I found them with the exception of the RAM address fix. Tested and continuation from a load works, and breakpoints appear to land in the correct places with the check of the address against the RAM. Will look over it all again tomorrow when I'm awake.
litui commented 2024年08月16日 02:55:40 +02:00 (Migrated from github.com)
Copy link
For testing purposes (for the Deluge crowd), [here are a couple launch.json configs for VSCode](https://gist.github.com/litui/b106c49712bbcb06f8211620bbba0d92) and [here is the meson cross-file I'm using to build blackmagic](https://gist.github.com/litui/5b8b1a7e3e8ec2824be89dedd87c306f)
litui commented 2024年09月01日 23:59:03 +02:00 (Migrated from github.com)
Copy link

This PR will need tweaking after https://github.com/blackmagic-debug/blackmagic/pull/1916 gets merged in.

Edit: done!

This PR will need tweaking after https://github.com/blackmagic-debug/blackmagic/pull/1916 gets merged in. Edit: done!
litui commented 2024年09月02日 02:02:31 +02:00 (Migrated from github.com)
Copy link

I bumped a request on cortex-debug's repo ( https://github.com/Marus/cortex-debug/issues/978 ) for ability to set the break command used in gdb and then stumbled upon a comment in https://github.com/Marus/cortex-debug/issues/555 which noted that OpenOCD, as a gdb server backend, offers the command gdb_breakpoint_override. Setting this override up as a BMP monitor command might be something to think about.

I bumped a request on cortex-debug's repo ( https://github.com/Marus/cortex-debug/issues/978 ) for ability to set the break command used in gdb and then stumbled upon a comment in https://github.com/Marus/cortex-debug/issues/555 which noted that OpenOCD, as a gdb server backend, offers the command `gdb_breakpoint_override`. Setting this override up as a BMP monitor command might be something to think about.
This pull request is marked as a work in progress.
This branch is out-of-date with the base branch
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin litui/fix/cortexar-resume-after-load:litui/fix/cortexar-resume-after-load
git switch litui/fix/cortexar-resume-after-load
Sign in to join this conversation.
No reviewers
Labels
Clear labels
BMD App
Black Magic Debug App (aka. PC hosted) (not firmware)
BMP Firmware
Black Magic Probe Firmware (not PC hosted software)
Bug
Confirmed bug
Build system
Build system
Can't reproduce
Maintainers can't reproduce this problem
CI
Continuous Integration System
Contribution wanted
User contributions welcome
Documentation
Project documentation
Draft
Work in progress draft
Duplicate
This issue or pull request already exists
Enhancement
General project improvement
Feedback wanted
Requires additional submitter feedback
Foreign Host Board
Non Native hardware to runing Black Magic firmware on
GDB
Issue/PR related to GDB
Good first issue
Good for newcommers
HwIssue Mitigation
Solving or mitigating a Hardware issue in Software
Information Needed
Maintainers need more information
NativeHardware
Official Black Magic Debug Hardware
New Host Board
New hardware to run Black Magic firmware on
New Target
New debug target
Off Topic
Something that does not involve the project in any way
Potential Bug
A potential, unconfirmed or very special circumstance bug
Regression
Bug caused by a regression
User Interest Needed
More user interest required before consideration
User Testing Needed
Looking for user testing reports
Won't fix
Outside of the project scope or works as intended
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
blackmagic-debug/blackmagic!1894
Reference in a new issue
blackmagic-debug/blackmagic
No description provided.
Delete branch "litui/fix/cortexar-resume-after-load"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?