0.4.0
This version includes a major API overhaul, alongside a slew of new features and general improvements. While updating to 0.4.0
will require some substantial code modifications, it's well worth the effort, as 0.4.0
is the safest, leanest, and most featureful release of gdbstub
yet!
Fun fact: Even after adding a bunch of new features and bug-fixes, the in-tree example_no_std
has remained just as small! The example on the semver-fix-0.2.2
branch is 20251
bytes, while the example on 0.4.0
is 20246
bytes.
API Changes
- Rewrite the
Target
API in terms of "Inlineable Dyn Extension Traits" (IDETs)- By breaking up
Target
into smaller pieces which can be mixed-and-matched, it not only makes it easier to get up-and-running withgdbstub
, but it also unlocks a lot of awesome internal optimizations:- Substantially reduces binary-size footprint by guaranteeing dead-code-elimination of parsing/handling unimplemented GDB protocol features.
- Compile-time enforcement that certain groups of methods are implemented in-tandem (e.g:
add_sw_breakpoint
andremove_sw_breakpoint
).
- By breaking up
- Update the
Target
API with support for non-fatal error handling.- The old approach of only allowing *fatal* errors was woefully inadequate when dealing with potentially fallible operations such as reading from unauthorized memory (which GDB likes to do a bunch), or handling non-fatal
std::io::Error
that occur as a result ofExtendedMode
operations. The newTargetResult
/TargetError
result is much more robust, and opens to door to supporting additional error handling extensions (such as LLDB's ASCII Errors).
- The old approach of only allowing *fatal* errors was woefully inadequate when dealing with potentially fallible operations such as reading from unauthorized memory (which GDB likes to do a bunch), or handling non-fatal
- Update the
Connection
trait with new methods (flush
- required,write_all
,on_session_start
) - Lift
Registers::RegId
toArch::RegId
, and introduce new temporaryRegIdImpl
solution for avoiding breaking API changes due to newRegId
implementations (see #29) - Mark various
RegId
enums as#[non_exhaustive]
, allowing more registers to be added if need be. - Error types are now marked as
#[non_exhaustive]
.
New Protocol Extensions
ExtendedMode
- Allow targets to run new processes / attach to existing processes / restart execution.- Includes support for
set disable-randomization
,set environment
,set startup-with-shell
, andset cwd
andcd
.
- Includes support for
SectionOffsets
- Get section/segment relocation offsets from the target. #30 (mchesser)- Uses the
qOffsets
packet under-the-hood.
- Uses the
Bugfixes
- Fix issues related to selecting the incorrect thread after hitting a breakpoint in multi-threaded targets.
- Ensure that
set_nodelay
is set when using aTcpStream
as aConnection
(via the newConnection::on_session_start
API)- This should result in a noticeable performance improvement when debugging over TCP.
Misc
- Removed
btou
dependency. - Removed all
UTF-8
awarestr
handling code.- GDB uses a pure ASCII protocol, so including code to deal with UTF-8 resulted in unnecessary binary bloat.