python - ptrace single step followed by set breakpoint fails -


I have a debugger code using python ptrace To restore,

  • do one step, Li> set the breakpoint again,
  • Continue execution.

    On my system, immediately after step 2 ( single step ) step 3 ( createBreakpoint ), then with error message Something is wrong:

      ptrace.error.PtraceError: ptrace (cmd = 4, .. error # 3: no such process   

    but If I add a delay (in the code below using the sys.readline ), all the steps and the debugged program are executed successfully.

    It is quite possible , Error for ptrace module Ishisht No, I was not the right approach recognizes welcome any help.

    Python code:

      import sys import ptrace.debugger.child import ptrace. debugger.debugger pid = ptrace.debugger.child.createChild ([ './sleeper'], 0) dbg = ptrace.debugger.debugger.PtraceDebugger () procedure = dbg.addProcess (pid, is_attached = 1) # # "# movel use "address gdb to" Disaimbl Men "- instructions between the two" calls "sPP = process. Biaarpeepi (0x08048432) process.cont () event = process.waitEvent () print (" the incidence of new process :% S "% Event) bp.desinstall (set_ip) = 1) # 1: # Otherwise the accident if breakpoint processing. Print "Press any key to continue ... 'sys.stdin.readline () bp = process.createBreakpoint (bp.address) Keep print (" process continues execution ") process.cont ()  < / Pre> 

    C code:

      #include & lt; Stdio.h & gt; Int main () {printf ("~~~~~~~~~~~~> before breakpoint \ n"); // breakpoints printf ("~~~~~~~~~~~~> after breakpoint \ n"); Return 0; } 

    Tronsd Trres Re: PTRACE_CONT, but to prevent the trace on coming or entries from a system call or after the execution of a command system, respectively. (Trace will also, in general, be stopped at the receipt of a signal.) From the trailer perspective, Tracey will be closed by the receipt of a SIGTRAP . So, for example, to PTRACE_SYSCALL, it should be inspected arguments for system calls on the idea that the first call, then a second to inspect the return value of PTRACE_SYSCALL and call system on another call. Data logic is considered for PTRACE_CONT

      process.singleStep () event = process. WaitEvent () # repair-line bp = process.createBreakpoint (bp.address)    

  • Comments

    Popular posts from this blog

    java - ImportError: No module named py4j.java_gateway -

    python - Receiving "KeyError" after decoding json result from url -

    .net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -