[all-commits] [llvm/llvm-project] 6bb123: [lldb] Modernize PseudoTerminal::OpenFirstAvailabl...

Pavel Labath via All-commits all-commits at lists.llvm.org
Wed Oct 14 06:02:38 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 6bb123b819c61c61197ec2ba54ceb6d16e9121cf
      https://github.com/llvm/llvm-project/commit/6bb123b819c61c61197ec2ba54ceb6d16e9121cf
  Author: Pavel Labath <pavel at labath.sk>
  Date:   2020-10-14 (Wed, 14 Oct 2020)

  Changed paths:
    M lldb/include/lldb/Host/PseudoTerminal.h
    M lldb/source/Host/common/ProcessLaunchInfo.cpp
    M lldb/source/Host/common/PseudoTerminal.cpp
    M lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
    M lldb/unittests/Editline/CMakeLists.txt
    M lldb/unittests/Editline/EditlineTest.cpp
    M lldb/unittests/Host/MainLoopTest.cpp

  Log Message:
  -----------
  [lldb] Modernize PseudoTerminal::OpenFirstAvailablePrimary

replace char*+length combo with llvm::Error


  Commit: 2c4226f8ac2c925d7e1d59d1de1660cd1dd63f31
      https://github.com/llvm/llvm-project/commit/2c4226f8ac2c925d7e1d59d1de1660cd1dd63f31
  Author: Pavel Labath <pavel at labath.sk>
  Date:   2020-10-14 (Wed, 14 Oct 2020)

  Changed paths:
    M lldb/include/lldb/Host/common/NativeProcessProtocol.h
    M lldb/source/Plugins/Process/FreeBSDRemote/NativeProcessFreeBSD.cpp
    M lldb/source/Plugins/Process/FreeBSDRemote/NativeProcessFreeBSD.h
    M lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
    M lldb/source/Plugins/Process/Linux/NativeProcessLinux.h
    M lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux.h
    M lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp
    M lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.h
    M lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
    M lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.h
    M lldb/source/Plugins/Process/Windows/Common/NativeProcessWindows.cpp
    M lldb/source/Plugins/Process/Windows/Common/NativeProcessWindows.h
    M lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
    M lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h
    M lldb/test/API/lang/c/stepping/TestStepAndBreakpoints.py
    A lldb/test/API/tools/lldb-server/memory-allocation/Makefile
    A lldb/test/API/tools/lldb-server/memory-allocation/TestGdbRemoteMemoryAllocation.py
    A lldb/test/API/tools/lldb-server/memory-allocation/main.c
    A lldb/test/Shell/Expr/nodefaultlib.cpp
    M lldb/unittests/TestingSupport/Host/NativeProcessTestUtils.h

  Log Message:
  -----------
  [lldb-server][linux] Add ability to allocate memory

This patch adds support for the _M and _m gdb-remote packets, which
(de)allocate memory in the inferior. This works by "injecting" a
m(un)map syscall into the inferior. This consists of:
- finding an executable page of memory
- writing the syscall opcode to it
- setting up registers according to the os syscall convention
- single stepping over the syscall

The advantage of this approach over calling the mmap function is that
this works even in case the mmap function is buggy or unavailable. The
disadvantage is it is more platform-dependent, which is why this patch
only works on X86 (_32 and _64) right now. Adding support for other
linux architectures should be easy and consist of defining the
appropriate syscall constants. Adding support for other OSes depends on
the its ability to do a similar trick.

Differential Revision: https://reviews.llvm.org/D89124


Compare: https://github.com/llvm/llvm-project/compare/cde06f783ce9...2c4226f8ac2c


More information about the All-commits mailing list