[padb] r365 committed - Add a thread-list mode to show the user a list of threads that...
padb at googlecode.com
padb at googlecode.com
Mon Dec 21 20:22:00 GMT 2009
Revision: 365
Author: apittman
Date: Mon Dec 21 12:21:54 2009
Log: Add a thread-list mode to show the user a list of threads that
are running in the target process.
http://code.google.com/p/padb/source/detail?r=365
Modified:
/trunk/src/padb
=======================================
--- /trunk/src/padb Fri Dec 18 13:35:42 2009
+++ /trunk/src/padb Mon Dec 21 12:21:54 2009
@@ -50,6 +50,8 @@
# * Add a --lstopo option to run the lstopo command for each rank.
# http://www.open-mpi.org/projects/hwloc/
# * Add a 'command' mode to run abritary commands on the target node.
+# * Add a 'thread-list' mode to report a comma seperated list of threads
+# for each target process.
# * Enhance the integration with gdb, use sequence numbers when
# talking to gdb and check that we get back what we give it.
# Correctly notice and raise an appropriate error if gdb dies
@@ -8010,6 +8012,33 @@
}
return;
}
+
+sub thread_list_from_pid {
+ my ( $carg, $proc ) = @_;
+
+ return unless defined $proc->{gdb_handle};
+
+ my $gdb = $proc->{gdb_handle};
+
+ my %result = gdb_n_send( $gdb, '-thread-list-ids' );
+ if ( $result{status} ne 'done' ) {
+ return;
+ }
+ my $data = gdb_parse_reason( $result{reason}, 'thread-ids' );
+ if ( not defined $data->{'thread-ids'} ) {
+ return;
+ }
+
+ my @threads;
+ foreach my $thread ( @{ $data->{'thread-ids'} } ) {
+ my $id = $thread->{'thread-id'};
+ push @threads, $id;
+ }
+
+ my $thread_list = join q{,}, sort { $a <=> $b } @threads;
+
+ output( $proc->{vp}, $thread_list );
+}
sub kill_proc {
my ( $cargs, $vp, $pid ) = @_;
@@ -9354,6 +9383,13 @@
}
};
+ $allfns{threads} = {
+ handler_one => \&thread_list_from_pid,
+ needs_gdb => 1,
+ arg_long => 'thread-list',
+ help => 'List threads in target processes',
+ };
+
$allfns{proc_summary} = {
handler_all => \&show_proc_all,
out_handler => \&show_proc_format,
More information about the padb-devel
mailing list