PikeDebugger

[ Start > PikeDevel > PikeDebugger ] [ Edit this Page | Viewing Version 5 ]


Work on permitting pike code to be debugged interactively is underway, and currently exists as a rough proof of concept in branch bill/debugger-concept. The debugger requires pike to be compiled with --with-debug and can be enabled using --debugger option to pike, with enables a hilfe server on port 3333

Current features of the POC:

- Multiple breakpoints may be set and cleared independently.

  • Hilfe interface
  • Backtrace viewing
  • Frame stack browsing (as part of backtrace frames)
  • View locals (but names are not resolved)
  • Modify locals
  • Single stepping
  • Continue

    Things that need to be done:

    - Local name calculation

  • Allow breakpoints to be set on programs not yet compiled (this probably requires support in the master)
  • Allow stepping state to be maintained for multiple threads
  • Pass current thread to debugger engine
  • A programmatic interface to the debugger
  • Related: should pike pause to wait for a debugger to connect for breakpoints, etc to be set?
  • Step-over, in, return, etc. These require understanding of code structure
  • Watchpoints?
  • Efficiency improvements?
  • Work to not require RTL debug
  • Make ports configurable

    Set breakpoint using this method:

// set a breakpoint at line 22 in the current program program p = this_program; object bp = Debug.Debugger.Breakpoint(p, "/path/to/file.pike", 22); bp->enable();

Example of a debugging session:

$ telnet localhost 3333
Trying ::1...
telnet: connect to address ::1: Connection refused
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Welcome to the Pike Debugger.
Breakpoint on /Users/hww3/bpt.h:2
> backtrace;
(1) Result: ({ /* 4 elements */
                backtrace_frame(/Users/hww3/pike2/build/darwin-16.7.0-x86_64/master.pike:4148, _main(), Args: 1),
                backtrace_frame(-:1, `()(), Args: 1),
                backtrace_frame(/Users/hww3/bpt.pike:14, doit(), No args),
                backtrace_frame(/Users/hww3/bpt.h:2, whee(), Args: 1)
            })
> backtrace[-1]->locals();
(4) Result: ({ /* 3 elements */
                "rad",
                0,
                0
            })
> backtrace[-1]->set_local(1, "bar");
(5) Result: 0
> backtrace[-1]->locals();
(6) Result: ({ /* 3 elements */
                "rad",
                "bar",
                0
            })
> step
Stepping.
Breakpoint on /Users/hww3/bpt.pike:22
> backtrace;
(1) Result: ({ /* 4 elements */
                backtrace_frame(/Users/hww3/pike2/build/darwin-16.7.0-x86_64/master.pike:4148, _main(), Args: 1),
                backtrace_frame(-:1, `()(), Args: 1),
                backtrace_frame(/Users/hww3/bpt.pike:14, doit(), No args),
                backtrace_frame(/Users/hww3/bpt.pike:22, whee(), Args: 1)
            })
> backtrace[-1]->locals();
(2) Result: ({ /* 3 elements */
                "rad",
                "bar",
                "wq"
            })
> go

Powered by PikeWiki2

 
gotpike.org | Copyright © 2004 - 2009 | Pike is a trademark of Department of Computer and Information Science, Linköping University