[padb] r435 committed - When attaching to a process try the correct -target-attach first...

padb at googlecode.com padb at googlecode.com
Wed Mar 30 21:13:14 BST 2011


Revision: 435
Author:   apittman at gmail.com
Date:     Wed Mar 30 13:12:35 2011
Log:      When attaching to a process try the correct -target-attach first
and if that does not work back off to plain attach.

http://code.google.com/p/padb/source/detail?r=435

Modified:
  /trunk/src/padb

=======================================
--- /trunk/src/padb	Wed Mar 30 12:48:12 2011
+++ /trunk/src/padb	Wed Mar 30 13:12:35 2011
@@ -6177,7 +6177,11 @@
      }

      send_cont_signal($pid);
-    my %p = gdb_n_send( $gdb, "attach $pid" );
+    my %p = gdb_n_send( $gdb, "-target-attach $pid" );
+
+    if ( not defined $p{status} or $p{status} eq 'error' ) {
+        %p = gdb_n_send( $gdb, "attach $pid" );
+    }

      if ( not defined $p{status} ) {
          $gdb->{error} = 'Failed to attach to process';
@@ -6249,7 +6253,7 @@

      send_cont_signal($pid);

-    _gdb_send_real_async_start( $gdb, "attach $pid" );
+    _gdb_send_real_async_start( $gdb, "-target-attach $pid" );

      return;
  }
@@ -6257,8 +6261,11 @@
  sub gdb_attach_async_end {
      my ( $gdb, $pid ) = @_;

-    my %p = _gdb_send_real_async_wait( $gdb, "attach $pid" );
-
+    my %p = _gdb_send_real_async_wait( $gdb, "-target-attach $pid" );
+
+    if ( not defined $p{status} or $p{status} eq 'error' ) {
+        %p = gdb_n_send( $gdb, "attach $pid" );
+    }
      if ( not defined $p{status} ) {
          $gdb->{error} = 'Failed to attach to process';
          if ( not find_exe('gdb') ) {




More information about the padb-devel mailing list