...

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  // See the License for the specific language governing permissions and
    12  // limitations under the License.
    13  
    14  // +build !cgo
    15  
    16  package ptrace
    17  
    18  import (
    19  	"github.com/go-logr/logr"
    20  
    21  	"github.com/chaos-mesh/chaos-mesh/pkg/mapreader"
    22  )
    23  
    24  // RegisterLogger registers a logger on ptrace pkg
    25  func RegisterLogger(logger logr.Logger) {
    26  	panic("unimplemented")
    27  }
    28  
    29  // TracedProgram is a program traced by ptrace
    30  type TracedProgram struct {
    31  	Entries []mapreader.Entry
    32  }
    33  
    34  // Pid return the pid of traced program
    35  func (p *TracedProgram) Pid() int {
    36  	panic("unimplemented")
    37  }
    38  
    39  // Trace ptrace all threads of a process
    40  func Trace(pid int) (*TracedProgram, error) {
    41  	panic("unimplemented")
    42  }
    43  
    44  // Detach detaches from all threads of the processes
    45  func (p *TracedProgram) Detach() error {
    46  	panic("unimplemented")
    47  }
    48  
    49  // Protect will backup regs and rip into fields
    50  func (p *TracedProgram) Protect() error {
    51  	panic("unimplemented")
    52  }
    53  
    54  // Restore will restore regs and rip from fields
    55  func (p *TracedProgram) Restore() error {
    56  	panic("unimplemented")
    57  }
    58  
    59  // Wait waits until the process stops
    60  func (p *TracedProgram) Wait() error {
    61  	panic("unimplemented")
    62  }
    63  
    64  // Step moves one step forward
    65  func (p *TracedProgram) Step() error {
    66  	panic("unimplemented")
    67  }
    68  
    69  // Syscall runs a syscall at main thread of process
    70  func (p *TracedProgram) Syscall(number uint64, args ...uint64) (uint64, error) {
    71  	panic("unimplemented")
    72  }
    73  
    74  // Mmap runs mmap syscall
    75  func (p *TracedProgram) Mmap(length uint64, fd uint64) (uint64, error) {
    76  	panic("unimplemented")
    77  }
    78  
    79  // ReadSlice reads from addr and return a slice
    80  func (p *TracedProgram) ReadSlice(addr uint64, size uint64) (*[]byte, error) {
    81  	panic("unimplemented")
    82  }
    83  
    84  // WriteSlice writes a buffer into addr
    85  func (p *TracedProgram) WriteSlice(addr uint64, buffer []byte) error {
    86  	panic("unimplemented")
    87  }
    88  
    89  // PtraceWriteSlice uses ptrace rather than process_vm_write to write a buffer into addr
    90  func (p *TracedProgram) PtraceWriteSlice(addr uint64, buffer []byte) error {
    91  	panic("unimplemented")
    92  }
    93  
    94  // GetLibBuffer reads an entry
    95  func (p *TracedProgram) GetLibBuffer(entry *mapreader.Entry) (*[]byte, error) {
    96  	panic("unimplemented")
    97  }
    98  
    99  // MmapSlice mmaps a slice and return it's addr
   100  func (p *TracedProgram) MmapSlice(slice []byte) (*mapreader.Entry, error) {
   101  	panic("unimplemented")
   102  }
   103  
   104  // FindSymbolInEntry finds symbol in entry through parsing elf
   105  func (p *TracedProgram) FindSymbolInEntry(symbolName string, entry *mapreader.Entry) (uint64, error) {
   106  	panic("unimplemented")
   107  }
   108  
   109  // WriteUint64ToAddr writes uint64 to addr
   110  func (p *TracedProgram) WriteUint64ToAddr(addr uint64, value uint64) error {
   111  	panic("unimplemented")
   112  }
   113  
   114  // JumpToFakeFunc writes jmp instruction to jump to fake function
   115  func (p *TracedProgram) JumpToFakeFunc(originAddr uint64, targetAddr uint64) error {
   116  	panic("unimplemented")
   117  }
   118