gdb/
authorPedro Alves <palves@redhat.com>
Wed, 15 Feb 2012 12:48:55 +0000 (12:48 +0000)
committerPedro Alves <palves@redhat.com>
Wed, 15 Feb 2012 12:48:55 +0000 (12:48 +0000)
2012-02-15  Pedro Alves  <palves@redhat.com>

* remote.c (remote_detach_1, extended_remote_attach_1): Tweak
output to be like native targets'.
(remote_pid_to_str): Special case the null ptid.

gdb/testsuite/
2012-02-15  Pedro Alves  <palves@redhat.com>

Support extended-remote.  Avoid cascading timeouts.

* gdb.base/attach.exp (do_attach_tests): Add expected output for
the extended-remote target.  If attaching with no file fails, load
the file manually.
* gdb.server/ext-attach.exp: Adjust expected attach/detach output.

gdb/ChangeLog
gdb/remote.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/attach.exp
gdb/testsuite/gdb.server/ext-attach.exp

index a8fb900f2392b1d9e6aafb2b2f454bf232f802d3..5462b5bfdd271ffd5b6d066a5b2db9a77fa97649 100644 (file)
@@ -1,3 +1,9 @@
+2012-02-15  Pedro Alves  <palves@redhat.com>
+
+       * remote.c (remote_detach_1, extended_remote_attach_1): Tweak
+       output to be like native targets'.
+       (remote_pid_to_str): Special case the null ptid.
+
 2012-02-14  Stan Shebs  <stan@codesourcery.com>
 
        * NEWS: Mention enable count command.
index 3187ac00328b6f4e9fc5a36daa047fe45d5fe141..14c343bed6fd6c210bcf85fb4cf254a20f0161cd 100644 (file)
@@ -4205,6 +4205,16 @@ remote_detach_1 (char *args, int from_tty, int extended)
   if (!target_has_execution)
     error (_("No process to detach from."));
 
+  if (from_tty)
+    {
+      char *exec_file = get_exec_file (0);
+      if (exec_file == NULL)
+       exec_file = "";
+      printf_unfiltered (_("Detaching from program: %s, %s\n"), exec_file,
+                        target_pid_to_str (pid_to_ptid (pid)));
+      gdb_flush (gdb_stdout);
+    }
+
   /* Tell the remote target to detach.  */
   if (remote_multi_process_p (rs))
     sprintf (rs->buf, "D;%x", pid);
@@ -4221,19 +4231,8 @@ remote_detach_1 (char *args, int from_tty, int extended)
   else
     error (_("Can't detach process."));
 
-  if (from_tty)
-    {
-      if (remote_multi_process_p (rs))
-       printf_filtered (_("Detached from remote %s.\n"),
-                        target_pid_to_str (pid_to_ptid (pid)));
-      else
-       {
-         if (extended)
-           puts_filtered (_("Detached from remote process.\n"));
-         else
-           puts_filtered (_("Ending remote debugging.\n"));
-       }
-    }
+  if (from_tty && !extended)
+    puts_filtered (_("Ending remote debugging.\n"));
 
   discard_pending_stop_replies (pid);
   target_mourn_inferior ();
@@ -4286,6 +4285,20 @@ extended_remote_attach_1 (struct target_ops *target, char *args, int from_tty)
   if (remote_protocol_packets[PACKET_vAttach].support == PACKET_DISABLE)
     error (_("This target does not support attaching to a process"));
 
+  if (from_tty)
+    {
+      char *exec_file = get_exec_file (0);
+
+      if (exec_file)
+       printf_unfiltered (_("Attaching to program: %s, %s\n"), exec_file,
+                          target_pid_to_str (pid_to_ptid (pid)));
+      else
+       printf_unfiltered (_("Attaching to %s\n"),
+                          target_pid_to_str (pid_to_ptid (pid)));
+
+      gdb_flush (gdb_stdout);
+    }
+
   sprintf (rs->buf, "vAttach;%x", pid);
   putpkt (rs->buf);
   getpkt (&rs->buf, &rs->buf_size, 0);
@@ -4293,10 +4306,6 @@ extended_remote_attach_1 (struct target_ops *target, char *args, int from_tty)
   if (packet_ok (rs->buf,
                 &remote_protocol_packets[PACKET_vAttach]) == PACKET_OK)
     {
-      if (from_tty)
-       printf_unfiltered (_("Attached to %s\n"),
-                          target_pid_to_str (pid_to_ptid (pid)));
-
       if (!non_stop)
        {
          /* Save the reply for later.  */
@@ -8823,7 +8832,9 @@ remote_pid_to_str (struct target_ops *ops, ptid_t ptid)
   static char buf[64];
   struct remote_state *rs = get_remote_state ();
 
-  if (ptid_is_pid (ptid))
+  if (ptid_equal (ptid, null_ptid))
+    return normal_pid_to_str (ptid);
+  else if (ptid_is_pid (ptid))
     {
       /* Printing an inferior target id.  */
 
index 463a6aeb8bcca0a8efa0e4667fee0aeb41064c7f..86da87fbf18db69925ec99e5a3cbb87539a4b88e 100644 (file)
@@ -1,3 +1,12 @@
+2012-02-15  Pedro Alves  <palves@redhat.com>
+
+       Support extended-remote.  Avoid cascading timeouts.
+
+       * gdb.base/attach.exp (do_attach_tests): Add expected output for
+       the extended-remote target.  If attaching with no file fails, load
+       the file manually.
+       * gdb.server/ext-attach.exp: Adjust expected attach/detach output.
+
 2012-02-14  Stan Shebs  <stan@codesourcery.com>
 
        * gdb.base/ena-dis-br.exp: Add enable count test.
index 87a22deab0742bc2b7335dbb45951e2d029007b1..ff1b6bc62f7aa5d161969985dc437f837bd6c2e0 100644 (file)
@@ -160,6 +160,10 @@ proc do_attach_tests {} {
            # Response expected on Cygwin
            pass "$test"
        }
+       -re "Attaching to.*, process $boguspid.*failed.*$gdb_prompt $" {
+           # Response expected on the extended-remote target.
+           pass "$test"
+       }
     }
     
     # Verify that we can attach to the process by first giving its
@@ -224,7 +228,8 @@ proc do_attach_tests {} {
     # Verify that we can attach to the process just by giving the
     # process ID.
    
-    set test "set file, before attach2"
+    set test "attach2, with no file"
+    set found_exec_file 0
     gdb_test_multiple "attach $testpid" "$test" {
        -re "Attaching to process $testpid.*Load new symbol table from \"$escapedbinfile\.exe\".*y or n. $" {
            # On Cygwin, the DLL's symbol tables are loaded prior to the
@@ -233,9 +238,25 @@ proc do_attach_tests {} {
            # executable.
            gdb_test "y" "Reading symbols from $escapedbinfile\.\.\.*done." \
                "$test (reset file)"
+
+           set found_exec_file 1
        }
        -re "Attaching to process $testpid.*Reading symbols from $escapedbinfile.*main.*at .*$gdb_prompt $" {
            pass "$test"
+           set found_exec_file 1
+       }
+    }
+
+    if {$found_exec_file == 0} {
+       set test "load file manually, after attach2"
+       gdb_test_multiple "file $binfile" "$test" {
+           -re "A program is being debugged already..*Are you sure you want to change the file.*y or n. $" {
+               gdb_test "y" "Reading symbols from $escapedbinfile\.\.\.*done." \
+                   "$test (re-read)"
+           }
+           -re "Reading symbols from $escapedbinfile\.\.\.*done.*$gdb_prompt $" {
+               pass "$test"
+           }
        }
     }
 
index edf08fd4c97b60e21a516cdf72033da9e665fc27..d9c7c0cdc7ad2579f6992437434744c5f7c0c55b 100644 (file)
@@ -57,14 +57,16 @@ if { [istarget "*-*-cygwin*"] } {
     set testpid [ exec ps -e | gawk "{ if (\$1 == $testpid) print \$4; }" ]
 }
 
-gdb_test "attach $testpid" "Attached to.*" \
+gdb_test "attach $testpid" \
+    "Attaching to program: .*, process $testpid.*(in|at).*" \
     "attach to remote program 1"
 gdb_test "backtrace" ".*main.*" "backtrace 1"
 
-gdb_test "detach" "Detached from remote process.*\\."
+gdb_test "detach" "Detaching from program.*process.*"
 gdb_test "backtrace" "No stack\\." "backtrace with no program"
 
-gdb_test "attach $testpid" "Attached to.*" \
+gdb_test "attach $testpid" \
+    "Attaching to program: .*, process $testpid.*(in|at).*" \
     "attach to remote program 2"
 gdb_test "backtrace" ".*main.*" "backtrace 2"
 
This page took 0.056444 seconds and 4 git commands to generate.