File Coverage

blib/lib/AnyEvent/GDB.pm
Criterion Covered Total %
statement 18 188 9.5
branch 0 90 0.0
condition 0 13 0.0
subroutine 6 35 17.1
pod 4 20 20.0
total 28 346 8.0


line stmt bran cond sub pod time code
1             =head1 NAME
2              
3             AnyEvent::GDB - asynchronous GDB machine interface interface
4              
5             =head1 SYNOPSIS
6              
7             use AnyEvent::GDB;
8              
9             =head1 DESCRIPTION
10              
11             This module is an L user, you need to make sure that you use and
12             run a supported event loop.
13              
14             It implements the GDB MI protocol, which can be used to talk to GDB
15             without having to parse the ever changing command syntax aimed at humans.
16              
17             It properly quotes your commands and parses the data structures returned
18             by GDB.
19              
20             At the moment, it's in an early stage of development, so expect changes,
21             and, over time, further features (such as breakpoint-specific callbacks
22             and so on).
23              
24             =head1 EXAMPLE PROGRAM
25              
26             To get you started, here is an example program that runs F,
27             displaying the stopped information when hitting a breakpoint on C<_exit>:
28              
29             use Data::Dump;
30             use AnyEvent::GDB;
31              
32             our $gdb = new AnyEvent::GDB
33             trace => 1,
34             on_exec_stopped => sub {
35             ddx $_[0];
36             },
37             ;
38              
39             my $done
40              
41             ddx $gdb->cmd_sync (file_exec_and_symbols => "/bin/ls");
42             ddx $gdb->cmd_sync (break_insert => "_exit");
43             ddx $gdb->cmd_sync ("exec_run");
44              
45             AE::cv->recv;
46              
47             =head2 PROTOCOL QUIRKS
48              
49             =head3 Minus vs. underscores
50              
51             The MI protocol uses C<-> to separate name components, while in Perl, you
52             use C<_> for this purpose.
53              
54             This module usually accepts either form as input, and always converts
55             names with C<-> to names with C<_>, so the C notify might
56             become C, and the C result in that event
57             is stored in the C hash element in Perl.
58              
59             =head3 Output redirection
60              
61             Unfortunately, GDB has no (portable) provision to separate GDB
62             input/output from program input/output. Obviously, without a distinction
63             between program I/O and GDB I/O it becomes impossible to safely control
64             GDB.
65              
66             There are two ways for you around it: redirect stdin/stdout yourself, or
67             set a tty (eg. with the C command).
68              
69             Unfortunately, the MI interface does not seem to support any kind
70             of I/O redirection, so this module helps you a bit, by setting the
71             C variable with a console C commmand. That is, this
72             module does soeQmthing like the following for you, providing proper file
73             descriptors for your actual stdin and stdout:
74              
75             set exec-wrapper <&5 >&6
76              
77             The actual I/O redirection operators are also stored in C<< $gdb->{stdio}
78             >>, so you can even do it yourself, e.g. when providing your own wrapper:
79              
80             $self->cmd_raw ("set exec-wrapper $self->{stdio}", sub { });
81              
82             (You need to use a raw command, as the "correct" C MI command
83             silently ignores any C setting).
84              
85             =cut
86              
87             package AnyEvent::GDB;
88              
89 1     1   2879 use common::sense;
  1         15  
  1         8  
90              
91 1     1   142 use Carp ();
  1         3  
  1         24  
92 1     1   8 use Fcntl ();
  1         8  
  1         83  
93 1     1   8 use Scalar::Util ();
  1         3  
  1         23  
94              
95 1     1   3140 use AnyEvent ();
  1         6025  
  1         22  
96 1     1   790 use AnyEvent::Util ();
  1         14026  
  1         3943  
97              
98             our $VERSION = '0.2';
99              
100             =head2 METHODS
101              
102             =over 4
103              
104             =item $gdb = new AnyEvent::GDB key => value...
105              
106             Create a new GDB object using the given named parameters.
107              
108             For initial experiments, it is highly recommended to run with tracing or
109             at least C enabled. And don't forget to provide an C
110             callback.
111              
112             my $gdb = new AnyEvent::GDB
113             on_eof => sub {
114             print "We are done.\n";
115             },
116             trace => 1; # or verbose => 1, for less output
117              
118             =over 4
119              
120             =item exec => $path (default: "gdb")
121              
122             The path of the GDB executable.
123              
124             =item args => [$string...] (default: ["-n"])
125              
126             An optional array of parameters to pass to GDB. This should not be
127             used to load a program executable, use the C,
128             C or similar MI commands instead.
129              
130             =item trace => $boolean (default: 0)
131              
132             If true, then all commands sent to GDB are printed to STDOUT prefixed with
133             "> ", and all replies received from GDB are printed to STDOUT prefixed
134             with "< ".
135              
136             =item verbose => $boolean (default: true if trace is enabled, false otherwise)
137              
138             If true, then log output and possibly other information is printed to
139             STDOUT.
140              
141             =item on_xxxx => $callback->(...)
142              
143             This specifies a callback for a specific event - see the L section
144             later in this document.
145              
146             =back
147              
148             =cut
149              
150             sub new {
151 0     0 1   my ($class, %arg) = @_;
152              
153 0           my $self = bless {
154             %arg,
155             }, $class;
156              
157 0   0       my $exe = delete $self->{exec} // "gdb";
158 0   0       my $arg = delete $self->{args} // [qw(-n)];
159              
160 0 0 0       $self->{verbose} = 1
161             if $self->{trace} && !exists $self->{verbose};
162              
163 0           ($self->{fh}, my $fh2) = AnyEvent::Util::portable_socketpair;
164              
165 0           $self->{pid} = fork;
166              
167 0           open my $stdin , "<&STDIN" ;
168 0           open my $stdout, ">&STDOUT";
169              
170 0 0         unless ($self->{pid}) {
171 0 0         if (defined $self->{pid}) {
172 0           open STDIN , "<&", $fh2;
173 0           open STDOUT, ">&", $fh2;
174 0           fcntl $stdin , Fcntl::F_SETFD, 0;
175 0           fcntl $stdout, Fcntl::F_SETFD, 0;
176 0           exec $exe, qw(--interpreter=mi2 -q), @$arg;
177 0           kill 9, 0; # don't want to load the POSIX module just for this
178             } else {
179 0           Carp::croak "cannot fork: $!";
180             }
181             }
182              
183 0           AnyEvent::Util::fh_nonblocking $self->{fh}, 1;
184              
185             {
186 0           Scalar::Util::weaken (my $self = $self);
  0            
187             $self->{rw} = AE::io $self->{fh}, 0, sub {
188 0     0     my $len = sysread $self->{fh}, $self->{rbuf}, 256, length $self->{rbuf};
189              
190 0 0         defined $len || $self->eof;
191              
192 0           $self->feed ("$1")
193             while $self->{rbuf} =~ s/^([^\r\n]*)\r?\n//;
194 0           };
195              
196             $self->{wcb} = sub {
197 0     0     my $len = syswrite $self->{fh}, $self->{wbuf};
198 0           substr $self->{wbuf}, 0, $len, "";
199 0 0         delete $self->{ww} unless length $self->{wbuf};
200 0           };
201             }
202              
203 0           $self->{stdio} = sprintf "<&%d >&%d", fileno $stdin, fileno $stdout;
204              
205 0     0     $self->cmd_raw ("set exec-wrapper $self->{stdio}", sub { });
  0            
206              
207 0           $self
208             }
209              
210             #sub DESTROY {
211             #)}
212              
213             sub eof {
214 0     0 0   my ($self) = @_;
215              
216 0           $self->event ("eof");
217              
218 0           %$self = ();
219             }
220              
221             sub send {
222 0     0 0   my ($self, $data) = @_;
223              
224 0 0         print "> $data"
225             if $self->{trace};
226              
227 0           $self->{wbuf} .= $data;
228 0   0       $self->{ww} ||= AE::io $self->{fh}, 1, $self->{wcb};
229             }
230              
231             our %C_ESCAPE = (
232             "\\" => "\\",
233             '"' => '"',
234             "'" => "'",
235             "?" => "?",
236              
237             a => "\x07",
238             b => "\x08",
239             t => "\x09",
240             n => "\x0a",
241             v => "\x0b",
242             f => "\x0c",
243             r => "\x0d",
244             );
245              
246             sub _parse_c_string {
247 0     0     my $r = "";
248              
249             # syntax is not documented, so we do full C99, except unicode
250              
251 0           while () {
252 0 0         if (/\G([^"\\\n]+)/gc) {
    0          
    0          
    0          
    0          
253 0           $r .= $1;
254             } elsif (/\G\\([abtnvfr\\"'?])/gc) {
255 0           $r .= $C_ESCAPE{$1};
256             } elsif (/\G\\([0-8]{1,3})/gc) {
257 0           $r .= chr oct $1;
258             } elsif (/\G\\x([0-9a-fA-F]+)/gc) {
259 0           $r .= chr hex $1;
260             } elsif (/\G"/gc) {
261 0           last;
262             } else {
263 0           die "invalid string syntax\n";
264             }
265             }
266              
267             $r
268 0           }
269              
270             sub _parse_value {
271 0 0   0     if (/\G"/gc) { # c-string
    0          
    0          
272 0           &_parse_c_string
273              
274             } elsif (/\G\{/gc) { # tuple
275 0           my $r = &_parse_results;
276              
277 0 0         /\G\}/gc
278             or die "tuple does not end with '}'\n";
279              
280 0           $r
281            
282             } elsif (/\G\[/gc) { # list
283 0           my @r;
284              
285 0           until (/\G\]/gc) {
286             # if GDB outputs "result" in lists, let me know and uncomment the following lines
287             # # list might also contain key value pairs, but apparently
288             # # those are supposed to be ordered, so we use an array in perl.
289             # push @r, $1
290             # if /\G([^=,\[\]\{\}]+)=/gc;
291              
292 0           push @r, &_parse_value;
293              
294 0 0         /\G,/gc
295             or last;
296             }
297              
298             /\G\]/gc
299 0 0         or die "list does not end with ']'\n";
300              
301             \@r
302              
303 0           } else {
304 0           die "value expected\n";
305             }
306             }
307              
308             sub _parse_results {
309 0     0     my %r;
310              
311             # syntax for string is undocumented
312 0           while (/\G([^=,\[\]\{\}]+)=/gc) {
313 0           my $k = $1;
314              
315 0           $k =~ y/-/_/;
316              
317 0           $r{$k} = &_parse_value;
318              
319 0 0         /\G,/gc
320             or last;
321             }
322              
323 0           \%r
324             }
325              
326             my %type_map = qw(
327             * exec
328             + status
329             = notify
330             );
331              
332             sub feed {
333 0     0 0   my ($self, $line) = @_;
334              
335 0 0         print "< $line\n"
336             if $self->{trace};
337              
338 0           for ($line) {
339 0 0         if (/^\(gdb\)\s*$/gc) { # docs say "(gdb)", but reality says "(gdb) "
340             # nop
341             } else {
342 0           /^([0-9]*)/gc; # [token], actually ([0-9]+)?
343 0           my $token = $1;
344              
345 0           eval {
346 0 0         if (/\G\^(done|running|connected|error|exit)/gc) { # result
    0          
    0          
    0          
    0          
347 0 0         my $class = $1 eq "running" ? "done" : $1;
348             # documented for error is an incompatible format, but in reality it is sane
349              
350 0 0         my $results = /\G,/gc ? &_parse_results : {};
351              
352 0 0         if (my $cb = delete $self->{cb}{$token}) {
353             # unfortunately, gdb sometimes outputs multiple result records for one command
354 0           $cb->($class, $results, delete $self->{console});
355             }
356              
357             } elsif (/\G([*+=])([^,]+)/gc) { # *exec-async, +status-async, =notify-async
358 0           my ($type, $class) = ($type_map{$1}, $2);
359              
360 0 0         my $results = /\G,/gc ? &_parse_results : {};
361              
362 0           $class =~ y/-/_/;
363              
364 0           $self->event ($type => $class, $results);
365 0           $self->event ("$type\_$class" => $results);
366              
367             } elsif (/\G~"/gc) {
368 0           push @{ $self->{console} }, &_parse_c_string;
  0            
369             } elsif (/\G&"/gc) {
370 0           my $log = &_parse_c_string;
371 0           chomp $log;
372 0 0         print "$log\n" if $self->{verbose};
373 0           $self->event (log => $log);
374             } elsif (/\G\@"/gc) {
375 0           $self->event (target => &_parse_c_string);
376             }
377             };
378              
379 0           /\G(.{0,16})/gcs;
380 0 0 0       $@ = "extra data\n" if !$@ and length $1;
381              
382 0 0         if ($@) {
383 0           chop $@;
384 0           warn "AnyEvent::GDB: parse error: $@, at ...$1\n";
385 0           $self->eof;
386             }
387             }
388             }
389             }
390              
391             sub _q($) {
392 0 0   0     return $_[0]
393             if $_[0] =~ /^[A-Za-z0-9_]+$/; # we are a lot more strict than the spec
394              
395 0           local $_ = shift;
396 0           utf8::encode $_; # just in case
397 0           s/([^\x20-\x21\x23-\x5b\x5d-\x7e])/sprintf "\\x%02x", ord $1/ge;
  0            
398 0           "\"$_\""
399             }
400              
401             =item $gdb->cmd_raw ($command, $cb->($class, $results, $console))
402              
403             Execute a raw command: C<$command> is sent unchanged to GDB. See C
404             for a description of the callback arguments.
405              
406             Example: execute a CLI command and print its output.
407              
408             $gdb->cmd_raw ("info sh", sub {
409             print "$_[3]\n";
410             });
411              
412             =cut
413              
414             sub cmd_raw {
415 0     0 1   my ($self, $cmd, $cb) = @_;
416              
417 0           my $token = ++$self->{token};
418 0           $self->send ("$token$cmd\n");
419 0           $self->{cb}{$token} = $cb;
420             }
421              
422             =item $gdb->cmd ($command => [$option...], $parameter..., $cb->($class, $results, $console))
423              
424             Execute a MI command and invoke the callback with the results.
425              
426             C<$command> is a MI command name. The leading minus sign can be omitted,
427             and instead of minus signs, you can use underscores, i.e. all the
428             following command names are equivalent:
429              
430             "-break-insert" # as documented in the GDB manual
431             -break_insert # using underscores and _ to avoid having to quote
432             break_insert # ditto, when e.g. used to the left of a =>
433             "break-insert" # no leading minus
434              
435             The second argument is an optional array reference with options (i.e. it
436             can simply be missing). Each C<$option> is either an option name (similar
437             rules as with command names, i.e. no initial C<-->) or an array reference
438             with the first element being the option name, and the remaining elements
439             being parameters: [$option, $parameter...].
440              
441             The remaining arguments, excluding the last one, are simply the parameters
442             passed to GDB.
443              
444             All options and parameters will be properly quoted.
445              
446             When the command is done, the callback C<$cb> will be invoked with
447             C<$class> being one of C, C, C or C
448             (note: not C), C<$results> being a has reference with all the
449             C pairs from the result list.
450              
451             C<$console> is an array reference with all the GDB console messages
452             written while command executes (for MI commands, this should always be
453             C and can be ignored).
454              
455             Example: #todo#
456              
457             =cut
458              
459             sub cmd {
460 0     0 1   my $cb = pop;
461 0           my ($self, $cmd, @arg) = @_;
462              
463 0           $cmd =~ s/^[\-_]?/_/;
464 0           $cmd =~ y/_/-/;
465              
466 0           $cmd .= " ";
467              
468 0 0         my $opt = ref $arg[0] ? shift @arg : [];
469              
470 0           for (@$opt) {
471 0           $cmd .= "-";
472             $cmd .= (_q $_) . " "
473 0 0         for (ref) ? @$_ : $_;
474             }
475              
476             # the MI syntax is inconsistent, providing "--" in case
477             # parameters start with "-", but not allowing "-" as first
478             # char of a parameter. in fact, "--" is flagged as unknown
479             # option.
480 0 0         if (@arg) {
481             # $cmd .= "-- ";
482              
483             $cmd .= (_q $_) . " "
484 0           for @arg;
485             }
486              
487             # remove trailing " "
488 0           substr $cmd, -1, 1, "";
489              
490 0           $self->cmd_raw ($cmd, $cb);
491             }
492              
493             =item ($results, $console) = $gdb->cmd_sync ($command => [$option...], $parameter...])
494             =item $results = $gdb->cmd_sync ($command => [$option...], $parameter...])
495              
496             Like C, but blocks execution until the command has been executed, and
497             returns the results if sucessful. Croaks when GDB returns with an error.
498              
499             This is purely a convenience method for small scripts: since it blocks
500             execution using a condvar, it is not suitable to be used inside callbacks
501             or modules.
502              
503             That is, unless L is used - with Coro, you can run multiple
504             C methods concurrently form multiple threads, with no issues.
505              
506             =cut
507              
508             sub cmd_sync {
509 0     0 1   push @_, my $cv = AE::cv;
510 0           &cmd;
511              
512 0           my ($class, $results, $console) = $cv->recv;
513              
514 0 0         Carp::croak $results->{msg}
515             if $class eq "error";
516              
517 0 0         wantarray ? ($results, $console) : $results
518             }
519              
520             sub event {
521 0     0 0   my ($self, $event, @args) = @_;
522              
523             # if ($self->{verbose}) {
524             # use Data::Dumper;
525             # print Data::Dumper
526             # ->new ([[$event, @args]])
527             # ->Pair ("=>")
528             # ->Useqq (1)
529             # ->Indent (0)
530             # ->Terse (1)
531             # ->Quotekeys (0)
532             # ->Sortkeys (1)
533             # ->Dump,
534             # "\n";
535             # }
536              
537 0           my $cb;
538              
539 0 0         $cb = $self->can ("on_event") and $cb->($self, $event, @args);
540 0 0         $cb = $self-> {on_event} and $cb->($self, $event, @args);
541 0 0         $cb = $self->can ("on_$event") and $cb->($self, $event, @args);
542 0 0         $cb = $self-> {"on_$event"} and $cb->($self, $event, @args);
543             }
544              
545             # predefined events
546              
547             sub on_notify_thread_group_added {
548 0     0 0   my ($self, undef, $r) = @_;
549              
550 0           $self->{thread_group}{$r->{id}} = $r;
551             }
552              
553             sub on_notify_thread_group_removed {
554 0     0 0   my ($self, undef, $r) = @_;
555              
556 0           delete $self->{thread_group}{$r->{id}};
557             }
558              
559             sub on_notify_thread_group_started {
560 0     0 0   my ($self, undef, $r) = @_;
561              
562 0           delete $self->{thread_group}{exit_code};
563 0           $self->{thread_group}{$r->{id}}{pid} = $r->{pid};
564             }
565              
566             sub on_notify_thread_group_exited {
567 0     0 0   my ($self, undef, $r) = @_;
568              
569 0           delete $self->{thread_group}{pid};
570 0           $self->{thread_group}{$r->{id}}{exit_code} = $r->{exit_code};
571             }
572              
573             sub on_notify_record_started {
574 0     0 0   my ($self, undef, $r) = @_;
575              
576 0           $self->{thread_group}{$r->{id}}{recording} = 1;
577             }
578              
579             sub on_notify_record_stopped {
580 0     0 0   my ($self, undef, $r) = @_;
581              
582 0           $self->{thread_group}{$r->{id}}{recording} = 0;
583             }
584              
585             sub on_notify_thread_created {
586 0     0 0   my ($self, undef, $r) = @_;
587              
588 0           $self->{thread}{$r->{id}} = $r;
589             }
590              
591             sub on_notify_thread_exited {
592 0     0 0   my ($self, undef, $r) = @_;
593              
594 0           delete $self->{thread}{$r->{id}};
595             }
596              
597             sub _threads {
598 0     0     my ($self, $id) = @_;
599              
600 0           ref $id
601 0           ? @{ $self->{thread} }{@$id}
602             : $id eq "all"
603 0 0         ? values %{ $self->{thread} }
    0          
604             : $self->{thread}{$id}
605             }
606              
607             sub on_exec_running {
608 0     0 0   my ($self, undef, $r) = @_;
609              
610 0           for ($self->_threads ($r->{thread_id})) {
611 0           delete $_->{stopped};
612 0           $_->{running} = 1;
613             }
614             }
615              
616             sub on_exec_stopped {
617 0     0 0   my ($self, undef, $r) = @_;
618              
619 0           for ($self->_threads ($r->{stopped_threads})) {
620 0           delete $_->{running};
621 0           $_->{stopped} = $r;
622             }
623              
624             # $self->event ("thread_$r->{reason}" => $r, [map $_->{id}, $self->_threads ($r)]);
625             }
626              
627             sub _thread_groups {
628 0     0     my ($self, $r) = @_;
629              
630 0           exists $r->{thread_group}
631             ? $self->{thread_group}{$r->{thread_group}}
632 0 0         : values %{ $self->{thread_group} }
633             }
634              
635             sub on_notify_library_loaded {
636 0     0 0   my ($self, undef, $r) = @_;
637              
638             $_->{library}{$r->{id}} = $r
639 0           for $self->_thread_groups ($r);
640             }
641              
642             sub on_notify_library_unloaded {
643 0     0 0   my ($self, undef, $r) = @_;
644              
645             delete $_->{library}{$r->{id}}
646 0           for $self->_thread_groups ($r);
647             }
648              
649             =back
650              
651             =head2 EVENTS
652              
653             AnyEvent::GDB is asynchronous in nature, as the goal of the MI interface
654             is to be fully asynchronous. Due to this, a user of this interface must
655             be prepared to handle various events.
656              
657             When an event is produced, the GDB object will look for the following four
658             handlers and, if found, will call each one in order with the GDB object
659             and event name (without C) as the first two arguments, followed by
660             any event-specific arguments:
661              
662             =over 4
663              
664             =item on_event method on the GDB object
665              
666             Useful when subclassing.
667              
668             =item on_event constructor parameter/object member
669              
670             The callback specified as C parameter to the constructor.
671              
672             =item on_EVENTNAME method on the GDB object
673              
674             Again, mainly useful when subclassing.
675              
676             =item on_EVENTNAME constructor parameter/object member
677              
678             Any callback specified as C parameter to the constructor.
679              
680             =back
681              
682             You can change callbacks dynamically by simply replacing the corresponding
683             C member in the C<$gdb> object:
684              
685             $gdb->{on_event} = sub {
686             # new event handler
687             };
688              
689             Here's the list of events with a description of their arguments.
690              
691             =over 4
692              
693             =item on_eof => $cb->($gdb, "eof")
694              
695             Called whenever GDB closes the connection. After this event, the object is
696             partially destroyed and must not be accessed again.
697              
698             =item on_target => $cb->($gdb, "target", $string)
699              
700             Output received from the target. Normally, this is sent directly to STDOUT
701             by GDB, but remote targets use this hook.
702              
703             =item on_log => $cb->($gdb, "log", $string)
704              
705             Log output from GDB. Best printed to STDOUT in interactive sessions.
706              
707             =item on_TYPE => $cb->($gdb, "TYPE", $class, $results)
708              
709             Called for GDB C, C and C event (TYPE is one of
710             these three strings). C<$class> is the class of the event, with C<->
711             replaced by C<_> everywhere.
712              
713             For each of these, the GDB object will create I events: one for TYPE,
714             and one for TYPE_CLASS. Usuaully you should provide the more specific
715             event (TYPE_CLASS).
716              
717             =item on_TYPE_CLASS => $cb->($gdb, "TYPE_CLASS", $results)
718              
719             Called for GDB C, C and C event: TYPE is one
720             of these three strings, the class of the event (with C<-> replaced b
721             C<_>s) is appended to it to form the TYPE_CLASS (e.g. C or
722             C).
723              
724             =back
725              
726             =head2 STATUS STORAGE
727              
728             The default implementations of the event method store the thread,
729             thread_group, recording, library and running status insid ethe C<$gdb>
730             object.
731              
732             You can access these at any time. Specifically, the following information
733             is available:
734              
735             =over 4
736              
737             =item C<< $gdb->{thread_group}{I} >>
738              
739             The C member stores a hash for each existing thread
740             group. The hash always contains the C member, but might also contain
741             other members.
742              
743             =item C<< $gdb->{thread_group}{I}{pid} >>
744              
745             The C member only exists while the thread group is running a program,
746             and contaisn the PID of the program.
747              
748             =item C<< $gdb->{thread_group}{I}{exit_code} >>
749              
750             The C member only exists after a program has finished
751             executing, and before it is started again, and contains the exit code of
752             the program.
753              
754             =item C<< $gdb->{thread_group}{I}{recording} >>
755              
756             The C member only exists if recording has been previously
757             started, and is C<1> if recoridng is currently active, and C<0> if it has
758             been stopped again.
759              
760             =item C<< $gdb->{thread}{I} >>
761              
762             The C member stores a hash for each existing thread. The hash
763             always contains the C member with the thread id, and the C
764             member with the corresponding thread group id.
765              
766             =item C<< $gdb->{thread}{I}{running} >>
767              
768             The C member is C<1> while the thread is, well, running, and is
769             missing otherwise.
770              
771             =item C<< $gdb->{thread}{I}{stopped} >>
772              
773             The C member contains the result list from the C
774             notification that caused the thread to stop, and only exists when the
775             thread is topped.
776              
777             =item C<< $gdb->{library}{I} >>
778              
779             The C member contains all results from the C
780             event (such as C, C, C and potentially a
781             C.
782              
783             =back
784              
785             =head1 SEE ALSO
786              
787             L, L.
788              
789             =head1 AUTHOR
790              
791             Marc Lehmann
792             http://home.schmorp.de/
793              
794             =cut
795              
796             1