2011-01-05 Michael Snyder <msnyder@vmware.com>
[deliverable/binutils-gdb.git] / gdb / linux-nat.c
index 146bb8c07215c320f6973b48299d6ba03039d693..e467e9a65c1733b66f37580f700d9dee3eaa6c4d 100644 (file)
@@ -86,7 +86,8 @@ flag to check for events in cloned processes.  If nothing is found, we use
 sigsuspend to wait for SIGCHLD.  When SIGCHLD arrives, it means something
 happened to a child process -- and SIGCHLD will be delivered both for events
 in main debugged process and in cloned processes.  As soon as we know there's
-an event, we get back to calling nonblocking waitpid with and without __WCLONED.
+an event, we get back to calling nonblocking waitpid with and without 
+__WCLONED.
 
 Note that SIGCHLD should be blocked between waitpid and sigsuspend calls,
 so that we don't miss a signal. If SIGCHLD arrives in between, when it's
@@ -239,7 +240,8 @@ static void
 show_debug_linux_nat_async (struct ui_file *file, int from_tty,
                            struct cmd_list_element *c, const char *value)
 {
-  fprintf_filtered (file, _("Debugging of GNU/Linux async lwp module is %s.\n"),
+  fprintf_filtered (file,
+                   _("Debugging of GNU/Linux async lwp module is %s.\n"),
                    value);
 }
 
@@ -250,23 +252,25 @@ show_disable_randomization (struct ui_file *file, int from_tty,
                            struct cmd_list_element *c, const char *value)
 {
 #ifdef HAVE_PERSONALITY
-  fprintf_filtered (file, _("\
-Disabling randomization of debuggee's virtual address space is %s.\n"),
+  fprintf_filtered (file,
+                   _("Disabling randomization of debuggee's "
+                     "virtual address space is %s.\n"),
                    value);
 #else /* !HAVE_PERSONALITY */
-  fputs_filtered (_("\
-Disabling randomization of debuggee's virtual address space is unsupported on\n\
-this platform.\n"), file);
+  fputs_filtered (_("Disabling randomization of debuggee's "
+                   "virtual address space is unsupported on\n"
+                   "this platform.\n"), file);
 #endif /* !HAVE_PERSONALITY */
 }
 
 static void
-set_disable_randomization (char *args, int from_tty, struct cmd_list_element *c)
+set_disable_randomization (char *args, int from_tty,
+                          struct cmd_list_element *c)
 {
 #ifndef HAVE_PERSONALITY
-  error (_("\
-Disabling randomization of debuggee's virtual address space is unsupported on\n\
-this platform."));
+  error (_("Disabling randomization of debuggee's "
+          "virtual address space is unsupported on\n"
+          "this platform."));
 #endif /* !HAVE_PERSONALITY */
 }
 
@@ -283,8 +287,8 @@ struct simple_pid_list *stopped_pids;
 
 static int linux_supports_tracefork_flag = -1;
 
-/* This variable is a tri-state flag: -1 for unknown, 0 if PTRACE_O_TRACESYSGOOD
-   can not be used, 1 if it can.  */
+/* This variable is a tri-state flag: -1 for unknown, 0 if
+   PTRACE_O_TRACESYSGOOD can not be used, 1 if it can.  */
 
 static int linux_supports_tracesysgood_flag = -1;
 
@@ -346,7 +350,8 @@ async_file_mark (void)
 }
 
 static void linux_nat_async (void (*callback)
-                            (enum inferior_event_type event_type, void *context),
+                            (enum inferior_event_type event_type,
+                             void *context),
                             void *context);
 static int linux_nat_async_mask (int mask);
 static int kill_lwp (int lwpid, int signo);
@@ -473,7 +478,8 @@ linux_test_for_tracefork (int original_pid)
   else if (ret != child_pid)
     error (_("linux_test_for_tracefork: waitpid: unexpected result %d."), ret);
   if (! WIFSTOPPED (status))
-    error (_("linux_test_for_tracefork: waitpid: unexpected status %d."), status);
+    error (_("linux_test_for_tracefork: waitpid: unexpected status %d."),
+          status);
 
   ret = ptrace (PTRACE_SETOPTIONS, child_pid, 0, PTRACE_O_TRACEFORK);
   if (ret != 0)
@@ -488,10 +494,11 @@ linux_test_for_tracefork (int original_pid)
 
       ret = my_waitpid (child_pid, &status, 0);
       if (ret != child_pid)
-       warning (_("linux_test_for_tracefork: failed to wait for killed child"));
+       warning (_("linux_test_for_tracefork: failed "
+                  "to wait for killed child"));
       else if (!WIFSIGNALED (status))
-       warning (_("linux_test_for_tracefork: unexpected wait status 0x%x from "
-                "killed child"), status);
+       warning (_("linux_test_for_tracefork: unexpected "
+                  "wait status 0x%x from killed child"), status);
 
       restore_child_signals_mask (&prev_mask);
       return;
@@ -521,7 +528,8 @@ linux_test_for_tracefork (int original_pid)
          my_waitpid (second_pid, &second_status, 0);
          ret = ptrace (PTRACE_KILL, second_pid, 0, 0);
          if (ret != 0)
-           warning (_("linux_test_for_tracefork: failed to kill second child"));
+           warning (_("linux_test_for_tracefork: "
+                      "failed to kill second child"));
          my_waitpid (second_pid, &status, 0);
        }
     }
@@ -678,10 +686,12 @@ linux_child_follow_fork (struct target_ops *ops, int follow_child)
         the parent stays blocked.  If we're telling the parent to run
         in the foreground, the user will not be able to ctrl-c to get
         back the terminal, effectively hanging the debug session.  */
-      fprintf_filtered (gdb_stderr, _("\
-Can not resume the parent process over vfork in the foreground while\n\
-holding the child stopped.  Try \"set detach-on-fork\" or \
-\"set schedule-multiple\".\n"));
+      fprintf_filtered (gdb_stderr,
+                       _("Can not resume the parent process "
+                         "over vfork in the foreground while\n"
+                         "holding the child stopped.  "
+                         "Try \"set detach-on-fork\" or "
+                         "\"set schedule-multiple\".\n"));
       return 1;
     }
 
@@ -711,7 +721,8 @@ holding the child stopped.  Try \"set detach-on-fork\" or \
            {
              target_terminal_ours ();
              fprintf_filtered (gdb_stdlog,
-                               "Detaching after fork from child process %d.\n",
+                               "Detaching after fork from "
+                               "child process %d.\n",
                                child_pid);
            }
 
@@ -843,7 +854,8 @@ holding the child stopped.  Try \"set detach-on-fork\" or \
 
              if (debug_linux_nat)
                fprintf_unfiltered (gdb_stdlog,
-                                   "LCFF: no VFORK_DONE support, sleeping a bit\n");
+                                   "LCFF: no VFORK_DONE "
+                                   "support, sleeping a bit\n");
 
              usleep (10000);
 
@@ -873,12 +885,14 @@ holding the child stopped.  Try \"set detach-on-fork\" or \
        {
          target_terminal_ours ();
          if (has_vforked)
-           fprintf_filtered (gdb_stdlog, _("\
-Attaching after process %d vfork to child process %d.\n"),
+           fprintf_filtered (gdb_stdlog,
+                             _("Attaching after process %d "
+                               "vfork to child process %d.\n"),
                              parent_pid, child_pid);
          else
-           fprintf_filtered (gdb_stdlog, _("\
-Attaching after process %d fork to child process %d.\n"),
+           fprintf_filtered (gdb_stdlog,
+                             _("Attaching after process %d "
+                               "fork to child process %d.\n"),
                              parent_pid, child_pid);
        }
 
@@ -1677,8 +1691,9 @@ get_pending_status (struct lwp_info *lp, int *status)
   else if (!signal_pass_state (signo))
     {
       if (debug_linux_nat)
-       fprintf_unfiltered (gdb_stdlog, "\
-GPT: lwp %s had signal %s, but it is in no pass state\n",
+       fprintf_unfiltered (gdb_stdlog,
+                           "GPT: lwp %s had signal %s, "
+                           "but it is in no pass state\n",
                            target_pid_to_str (lp->ptid),
                            target_signal_to_string (signo));
     }
@@ -1838,10 +1853,12 @@ resume_callback (struct lwp_info *lp, void *data)
       lp->stopped_by_watchpoint = 0;
     }
   else if (lp->stopped && debug_linux_nat)
-    fprintf_unfiltered (gdb_stdlog, "RC: Not resuming sibling %s (has pending)\n",
+    fprintf_unfiltered (gdb_stdlog,
+                       "RC: Not resuming sibling %s (has pending)\n",
                        target_pid_to_str (lp->ptid));
   else if (debug_linux_nat)
-    fprintf_unfiltered (gdb_stdlog, "RC: Not resuming sibling %s (not stopped)\n",
+    fprintf_unfiltered (gdb_stdlog,
+                       "RC: Not resuming sibling %s (not stopped)\n",
                        target_pid_to_str (lp->ptid));
 
   return 0;
@@ -2080,7 +2097,8 @@ linux_handle_syscall_trap (struct lwp_info *lp, int stopping)
            fprintf_unfiltered (gdb_stdlog,
                                "LHST: stopping for %s of syscall %d"
                                " for LWP %ld\n",
-                               lp->syscall_state == TARGET_WAITKIND_SYSCALL_ENTRY
+                               lp->syscall_state
+                               == TARGET_WAITKIND_SYSCALL_ENTRY
                                ? "entry" : "return",
                                syscall_number,
                                GET_LWP (lp->ptid));
@@ -2116,7 +2134,8 @@ linux_handle_syscall_trap (struct lwp_info *lp, int stopping)
         PT_CONTINUE, can not trigger a syscall trace event.  */
       if (debug_linux_nat)
        fprintf_unfiltered (gdb_stdlog,
-                           "LHST: caught syscall event with no syscall catchpoints."
+                           "LHST: caught syscall event "
+                           "with no syscall catchpoints."
                            " %d for LWP %ld, ignoring\n",
                            syscall_number,
                            GET_LWP (lp->ptid));
@@ -2300,7 +2319,8 @@ linux_handle_extended_wait (struct lwp_info *lp, int status,
 
          if (debug_linux_nat)
            fprintf_unfiltered (gdb_stdlog,
-                               "LHEW: Got clone event from LWP %ld, resuming\n",
+                               "LHEW: Got clone event "
+                               "from LWP %ld, resuming\n",
                                GET_LWP (lp->ptid));
          linux_ops->to_resume (linux_ops, pid_to_ptid (GET_LWP (lp->ptid)),
                                0, TARGET_SIGNAL_0);
@@ -2330,8 +2350,9 @@ linux_handle_extended_wait (struct lwp_info *lp, int status,
       if (current_inferior ()->waiting_for_vfork_done)
        {
          if (debug_linux_nat)
-           fprintf_unfiltered (gdb_stdlog, "\
-LHEW: Got expected PTRACE_EVENT_VFORK_DONE from LWP %ld: stopping\n",
+           fprintf_unfiltered (gdb_stdlog,
+                               "LHEW: Got expected PTRACE_EVENT_"
+                               "VFORK_DONE from LWP %ld: stopping\n",
                                GET_LWP (lp->ptid));
 
          ourstatus->kind = TARGET_WAITKIND_VFORK_DONE;
@@ -2339,8 +2360,9 @@ LHEW: Got expected PTRACE_EVENT_VFORK_DONE from LWP %ld: stopping\n",
        }
 
       if (debug_linux_nat)
-       fprintf_unfiltered (gdb_stdlog, "\
-LHEW: Got PTRACE_EVENT_VFORK_DONE from LWP %ld: resuming\n",
+       fprintf_unfiltered (gdb_stdlog,
+                           "LHEW: Got PTRACE_EVENT_VFORK_DONE "
+                           "from LWP %ld: resuming\n",
                            GET_LWP (lp->ptid));
       ptrace (PTRACE_CONT, GET_LWP (lp->ptid), 0, 0);
       return 1;
@@ -2673,7 +2695,8 @@ stop_wait_callback (struct lwp_info *lp, void *data)
          ptrace (PTRACE_CONT, GET_LWP (lp->ptid), 0, 0);
          if (debug_linux_nat)
            fprintf_unfiltered (gdb_stdlog,
-                               "PTRACE_CONT %s, 0, 0 (%s) (discarding SIGINT)\n",
+                               "PTRACE_CONT %s, 0, 0 (%s) "
+                               "(discarding SIGINT)\n",
                                target_pid_to_str (lp->ptid),
                                errno ? safe_strerror (errno) : "OK");
 
@@ -3428,7 +3451,8 @@ retry:
              gdb_assert (lp->resumed);
 
              if (debug_linux_nat)
-               fprintf (stderr, "LWP %ld got an event %06x, leaving pending.\n",
+               fprintf (stderr,
+                        "LWP %ld got an event %06x, leaving pending.\n",
                         ptid_get_lwp (lp->ptid), lp->status);
 
              if (WIFSTOPPED (lp->status))
@@ -3453,8 +3477,9 @@ retry:
 
                          if (debug_linux_nat)
                            fprintf (stderr,
-                                    "LLW: LWP %ld hit a breakpoint while waiting "
-                                    "for another process; cancelled it\n",
+                                    "LLW: LWP %ld hit a breakpoint while"
+                                    " waiting for another process;"
+                                    " cancelled it\n",
                                     ptid_get_lwp (lp->ptid));
                        }
                      lp->stopped = 1;
@@ -3468,7 +3493,8 @@ retry:
              else if (WIFEXITED (lp->status) || WIFSIGNALED (lp->status))
                {
                  if (debug_linux_nat)
-                   fprintf (stderr, "Process %ld exited while stopping LWPs\n",
+                   fprintf (stderr,
+                            "Process %ld exited while stopping LWPs\n",
                             ptid_get_lwp (lp->ptid));
 
                  /* This was the last lwp in the process.  Since
@@ -3742,7 +3768,8 @@ linux_nat_wait (struct target_ops *ops,
   ptid_t event_ptid;
 
   if (debug_linux_nat)
-    fprintf_unfiltered (gdb_stdlog, "linux_nat_wait: [%s]\n", target_pid_to_str (ptid));
+    fprintf_unfiltered (gdb_stdlog,
+                       "linux_nat_wait: [%s]\n", target_pid_to_str (ptid));
 
   /* Flush the async file first.  */
   if (target_can_async_p ())
@@ -4245,8 +4272,8 @@ linux_nat_do_thread_registers (bfd *obfd, ptid_t ptid,
 
       if (core_regset_p
          && (regset = gdbarch_regset_from_core_section (gdbarch, ".reg",
-                                                        sizeof (gregs))) != NULL
-         && regset->collect_regset != NULL)
+                                                        sizeof (gregs)))
+         != NULL && regset->collect_regset != NULL)
        regset->collect_regset (regset, regcache, -1,
                                &gregs, sizeof (gregs));
       else
@@ -4258,8 +4285,8 @@ linux_nat_do_thread_registers (bfd *obfd, ptid_t ptid,
 
       if (core_regset_p
           && (regset = gdbarch_regset_from_core_section (gdbarch, ".reg2",
-                                                        sizeof (fpregs))) != NULL
-         && regset->collect_regset != NULL)
+                                                        sizeof (fpregs)))
+         != NULL && regset->collect_regset != NULL)
        regset->collect_regset (regset, regcache, -1,
                                &fpregs, sizeof (fpregs));
       else
@@ -4714,8 +4741,8 @@ linux_nat_info_proc_cmd (char *args, int from_tty)
          if (fscanf (procfile, "%ld ", &ltmp) > 0)
            printf_filtered (_("stime, children: %ld\n"), ltmp);
          if (fscanf (procfile, "%ld ", &ltmp) > 0)
-           printf_filtered (_("jiffies remaining in current time slice: %ld\n"),
-                            ltmp);
+           printf_filtered (_("jiffies remaining in current "
+                              "time slice: %ld\n"), ltmp);
          if (fscanf (procfile, "%ld ", &ltmp) > 0)
            printf_filtered (_("'nice' value: %ld\n"), ltmp);
          if (fscanf (procfile, "%lu ", &ltmp) > 0)
@@ -4725,13 +4752,14 @@ linux_nat_info_proc_cmd (char *args, int from_tty)
            printf_filtered (_("jiffies until next SIGALRM: %lu\n"),
                             (unsigned long) ltmp);
          if (fscanf (procfile, "%ld ", &ltmp) > 0)
-           printf_filtered (_("start time (jiffies since system boot): %ld\n"),
-                            ltmp);
+           printf_filtered (_("start time (jiffies since "
+                              "system boot): %ld\n"), ltmp);
          if (fscanf (procfile, "%lu ", &ltmp) > 0)
            printf_filtered (_("Virtual memory size: %lu\n"),
                             (unsigned long) ltmp);
          if (fscanf (procfile, "%lu ", &ltmp) > 0)
-           printf_filtered (_("Resident set size: %lu\n"), (unsigned long) ltmp);
+           printf_filtered (_("Resident set size: %lu\n"),
+                            (unsigned long) ltmp);
          if (fscanf (procfile, "%lu ", &ltmp) > 0)
            printf_filtered (_("rlim: %lu\n"), (unsigned long) ltmp);
          if (fscanf (procfile, "%lu ", &ltmp) > 0)
@@ -4740,8 +4768,8 @@ linux_nat_info_proc_cmd (char *args, int from_tty)
            printf_filtered (_("End of text: 0x%lx\n"), ltmp);
          if (fscanf (procfile, "%lu ", &ltmp) > 0)
            printf_filtered (_("Start of stack: 0x%lx\n"), ltmp);
-#if 0                          /* Don't know how architecture-dependent the rest is...
-                                  Anyway the signal bitmap info is available from "status".  */
+#if 0  /* Don't know how architecture-dependent the rest is...
+          Anyway the signal bitmap info is available from "status".  */
          if (fscanf (procfile, "%lu ", &ltmp) > 0)     /* FIXME arch? */
            printf_filtered (_("Kernel stack pointer: 0x%lx\n"), ltmp);
          if (fscanf (procfile, "%lu ", &ltmp) > 0)     /* FIXME arch? */
@@ -4948,7 +4976,8 @@ add_line_to_sigset (const char *line, sigset_t *sigs)
    SIGS to match.  */
 
 void
-linux_proc_pending_signals (int pid, sigset_t *pending, sigset_t *blocked, sigset_t *ignored)
+linux_proc_pending_signals (int pid, sigset_t *pending,
+                           sigset_t *blocked, sigset_t *ignored)
 {
   FILE *procfile;
   char buffer[MAXPATHLEN], fname[MAXPATHLEN];
@@ -5012,11 +5041,11 @@ linux_nat_xfer_osdata (struct target_ops *ops, enum target_object object,
          obstack_init (&obstack);
          obstack_grow_str (&obstack, "<osdata type=\"types\">\n");
 
-         obstack_xml_printf (
-                             &obstack,
+         obstack_xml_printf (&obstack,
                              "<item>"
                              "<column name=\"Type\">processes</column>"
-                             "<column name=\"Description\">Listing of all processes</column>"
+                             "<column name=\"Description\">"
+                             "Listing of all processes</column>"
                              "</item>");
 
          obstack_grow_str0 (&obstack, "</osdata>\n");
@@ -5490,12 +5519,13 @@ linux_nat_stop_lwp (struct lwp_info *lwp, void *data)
       if (debug_linux_nat)
        {
          if (find_thread_ptid (lwp->ptid)->stop_requested)
-           fprintf_unfiltered (gdb_stdlog, "\
-LNSL: already stopped/stop_requested %s\n",
+           fprintf_unfiltered (gdb_stdlog,
+                               "LNSL: already stopped/stop_requested %s\n",
                                target_pid_to_str (lwp->ptid));
          else
-           fprintf_unfiltered (gdb_stdlog, "\
-LNSL: already stopped/no stop_requested yet %s\n",
+           fprintf_unfiltered (gdb_stdlog,
+                               "LNSL: already stopped/no "
+                               "stop_requested yet %s\n",
                                target_pid_to_str (lwp->ptid));
        }
     }
This page took 0.037426 seconds and 4 git commands to generate.