mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-08-06 14:49:38 +08:00
2003-03-28 Jeff Johnston <jjohnstn@redhat.com>
* thread.c: Reindented. * lin-lwp.c: Ditto. * linux-proc.c: Ditto.
This commit is contained in:
@ -1,3 +1,9 @@
|
||||
2003-03-28 Jeff Johnston <jjohnstn@redhat.com>
|
||||
|
||||
* thread.c: Reindented.
|
||||
* lin-lwp.c: Ditto.
|
||||
* linux-proc.c: Ditto.
|
||||
|
||||
2003-03-28 Bob Rossi <bob_rossi@cox.net>
|
||||
|
||||
* MAINTAINERS (write after approval): Add myself.
|
||||
|
@ -172,8 +172,7 @@ status_to_str (int status)
|
||||
snprintf (buf, sizeof (buf), "%s (terminated)",
|
||||
strsignal (WSTOPSIG (status)));
|
||||
else
|
||||
snprintf (buf, sizeof (buf), "%d (exited)",
|
||||
WEXITSTATUS (status));
|
||||
snprintf (buf, sizeof (buf), "%d (exited)", WEXITSTATUS (status));
|
||||
|
||||
return buf;
|
||||
}
|
||||
@ -455,8 +454,7 @@ lin_lwp_attach (char *args, int from_tty)
|
||||
if (debug_lin_lwp)
|
||||
{
|
||||
fprintf_unfiltered (gdb_stdlog,
|
||||
"LLA: waitpid %ld, faking SIGSTOP\n",
|
||||
(long) pid);
|
||||
"LLA: waitpid %ld, faking SIGSTOP\n", (long) pid);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1016,8 +1014,7 @@ child_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
|
||||
{
|
||||
fprintf_unfiltered (gdb_stdlog,
|
||||
"CW: waitpid %ld received %s\n",
|
||||
(long) pid,
|
||||
status_to_str (status));
|
||||
(long) pid, status_to_str (status));
|
||||
}
|
||||
|
||||
save_errno = errno;
|
||||
@ -1169,8 +1166,7 @@ lin_lwp_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
|
||||
{
|
||||
fprintf_unfiltered (gdb_stdlog,
|
||||
"LLW: waitpid %ld received %s\n",
|
||||
(long) lwpid,
|
||||
status_to_str (status));
|
||||
(long) lwpid, status_to_str (status));
|
||||
}
|
||||
|
||||
lp = find_lwp_pid (pid_to_ptid (lwpid));
|
||||
@ -1242,8 +1238,7 @@ lin_lwp_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
|
||||
/* Make sure we don't report a SIGSTOP that we sent
|
||||
ourselves in an attempt to stop an LWP. */
|
||||
if (lp->signalled
|
||||
&& WIFSTOPPED (status)
|
||||
&& WSTOPSIG (status) == SIGSTOP)
|
||||
&& WIFSTOPPED (status) && WSTOPSIG (status) == SIGSTOP)
|
||||
{
|
||||
if (debug_lin_lwp)
|
||||
fprintf_unfiltered (gdb_stdlog,
|
||||
@ -1318,7 +1313,8 @@ lin_lwp_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
|
||||
if (debug_lin_lwp)
|
||||
fprintf_unfiltered (gdb_stdlog,
|
||||
"LLW: %s %s, %s (preempt 'handle')\n",
|
||||
lp->step ? "PTRACE_SINGLESTEP" : "PTRACE_CONT",
|
||||
lp->step ?
|
||||
"PTRACE_SINGLESTEP" : "PTRACE_CONT",
|
||||
target_pid_to_str (lp->ptid),
|
||||
signo ? strsignal (signo) : "0");
|
||||
lp->stopped = 0;
|
||||
@ -1326,8 +1322,7 @@ lin_lwp_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
|
||||
goto retry;
|
||||
}
|
||||
|
||||
if (signo == TARGET_SIGNAL_INT
|
||||
&& signal_pass_state (signo) == 0)
|
||||
if (signo == TARGET_SIGNAL_INT && signal_pass_state (signo) == 0)
|
||||
{
|
||||
/* If ^C/BREAK is typed at the tty/console, SIGINT gets
|
||||
forwarded to the entire process group, that is, all LWP's
|
||||
@ -1342,8 +1337,7 @@ lin_lwp_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
|
||||
|
||||
if (debug_lin_lwp)
|
||||
fprintf_unfiltered (gdb_stdlog, "LLW: Candidate event %s in %s.\n",
|
||||
status_to_str (status),
|
||||
target_pid_to_str (lp->ptid));
|
||||
status_to_str (status), target_pid_to_str (lp->ptid));
|
||||
|
||||
/* Now stop all other LWP's ... */
|
||||
iterate_over_lwps (stop_callback, NULL);
|
||||
@ -1475,8 +1469,7 @@ lin_lwp_mourn_inferior (void)
|
||||
|
||||
static int
|
||||
lin_lwp_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write,
|
||||
struct mem_attrib *attrib,
|
||||
struct target_ops *target)
|
||||
struct mem_attrib *attrib, struct target_ops *target)
|
||||
{
|
||||
struct cleanup *old_chain = save_inferior_ptid ();
|
||||
int xfer;
|
||||
@ -1588,9 +1581,7 @@ _initialize_lin_lwp (void)
|
||||
add_show_from_set (add_set_cmd ("lin-lwp", no_class, var_zinteger,
|
||||
(char *) &debug_lin_lwp,
|
||||
"Set debugging of GNU/Linux lwp module.\n\
|
||||
Enables printf debugging output.\n",
|
||||
&setdebuglist),
|
||||
&showdebuglist);
|
||||
Enables printf debugging output.\n", &setdebuglist), &showdebuglist);
|
||||
}
|
||||
|
||||
|
||||
|
@ -75,9 +75,7 @@ read_mapping (FILE *mapfile,
|
||||
long long *endaddr,
|
||||
char *permissions,
|
||||
long long *offset,
|
||||
char *device,
|
||||
long long *inode,
|
||||
char *filename)
|
||||
char *device, long long *inode, char *filename)
|
||||
{
|
||||
int ret = fscanf (mapfile, "%llx-%llx %s %llx %s %llx",
|
||||
addr, endaddr, permissions, offset, device, inode);
|
||||
@ -110,9 +108,7 @@ read_mapping (FILE *mapfile,
|
||||
static int
|
||||
linux_find_memory_regions (int (*func) (CORE_ADDR,
|
||||
unsigned long,
|
||||
int, int, int,
|
||||
void *),
|
||||
void *obfd)
|
||||
int, int, int, void *), void *obfd)
|
||||
{
|
||||
long long pid = PIDGET (inferior_ptid);
|
||||
char mapsfilename[MAXPATHLEN];
|
||||
@ -148,11 +144,9 @@ linux_find_memory_regions (int (*func) (CORE_ADDR,
|
||||
"Save segment, %lld bytes at 0x%s (%c%c%c)",
|
||||
size, paddr_nz (addr),
|
||||
read ? 'r' : ' ',
|
||||
write ? 'w' : ' ',
|
||||
exec ? 'x' : ' ');
|
||||
write ? 'w' : ' ', exec ? 'x' : ' ');
|
||||
if (filename && filename[0])
|
||||
fprintf_filtered (gdb_stdout,
|
||||
" for %s", filename);
|
||||
fprintf_filtered (gdb_stdout, " for %s", filename);
|
||||
fprintf_filtered (gdb_stdout, "\n");
|
||||
}
|
||||
|
||||
@ -184,22 +178,19 @@ linux_do_thread_registers (bfd *obfd, ptid_t ptid,
|
||||
note_data,
|
||||
note_size,
|
||||
merged_pid,
|
||||
stop_signal,
|
||||
&gregs);
|
||||
stop_signal, &gregs);
|
||||
|
||||
fill_fpregset (&fpregs, -1);
|
||||
note_data = (char *) elfcore_write_prfpreg (obfd,
|
||||
note_data,
|
||||
note_size,
|
||||
&fpregs,
|
||||
sizeof (fpregs));
|
||||
&fpregs, sizeof (fpregs));
|
||||
#ifdef FILL_FPXREGSET
|
||||
fill_fpxregset (&fpxregs, -1);
|
||||
note_data = (char *) elfcore_write_prxfpreg (obfd,
|
||||
note_data,
|
||||
note_size,
|
||||
&fpxregs,
|
||||
sizeof (fpxregs));
|
||||
&fpxregs, sizeof (fpxregs));
|
||||
#endif
|
||||
return note_data;
|
||||
}
|
||||
@ -260,20 +251,16 @@ linux_make_note_section (bfd *obfd, int *note_size)
|
||||
if (get_exec_file (0))
|
||||
{
|
||||
strncpy (fname, strrchr (get_exec_file (0), '/') + 1, sizeof (fname));
|
||||
strncpy (psargs, get_exec_file (0),
|
||||
sizeof (psargs));
|
||||
strncpy (psargs, get_exec_file (0), sizeof (psargs));
|
||||
if (get_inferior_args ())
|
||||
{
|
||||
strncat (psargs, " ",
|
||||
sizeof (psargs) - strlen (psargs));
|
||||
strncat (psargs, " ", sizeof (psargs) - strlen (psargs));
|
||||
strncat (psargs, get_inferior_args (),
|
||||
sizeof (psargs) - strlen (psargs));
|
||||
}
|
||||
note_data = (char *) elfcore_write_prpsinfo (obfd,
|
||||
note_data,
|
||||
note_size,
|
||||
fname,
|
||||
psargs);
|
||||
note_size, fname, psargs);
|
||||
}
|
||||
|
||||
/* Dump information for threads. */
|
||||
@ -432,16 +419,13 @@ linux_info_proc_cmd (char *args, int from_tty)
|
||||
printf_filtered (header_fmt_string,
|
||||
"Start Addr",
|
||||
" End Addr",
|
||||
" Size",
|
||||
" Offset",
|
||||
"objfile");
|
||||
" Size", " Offset", "objfile");
|
||||
|
||||
while (read_mapping (procfile, &addr, &endaddr, &permissions[0],
|
||||
&offset, &device[0], &inode, &filename[0]))
|
||||
{
|
||||
size = endaddr - addr;
|
||||
printf_filtered (data_fmt_string,
|
||||
(unsigned long) addr, /* FIXME: pr_addr */
|
||||
printf_filtered (data_fmt_string, (unsigned long) addr, /* FIXME: pr_addr */
|
||||
(unsigned long) endaddr,
|
||||
(int) size,
|
||||
(unsigned int) offset,
|
||||
@ -530,11 +514,9 @@ linux_info_proc_cmd (char *args, int from_tty)
|
||||
printf_filtered ("Virtual memory size: %u\n",
|
||||
(unsigned int) itmp);
|
||||
if (fscanf (procfile, "%u ", &itmp) > 0)
|
||||
printf_filtered ("Resident set size: %u\n",
|
||||
(unsigned int) itmp);
|
||||
printf_filtered ("Resident set size: %u\n", (unsigned int) itmp);
|
||||
if (fscanf (procfile, "%u ", &itmp) > 0)
|
||||
printf_filtered ("rlim: %u\n",
|
||||
(unsigned int) itmp);
|
||||
printf_filtered ("rlim: %u\n", (unsigned int) itmp);
|
||||
if (fscanf (procfile, "%u ", &itmp) > 0)
|
||||
printf_filtered ("Start of text: 0x%x\n", itmp);
|
||||
if (fscanf (procfile, "%u ", &itmp) > 0)
|
||||
@ -584,9 +566,9 @@ Specify any of the following keywords for detailed info:\n\
|
||||
all -- list all available /proc info.");
|
||||
}
|
||||
|
||||
int linux_proc_xfer_memory (CORE_ADDR addr, char *myaddr, int len, int write,
|
||||
struct mem_attrib *attrib,
|
||||
struct target_ops *target)
|
||||
int
|
||||
linux_proc_xfer_memory (CORE_ADDR addr, char *myaddr, int len, int write,
|
||||
struct mem_attrib *attrib, struct target_ops *target)
|
||||
{
|
||||
int fd, ret;
|
||||
char filename[64];
|
||||
@ -616,8 +598,7 @@ int linux_proc_xfer_memory (CORE_ADDR addr, char *myaddr, int len, int write,
|
||||
#ifdef HAVE_PREAD64
|
||||
if (pread64 (fd, myaddr, len, addr) != len)
|
||||
#else
|
||||
if (lseek (fd, addr, SEEK_SET) == -1
|
||||
|| read (fd, myaddr, len) != len)
|
||||
if (lseek (fd, addr, SEEK_SET) == -1 || read (fd, myaddr, len) != len)
|
||||
#endif
|
||||
ret = 0;
|
||||
else
|
||||
|
30
gdb/thread.c
30
gdb/thread.c
@ -256,8 +256,7 @@ in_thread_list (ptid_t ptid)
|
||||
/* Print a list of thread ids currently known, and the total number of
|
||||
threads. To be used from within catch_errors. */
|
||||
static int
|
||||
do_captured_list_thread_ids (struct ui_out *uiout,
|
||||
void *arg)
|
||||
do_captured_list_thread_ids (struct ui_out *uiout, void *arg)
|
||||
{
|
||||
struct thread_info *tp;
|
||||
int num = 0;
|
||||
@ -307,8 +306,7 @@ load_infrun_state (ptid_t ptid,
|
||||
bpstat *stepping_through_solib_catchpoints,
|
||||
int *stepping_through_sigtramp,
|
||||
int *current_line,
|
||||
struct symtab **current_symtab,
|
||||
CORE_ADDR *step_sp)
|
||||
struct symtab **current_symtab, CORE_ADDR *step_sp)
|
||||
{
|
||||
struct thread_info *tp;
|
||||
|
||||
@ -329,8 +327,10 @@ load_infrun_state (ptid_t ptid,
|
||||
*step_frame_id = tp->step_frame_id;
|
||||
*handling_longjmp = tp->handling_longjmp;
|
||||
*another_trap = tp->another_trap;
|
||||
*stepping_through_solib_after_catch = tp->stepping_through_solib_after_catch;
|
||||
*stepping_through_solib_catchpoints = tp->stepping_through_solib_catchpoints;
|
||||
*stepping_through_solib_after_catch =
|
||||
tp->stepping_through_solib_after_catch;
|
||||
*stepping_through_solib_catchpoints =
|
||||
tp->stepping_through_solib_catchpoints;
|
||||
*stepping_through_sigtramp = tp->stepping_through_sigtramp;
|
||||
*current_line = tp->current_line;
|
||||
*current_symtab = tp->current_symtab;
|
||||
@ -356,8 +356,7 @@ save_infrun_state (ptid_t ptid,
|
||||
bpstat stepping_through_solib_catchpoints,
|
||||
int stepping_through_sigtramp,
|
||||
int current_line,
|
||||
struct symtab *current_symtab,
|
||||
CORE_ADDR step_sp)
|
||||
struct symtab *current_symtab, CORE_ADDR step_sp)
|
||||
{
|
||||
struct thread_info *tp;
|
||||
|
||||
@ -571,8 +570,7 @@ thread_apply_all_command (char *cmd, int from_tty)
|
||||
switch_to_thread (tp->ptid);
|
||||
#ifdef HPUXHPPA
|
||||
printf_filtered ("\nThread %d (%s):\n",
|
||||
tp->num,
|
||||
target_tid_to_str (inferior_ptid));
|
||||
tp->num, target_tid_to_str (inferior_ptid));
|
||||
#else
|
||||
printf_filtered ("\nThread %d (%s):\n", tp->num,
|
||||
target_pid_to_str (inferior_ptid));
|
||||
@ -690,8 +688,7 @@ thread_command (char *tidstr, int from_tty)
|
||||
}
|
||||
|
||||
static int
|
||||
do_captured_thread_select (struct ui_out *uiout,
|
||||
void *tidstr)
|
||||
do_captured_thread_select (struct ui_out *uiout, void *tidstr)
|
||||
{
|
||||
int num;
|
||||
struct thread_info *tp;
|
||||
@ -724,8 +721,7 @@ do_captured_thread_select (struct ui_out *uiout,
|
||||
}
|
||||
|
||||
enum gdb_rc
|
||||
gdb_thread_select (struct ui_out *uiout,
|
||||
char *tidstr)
|
||||
gdb_thread_select (struct ui_out *uiout, char *tidstr)
|
||||
{
|
||||
return catch_exceptions (uiout, do_captured_thread_select, tidstr,
|
||||
NULL, RETURN_MASK_ALL);
|
||||
@ -744,16 +740,14 @@ _initialize_thread (void)
|
||||
|
||||
add_prefix_cmd ("thread", class_run, thread_command,
|
||||
"Use this command to switch between threads.\n\
|
||||
The new thread ID must be currently known.", &thread_cmd_list, "thread ", 1,
|
||||
&cmdlist);
|
||||
The new thread ID must be currently known.", &thread_cmd_list, "thread ", 1, &cmdlist);
|
||||
|
||||
add_prefix_cmd ("apply", class_run, thread_apply_command,
|
||||
"Apply a command to a list of threads.",
|
||||
&thread_apply_list, "apply ", 1, &thread_cmd_list);
|
||||
|
||||
add_cmd ("all", class_run, thread_apply_all_command,
|
||||
"Apply a command to all threads.",
|
||||
&thread_apply_list);
|
||||
"Apply a command to all threads.", &thread_apply_list);
|
||||
|
||||
if (!xdb_commands)
|
||||
add_com_alias ("t", "thread", class_run, 1);
|
||||
|
Reference in New Issue
Block a user