AnyEvent-GDB

 view release on metacpan or  search on metacpan

GDB.pm  view on Meta::CPAN

This module is an L<AnyEvent> user, you need to make sure that you use and
run a supported event loop.

It implements the GDB MI protocol, which can be used to talk to GDB
without having to parse the ever changing command syntax aimed at humans.

It properly quotes your commands and parses the data structures returned
by GDB.

At the moment, it's in an early stage of development, so expect changes,
and, over time, further features (such as breakpoint-specific callbacks
and so on).

=head1 EXAMPLE PROGRAM

To get you started, here is an example program that runs F</bin/ls>,
displaying the stopped information when hitting a breakpoint on C<_exit>:

   use Data::Dump;
   use AnyEvent::GDB;

GDB.pm  view on Meta::CPAN

   $self->cmd_raw ($cmd, $cb);
}

=item ($results, $console) = $gdb->cmd_sync ($command => [$option...], $parameter...])
=item $results = $gdb->cmd_sync ($command => [$option...], $parameter...])

Like C<cmd>, but blocks execution until the command has been executed, and
returns the results if sucessful. Croaks when GDB returns with an error.

This is purely a convenience method for small scripts: since it blocks
execution using a condvar, it is not suitable to be used inside callbacks
or modules.

That is, unless L<Coro> is used - with Coro, you can run multiple
C<cmd_sync> methods concurrently form multiple threads, with no issues.

=cut

sub cmd_sync {
   push @_, my $cv = AE::cv;
   &cmd;

GDB.pm  view on Meta::CPAN

=item on_EVENTNAME method on the GDB object

Again, mainly useful when subclassing.

=item on_EVENTNAME constructor parameter/object member

Any callback specified as C<on_EVENTNAME> parameter to the constructor.

=back

You can change callbacks dynamically by simply replacing the corresponding
C<on_XXX> member in the C<$gdb> object:

   $gdb->{on_event} = sub {
      # new event handler
   };

Here's the list of events with a description of their arguments.

=over 4

README  view on Meta::CPAN

    run a supported event loop.

    It implements the GDB MI protocol, which can be used to talk to GDB
    without having to parse the ever changing command syntax aimed at
    humans.

    It properly quotes your commands and parses the data structures returned
    by GDB.

    At the moment, it's in an early stage of development, so expect changes,
    and, over time, further features (such as breakpoint-specific callbacks
    and so on).

EXAMPLE PROGRAM
    To get you started, here is an example program that runs /bin/ls,
    displaying the stopped information when hitting a breakpoint on "_exit":

       use Data::Dump;
       use AnyEvent::GDB;

       our $gdb = new AnyEvent::GDB

README  view on Meta::CPAN


    ($results, $console) = $gdb->cmd_sync ($command => [$option...],
    $parameter...]) =item $results = $gdb->cmd_sync ($command =>
    [$option...], $parameter...])
        Like "cmd", but blocks execution until the command has been
        executed, and returns the results if sucessful. Croaks when GDB
        returns with an error.

        This is purely a convenience method for small scripts: since it
        blocks execution using a condvar, it is not suitable to be used
        inside callbacks or modules.

        That is, unless Coro is used - with Coro, you can run multiple
        "cmd_sync" methods concurrently form multiple threads, with no
        issues.

  EVENTS
    AnyEvent::GDB is asynchronous in nature, as the goal of the MI interface
    is to be fully asynchronous. Due to this, a user of this interface must
    be prepared to handle various events.

README  view on Meta::CPAN

    on_event constructor parameter/object member
        The callback specified as "on_event" parameter to the constructor.

    on_EVENTNAME method on the GDB object
        Again, mainly useful when subclassing.

    on_EVENTNAME constructor parameter/object member
        Any callback specified as "on_EVENTNAME" parameter to the
        constructor.

    You can change callbacks dynamically by simply replacing the
    corresponding "on_XXX" member in the $gdb object:

       $gdb->{on_event} = sub {
          # new event handler
       };

    Here's the list of events with a description of their arguments.

    on_eof => $cb->($gdb, "eof")
        Called whenever GDB closes the connection. After this event, the



( run in 0.516 second using v1.01-cache-2.11-cpan-d6f9594c0a5 )