You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This upgrades the version of the MRI library sources used by
KernelDebug and ThreadDebug to the latest that I am actively
supporting.
Changes that will benefit both ThreadDebug and KernelDebug include:
* I added the libraries/MRI/src/variants folder to hold the definition
of g_memoryMapXml specific to each Arduino variant which supports
MRI. Before these definitions were duplicated between ThreadDebug and
KernelDebug.
* Has cache fix to enable soft breakpoints for code running out of RAM.
* Fixed cases where single stepping would sometimes hang if the code
being stepped over caused a crash.
* I have added a DebugSerial object which can be used in place of
Serial and/or SerialUSB to send output to the GDB console during the
development process. MRI contains changes which make sending such
output to GDB more efficient so I added this DebugSerial object to
take advantage of it. The ThreadDebug example has been modified to
show using this object to allow Serial.print() calls when
using ThreadDebug which previously caused problems.
Some of the changes included in this version update will benefit
ThreadDebug:
* Platform_CommSendBuffer() is now overridden by ThreadDebug to send
packets to GDB in one USB call instead of sending a byte at a
time as it did before.
* The original RTX OS handlers like SVCall, PendSV, and SysTick only
need to be saved once, during init, and not each time that
ThreadDebug's versions are switched in.
* When running a test pass on ThreadDebug this time, I noticed that
user threads weren't being locked as expected when I used the
`set scheduler-locking step` command in GDB. I have always had this
case in my test pass so I don't know how I didn't notice it was
broken before. Anyway it is now fixed by making sure that the RTX
idle thread is never allowed to remain frozen. If it has been
requested by GDB to be frozen, it is thawed at one priority level
higher than normal so that it stops all other frozen threads from
running.
Other changes might not be a direct benefit to ThreadDebug but they
will be for KernelDebug:
* Faults will now pend to DebugMon so that invalid memory accesses
initiated from GDB will no longer result in double fault CPU hard
hangs. This pending to DebugMon for faults was actually copied from
behavior first created for ThreadDebug back in 2020.
* Better handling of crashes the occur when the stack pointer becomes
corrupted. Previously stacking exceptions could result in CPU hard
hangs due to double faulting.
* Now has better code to handle single stepping through critical
sections.
* Can now modify the current SP pointer from GDB. Probably not
something most people would want to do though. Can also update the
value of the PRIMASK, BASEPRI, FAULTMASK, and CONTROL special
registers.
Other important updates to MRI included in version 1.5 are:
* Can now step into Standard C Library calls like memset() with no
weird side effects.
* MRI now supports running the DebugMon interrupt handler at priorities
other than 0. This allows important code such as USB or Bluetooth
stacks to run in the background while GDB/MRI are debugging lower
priority code. I first explored this ability for ThreadDebug but now
use it in other projects to do things like communicate with GDB over
BLE.
* Anywhere that the application under debug might want to call into
MRI (semihosting, setting debugger hooks, etc), it now uses unique
hardcoded `bkpt` instructions rather than just making function calls.
This allows them to be called when MRI is installed as a separate
boot loader on a device.
* Unescaping of binary packet data sent from GDB has been pushed lower
down into the software stack, to the packet layer. This is where it
should have been done in the first place.
Thanks go to @xiaoxiang781216, @icecream95, and @PetteriAimonen for
their MRI contributions that are included in this update.
0 commit comments