...

Source file src/github.com/chaos-mesh/chaos-mesh/pkg/ptrace/ptrace_nocgo.go

Documentation: github.com/chaos-mesh/chaos-mesh/pkg/ptrace

     1  // Copyright 2021 Chaos Mesh Authors.
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  // http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  //
    15  //go:build !cgo
    16  
    17  package ptrace
    18  
    19  import (
    20  	"github.com/go-logr/logr"
    21  
    22  	"github.com/chaos-mesh/chaos-mesh/pkg/mapreader"
    23  )
    24  
    25  // RegisterLogger registers a logger on ptrace pkg
    26  func RegisterLogger(logger logr.Logger) {
    27  	panic("unimplemented")
    28  }
    29  
    30  // TracedProgram is a program traced by ptrace
    31  type TracedProgram struct {
    32  	Entries []mapreader.Entry
    33  }
    34  
    35  // Pid return the pid of traced program
    36  func (p *TracedProgram) Pid() int {
    37  	panic("unimplemented")
    38  }
    39  
    40  // Trace ptrace all threads of a process
    41  func Trace(pid int) (*TracedProgram, error) {
    42  	panic("unimplemented")
    43  }
    44  
    45  // Detach detaches from all threads of the processes
    46  func (p *TracedProgram) Detach() error {
    47  	panic("unimplemented")
    48  }
    49  
    50  // Protect will backup regs and rip into fields
    51  func (p *TracedProgram) Protect() error {
    52  	panic("unimplemented")
    53  }
    54  
    55  // Restore will restore regs and rip from fields
    56  func (p *TracedProgram) Restore() error {
    57  	panic("unimplemented")
    58  }
    59  
    60  // Wait waits until the process stops
    61  func (p *TracedProgram) Wait() error {
    62  	panic("unimplemented")
    63  }
    64  
    65  // Step moves one step forward
    66  func (p *TracedProgram) Step() error {
    67  	panic("unimplemented")
    68  }
    69  
    70  // Syscall runs a syscall at main thread of process
    71  func (p *TracedProgram) Syscall(number uint64, args ...uint64) (uint64, error) {
    72  	panic("unimplemented")
    73  }
    74  
    75  // Mmap runs mmap syscall
    76  func (p *TracedProgram) Mmap(length uint64, fd uint64) (uint64, error) {
    77  	panic("unimplemented")
    78  }
    79  
    80  // ReadSlice reads from addr and return a slice
    81  func (p *TracedProgram) ReadSlice(addr uint64, size uint64) (*[]byte, error) {
    82  	panic("unimplemented")
    83  }
    84  
    85  // WriteSlice writes a buffer into addr
    86  func (p *TracedProgram) WriteSlice(addr uint64, buffer []byte) error {
    87  	panic("unimplemented")
    88  }
    89  
    90  // PtraceWriteSlice uses ptrace rather than process_vm_write to write a buffer into addr
    91  func (p *TracedProgram) PtraceWriteSlice(addr uint64, buffer []byte) error {
    92  	panic("unimplemented")
    93  }
    94  
    95  // GetLibBuffer reads an entry
    96  func (p *TracedProgram) GetLibBuffer(entry *mapreader.Entry) (*[]byte, error) {
    97  	panic("unimplemented")
    98  }
    99  
   100  // MmapSlice mmaps a slice and return it's addr
   101  func (p *TracedProgram) MmapSlice(slice []byte) (*mapreader.Entry, error) {
   102  	panic("unimplemented")
   103  }
   104  
   105  // FindSymbolInEntry finds symbol in entry through parsing elf
   106  func (p *TracedProgram) FindSymbolInEntry(symbolName string, entry *mapreader.Entry) (uint64, error) {
   107  	panic("unimplemented")
   108  }
   109  
   110  // WriteUint64ToAddr writes uint64 to addr
   111  func (p *TracedProgram) WriteUint64ToAddr(addr uint64, value uint64) error {
   112  	panic("unimplemented")
   113  }
   114  
   115  // JumpToFakeFunc writes jmp instruction to jump to fake function
   116  func (p *TracedProgram) JumpToFakeFunc(originAddr uint64, targetAddr uint64) error {
   117  	panic("unimplemented")
   118  }
   119