-
-
Notifications
You must be signed in to change notification settings - Fork 774
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature: fake thread support #1125
Conversation
Update: GDB 12 is now tested and confirmed working |
I gave this a quick try to help move this along but didn't go so well. Both
|
Thank you for testing this. Interesting that particularly continue results in such a failure - we think we might know why but that's going to take some more diving the GDB code to fix. We'll look into it after we've had some sleep. Load is the more curious one as we can't see why that'd not work (as vFlashErase is how BMP works for this).. smells like more protocol shenanigans that they've not documented |
ah @tuna-f1sh in the trace above, you never run Given scanning the bus implies 'kill', we'll see if when running such a command with an active target being disconnected from.. we can generate a packet to GDB that tells it that it's not attached any more |
9dba098
to
9501e44
Compare
We've done what we can to make the sequence of events above more obvious that you've not attached after doing a bus scan.. including trying to notify GDB that "the process has exited" with a Stop notification.. but GDB seems to implement it's own remote protocol wrong there so shrugs but we tried. We tested continue works on our test target with GDB 11 and it does when actually attached. We'll dive into load if you could re-check that you were actually attached to the target |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much for implementing this workaround. I am still disappointed that the GDB developers are having so much trouble wrapping their head around the problem they introduced.
I am merging it for now to make our users life easier.
Ok, I think I was a bit too trigger happy on the review. I am testing with GDB 12.1 and I am getting an error trying to flash firmware:
|
133da84
to
0c679f9
Compare
The load command issues should now be resolved after examining the protocol trace you gave us in Discord. Please try again now :) |
…nally broken otherwise
… attached that you aren't after the command, despite what GDB thinks
…ited when the user runs a new bus scan while attached to a target
0c679f9
to
ee78325
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested on native hardware with STM32F4 target using GDB 12. The following things were tested:
- attach
- load
- start
- next/step
- break/watch
- continue
So I will call it good. Let's see what happens ;) :D
@dragonmux I'll tested the updated but just to clarify, I'm fairly sure I was attached (scan, attach is part of my workflow) just it wasn't capture in pasted. The
Which means the STM32F4 was attached? |
That output means the STM32F4 was found but there's no * in the attach column - you must run |
@tuna-f1sh You might want to refer to the documentation. https://black-magic.org/getting-started.html#connecting-to-the-software there is also a video that walks you through the basics of how to use Black Magic Probe. |
@esden @dragonmux thanks for the link but I've been happily using it for years so must have just made an oversight quickly testing that firmware (I have an attach script and think maybe the device wasn't powered or something and I forgot after Anyway, glad both issues are now closed 🥳 |
Getting the same error as tuna-f1sh with continue on gdb 12.1:
And yes - it was attached. |
The behavior you're seeing can occur for exactly two reasons: if (!cur_target) {
gdb_putpacketz("X1D");
break;
} and case TARGET_HALT_ERROR:
gdb_putpacket_f("X%02X", GDB_SIGLOST);
morse("TARGET LOST.", true);
break; The latter will make the LEDs on BMP blink in a morse-code pattern. Please open a new issue with a trace of what you're doing. In the case of LEDs blinking, please try building the firmware with |
Hmm... I cannot reproduce it now and earlier was getting it all over again. And indeed happens only when detached after repeated scan. |
@bonidydy yeah I played around after this and think it’s the repeated ‘mon s’ I did as part of the bug capture (following ‘load’ fail bug), which I wouldn’t normally do and didn’t realise detached any attached. |
…fake thread support). Merge support for hardware version 6 (BMP v2.3) from release 1.8.2. Merge partial Flash memory locking for SAMD devices from 1.8.2. Replace some calls to alloca() to calloc(). Code clean-up (mostly merged from release 1.8.2).
This PR addresses the issue that the GDB folks have blown us off once again and refuse to fix GDB to support targets (and therefore GDB servers) which simply can't have threads.
In this PR we implement support for the machinery GDB uses for threads support, but only to fake there being a single thread in any given "process" (debug port on the scan chain). This has the side effect of requiring the implementation of such things as vKill otherwise GDB 11 and newer won't actually execute a process kill as they don't use the old method.
This will need merging to both main and v1.8
This fixes #929