Comments (6)
Well, there's a bit more nuance here: the correct response of
vAttach
is any valid Stop Reason - not just those two.
True, but it's unclear exactly what registers are required, and gdb gets upset if you omit those registers. It also gets grumpy if you don't enumerate all the threads properly, and replying with S00
tells it to ask for that information separately.
from gdbstub.
(It's also interesting to note that because gdbstub
doesn't support having no process active, it necessarily asks "A program is being debugged already. Kill it? (y or n)", but gdbserver
supports having no process active, and therefore does not ask that question.)
from gdbstub.
I took a gander at the code, and it seems we're returning a HandlerStatus::Handled
instead of a HandlerStatus::DeferredStopReason
from the ExtendedMode::vAttach
handler:
Can you change that line and see if it helps?
from gdbstub.
A few notes:
- The correct return for
vAttach
isS00
(orT00......
), which does work!
(gdb) att 2
Attaching to program: E:\Code\Xous\Core\target\riscv32imac-unknown-xous-elf\release\xous-ticktimer, process 2
[remote] Sending packet: $vAttach;2#38
[remote] Packet received: S00
[remote] packet_ok: Packet vAttach (attach) is supported
- We need to handle
qC
, and this response must return the PID requested (i.e. we can't unilaterally useFAKE_PID
):
FAKE_PID:
[remote] Sending packet: $vAttach;2#38
[remote] Packet received: S00
[remote] packet_ok: Packet vAttach (attach) is supported
[remote] Sending packet: $qC#b4
[remote] Packet received: QCp01.02
/__w/riscv-none-elf-gcc-xpack/riscv-none-elf-gcc-xpack/build/win32-x64/sources/gdb-12.1/gdb/thread.c:530: internal-error: find_thread_ptid: Assertion `inf != nullptr' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n) y
Actual PID (i.e. 2):
(gdb) att 2
Attaching to program: E:\Code\Xous\Core\target\riscv32imac-unknown-xous-elf\release\xous-ticktimer, process 2
[remote] Sending packet: $vAttach;2#38
[remote] Packet received: S00
[remote] packet_ok: Packet vAttach (attach) is supported
[remote] Sending packet: $qC#b4
[remote] Packet received: QCp02.02
[remote] Sending packet: $Hgp2.2#b1
[remote] Packet received: OK
I've added a new function to MultiThreadBase
that allows me to get the current active PID, and with that I'm now able to switch processes by using attach [PID]
.
The result of this is in #129
from gdbstub.
- The correct return for
vAttach
isS00
(orT00......
), which does work!
Well, there's a bit more nuance here: the correct response of vAttach
is any valid Stop Reason - not just those two.
2. We need to handle
qC
, and this response must return the PID requested (i.e. we can't unilaterally useFAKE_PID
):
Indeed, I'm not surprised that GDB gets angry if you give it back a thread-id it's not expecting...
Will continue the discussion over on #129 itself
from gdbstub.
Closed via #129
from gdbstub.
Related Issues (20)
- Improved Error Type (more specificity, fewer semver hazards, etc...) HOT 1
- Clippy warnings in library code HOT 3
- Allow passing a custom initial stop reason
- [mips] "unexpected packet" packet on single step HOT 10
- Not getting any events when breakpoint is set HOT 1
- All registers are byteswapped when using lldb HOT 14
- Switch `enum Signal` to `struct Signal(pub u8)` with associated constants
- NoActiveThreads error when there are no active thread HOT 9
- Misleading comment in `state_machine`? HOT 2
- Multiprocess debugging HOT 8
- [riscv32] `PacketUnexpected` when issuing `stepi` HOT 3
- Remove `NoActiveThread` Error
- example_no_std doesn't build on Windows HOT 1
- Remove `SingleStepBehavior` guard rail HOT 1
- Make `QStartNoAckMode` optional HOT 1
- Options for flow control? HOT 3
- Support "ack/nack" packets for unreliable transports HOT 6
- Fails to compile for atmega328p (Arduino Uno) HOT 2
- Add APIs for generating XML on-the-fly
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gdbstub.