-
-
Notifications
You must be signed in to change notification settings - Fork 50
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
Dynamic Arch
selection
#53
Comments
Arch
selectionArch
selection
To add to this discussion - I'm wondering if there's any drawbacks to modifying the signature of A similar approach could be taken for |
Damn, you're right. Your idea of modifying I guess the broader question is whether or not In the case of If you can hack together a POC implementation, I'd be more than happy to work with you to tweak the API to me more amenable to your use case. Since I just released Also, could you elaborate on what you mean by "(as of now it will panic in |
Sure! I'd be happy to put in some work to improve this API :) I like your suggestion of providing a size hint via an gdbstub/examples/armv4t/gdb/mod.rs Lines 205 to 219 in 9e0526d
|
Also - I noticed that there is a new P.S: Have you had any thoughts about the weird x86 boot process? Specifically its mode-switching between 16-bit, to 32-bit, to 64-bit? |
sigh this is another vestigial bit of infrastructure left over from when I took a crack at implementing GDB Agent support (see the I should probably just mark that bit of the
Hmmm, that's an interesting point... Taking a very cursory look at the "prior art" in the open-source GDB stub space, it seems that most stubs assume a single static architecture throughout execution. e.g: QEMU seems to have the same issue, and as such, requires some client side workarounds to debug early-boot code. Another consideration is that the GDB RSP doesn't have any built-in arch-switching signaling mechanism, so even though you can TL;DR, I think there are two approaches you can take here:
|
Add this to |
Which bit specifically? Dynamic At the moment, my gut feeling is to keep 0.6 the "bare metal" release (with an emphasis on the new state-machine API + no panic support), and punting the bulk of this issue to 0.7. |
Extracted from a back-and-forth on #31 (comment)
Will likely tie into #12
With the current
Arch
architecture, it's actually pretty easy to "punch through" the type-safe abstractions by implementing anArch
that looks something like this:This can then be combined with the recently added
TargetDescriptionXmlOverride
IDET to effectively create a runtime configurableArch
+Target
(see #43)While this will work in
gdbstub
right now, this approach does have a few downsides:gdbstub
's most useful abstractions, forcing end users to care about the unfortunate details of how GDB de/serializes register data (e.g: sending data in the order defined bytarget.xml
, input/output buffer management, etc...)PassthroughRegs
buffer will be be immediately copied into the "true" output buffer on every invocation. Mind you, neither is using atype Registers
intermediary, but hey, linear copies are super fast, so it's probably fine.PassthroughRegs
type is static, and as such, will have to include a buffer that's large enough to handle the "wost case" largest inbound/outbound payload. This can be mitigated by using variable-length type as the backing storage (such as aVec
) when running in anstd
environment.gdbstub
(0.4.5
at the time of writing), each call to{read,write}_registers
results in a fresh instance oftype Registers
being allocated on the stack. The original intent behind this decision was to avoid having a permanent "static"Registers
struct take up memory insidestruct GdbStub
, but honestly, it's not that important. Thankfully, this is a internal issue with a fairly easy fix, and I'm considering switching where the type is stored (instruct GdbStub
vs. the stack) in the next minor/patch version ofgdbstub
.There are a couple things that can be done to mitigate this issue:
PassthroughArch
, so that folks don't have to write all this boilerplate themselvesgdbstub
's guts.Arch
API, and modify it to enable more elegant runtime configuration, while also retaining as many ergonomic features / abstraction layers as the current static-oriented API.The text was updated successfully, but these errors were encountered: