aboutsummaryrefslogtreecommitdiff
path: root/gdb/linux-nat.c
diff options
context:
space:
mode:
authorMichael Snyder <msnyder@vmware.com>2011-01-05 22:22:53 +0000
committerMichael Snyder <msnyder@vmware.com>2011-01-05 22:22:53 +0000
commit3e43a32aaa2d78fca10dea6746b820176f39bcc8 (patch)
tree32cf854a33e1036a2e60037dabd2aaf4b4e81e03 /gdb/linux-nat.c
parent9689e3a3a7895308b7b2eac3fa6e4d560cf4b8c7 (diff)
downloadgdb-3e43a32aaa2d78fca10dea6746b820176f39bcc8.zip
gdb-3e43a32aaa2d78fca10dea6746b820176f39bcc8.tar.gz
gdb-3e43a32aaa2d78fca10dea6746b820176f39bcc8.tar.bz2
2011-01-05 Michael Snyder <msnyder@vmware.com>
* addrmap.c: Shorten lines of >= 80 columns. * arch-utils.c: Ditto. * arch-utils.h: Ditto. * ax-gdb.c: Ditto. * ax-general.c: Ditto. * bcache.c: Ditto. * blockframe.c: Ditto. * breakpoint.c: Ditto. * buildsym.c: Ditto. * c-lang.c: Ditto. * c-typeprint.c: Ditto. * charset.c: Ditto. * coffread.c: Ditto. * command.h: Ditto. * corelow.c: Ditto. * cp-abi.c: Ditto. * cp-namespace.c: Ditto. * cp-support.c: Ditto. * dbug-rom.c: Ditto. * dbxread.c: Ditto. * defs.h: Ditto. * dfp.c: Ditto. * dfp.h: Ditto. * dictionary.c: Ditto. * disasm.c: Ditto. * doublest.c: Ditto. * dwarf2-frame.c: Ditto. * dwarf2expr.c: Ditto. * dwarf2loc.c: Ditto. * dwarf2read.c: Ditto. * elfread.c: Ditto. * eval.c: Ditto. * event-loop.c: Ditto. * event-loop.h: Ditto. * exceptions.h: Ditto. * exec.c: Ditto. * expprint.c: Ditto. * expression.h: Ditto. * f-lang.c: Ditto. * f-valprint.c: Ditto. * findcmd.c: Ditto. * frame-base.c: Ditto. * frame-unwind.c: Ditto. * frame-unwind.h: Ditto. * frame.c: Ditto. * frame.h: Ditto. * gcore.c: Ditto. * gdb-stabs.h: Ditto. * gdb_assert.h: Ditto. * gdb_dirent.h: Ditto. * gdb_obstack.h: Ditto. * gdbcore.h: Ditto. * gdbtypes.c: Ditto. * gdbtypes.h: Ditto. * inf-ttrace.c: Ditto. * infcall.c: Ditto. * infcmd.c: Ditto. * inflow.c: Ditto. * infrun.c: Ditto. * inline-frame.h: Ditto. * language.c: Ditto. * language.h: Ditto. * libunwind-frame.c: Ditto. * libunwind-frame.h: Ditto. * linespec.c: Ditto. * linux-nat.c: Ditto. * linux-nat.h: Ditto. * linux-thread-db.c: Ditto. * machoread.c: Ditto. * macroexp.c: Ditto. * macrotab.c: Ditto. * main.c: Ditto. * maint.c: Ditto. * mdebugread.c: Ditto. * memattr.c: Ditto. * minsyms.c: Ditto. * monitor.c: Ditto. * monitor.h: Ditto. * objfiles.c: Ditto. * objfiles.h: Ditto. * osabi.c: Ditto. * p-typeprint.c: Ditto. * p-valprint.c: Ditto. * parse.c: Ditto. * printcmd.c: Ditto. * proc-events.c: Ditto. * procfs.c: Ditto. * progspace.c: Ditto. * progspace.h: Ditto. * psympriv.h: Ditto. * psymtab.c: Ditto. * record.c: Ditto. * regcache.c: Ditto. * regcache.h: Ditto. * remote-fileio.c: Ditto. * remote.c: Ditto. * ser-mingw.c: Ditto. * ser-tcp.c: Ditto. * ser-unix.c: Ditto. * serial.c: Ditto. * serial.h: Ditto. * solib-frv.c: Ditto. * solib-irix.c: Ditto. * solib-osf.c: Ditto. * solib-pa64.c: Ditto. * solib-som.c: Ditto. * solib-sunos.c: Ditto. * solib-svr4.c: Ditto. * solib-target.c: Ditto. * solib.c: Ditto. * somread.c: Ditto. * source.c: Ditto. * stabsread.c: Ditto. * stabsread.c: Ditto. * stack.c: Ditto. * stack.h: Ditto. * symfile-mem.c: Ditto. * symfile.c: Ditto. * symfile.h: Ditto. * symmisc.c: Ditto. * symtab.c: Ditto. * symtab.h: Ditto. * target-descriptions.c: Ditto. * target-memory.c: Ditto. * target.c: Ditto. * target.h: Ditto. * terminal.h: Ditto. * thread.c: Ditto. * top.c: Ditto. * tracepoint.c: Ditto. * tracepoint.h: Ditto. * ui-file.c: Ditto. * ui-file.h: Ditto. * ui-out.h: Ditto. * user-regs.c: Ditto. * user-regs.h: Ditto. * utils.c: Ditto. * valarith.c: Ditto. * valops.c: Ditto. * valprint.c: Ditto. * valprint.h: Ditto. * value.c: Ditto. * varobj.c: Ditto. * varobj.h: Ditto. * vec.h: Ditto. * xcoffread.c: Ditto. * xcoffsolib.c: Ditto. * xcoffsolib.h: Ditto. * xml-syscall.c: Ditto. * xml-tdesc.c: Ditto.
Diffstat (limited to 'gdb/linux-nat.c')
-rw-r--r--gdb/linux-nat.c160
1 files changed, 95 insertions, 65 deletions
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index 146bb8c..e467e9a 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -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));
}
}