Results 1 to 3 of 3

Thread: GNU debugger for freepascal IDE

  1. #1

    GNU debugger for freepascal IDE

    Ok, let's talk about how to implement a gdb interface for a pascal IDE (like dev-pas) :mrgreen:

    First, the things we need:

    - Running and stopping the program
    - Breakpoints and eventually watchpoint and catchpoint
    - Variable watch
    - Step into & step over
    - Modify variable at runtime
    - Stack trace
    - MultiThread support (maybe ?)

    Now, interfacing gdb can be done in two way: using the libgdb API or running it and capturing/parsing the output.
    I'm for the second option, since there's really few libgdb docs around.
    There are also command line option that can help the parsing (ie -f). It is not that hard anyway, output is always clearly formatted.

    Basically, we should define a class that implements methods for every possible action (not that many), and methods for quering current status.
    If you save your data in a proprietary format, the owner of the format owns your data.
    <br /><A href="http://msx80.blogspot.com">http://msx80.blogspot.com</A>

  2. #2

    Re: GNU debugger for freepascal IDE

    Here a possible minimal interface:

    Start() start the program in debug mode
    Stop() stops it
    StepOver() execute the next instruction, eventually returning new current file/linenum
    StepInto() jumps in current function, eventually returning new current file/linenum
    SetBreakpoint (file, linenum) set a breakpoint
    Evaluate(expression) :string
    GetStackTrace() obtain the stack trace, as an array of something like [procedure, file, line].
    Status() return the current status, running, paused, stopped

    Each of this method basically sends a single command to gdb, and eventually capture the command output.
    This should not be that hard to do.

    The IDE should interface with it and display obtained data. Also, it should deal with locating file/linenum when requested (ie after a step operation, or at a breakpoint stop).
    If you save your data in a proprietary format, the owner of the format owns your data.
    <br /><A href="http://msx80.blogspot.com">http://msx80.blogspot.com</A>

  3. #3
    Anonymous
    Guest

    Re: GNU debugger for freepascal IDE

    Quote Originally Posted by {MSX}

    Now, interfacing gdb can be done in two way: using the libgdb API or running
    OTOH libgdb is technically superior, and there already is an example and interface, the (textmode) FPC ide in fpc/ide and the libgdbinterface in fpc/packages/base/gdbint

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •