[all-commits] [llvm/llvm-project] ad5cac: [lldb][debugserver] remove g/G packet handling fro...

Jason Molenda via All-commits all-commits at lists.llvm.org
Thu Mar 20 13:33:14 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ad5cac3b06c3cb41397acc1fc96beae9b460f20c
      https://github.com/llvm/llvm-project/commit/ad5cac3b06c3cb41397acc1fc96beae9b460f20c
  Author: Jason Molenda <jmolenda at apple.com>
  Date:   2025-03-20 (Thu, 20 Mar 2025)

  Changed paths:
    M lldb/test/API/tools/lldb-server/register-reading/TestGdbRemoteGPacket.py
    M lldb/tools/debugserver/source/RNBRemote.cpp
    M lldb/tools/debugserver/source/RNBRemote.h

  Log Message:
  -----------
  [lldb][debugserver] remove g/G packet handling from debugserver (#132127)

In 2013 we added the QSaveRegisterState and QRestoreRegisterState
packets to checkpoint a thread's register state while executing an
inferior function call, instead of using the g packet to read all
registers into lldb, then the G packet to set them again after the func
call.

Since then, lldb has not sent g/G (except as a bug) - it either asks for
registers individually (p/P) or or asks debugserver to save and restore
the entire register set with these lldb extensions.

Felipe recently had a codepath that fell back to using g/G and found
that it does not work with the modern signed fp/sp/pc/lr registers that
we can get -- it sidesteps around the clearing of the non-addressable
bits that we do when reading/writing them, and results in a crash. (
https://github.com/llvm/llvm-project/pull/132079 )

Instead of fixing that issue, I am removing g/G from debugserver because
it's not needed by lldb, and it will would be easy for future bugs to
creep in to this packet that lldb should not use, but it can
accidentally fall back to and result in subtle bugs.

This does mean that a debugger using debugserver on darwin which doesn't
use QSaveRegisterState/QRestoreRegisterState will need to fall back to
reading & writing each register individually. I'm open to re-evaluating
this decision if this proves to be needed, and supporting these lldb
extensions is onerous.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list