From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25079 invoked by alias); 10 Mar 2005 23:50:06 -0000 Mailing-List: contact rda-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Post: List-Help: , Sender: rda-owner@sources.redhat.com Received: (qmail 24960 invoked from network); 10 Mar 2005 23:49:57 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org with SMTP; 10 Mar 2005 23:49:57 -0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.12.11/8.12.11) with ESMTP id j2ANnuwr010065 for ; Thu, 10 Mar 2005 18:49:56 -0500 Received: from zenia.home.redhat.com (sebastian-int.corp.redhat.com [172.16.52.221]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id j2ANntn29238; Thu, 10 Mar 2005 18:49:56 -0500 To: rda@sources.redhat.com Subject: committed: compile with -Wall in rda/unix From: Jim Blandy Date: Thu, 10 Mar 2005 23:50:00 -0000 Message-ID: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2005-q1/txt/msg00007.txt.bz2 2005-03-10 Jim Blandy Compile with no warnings. * Makefile.am (AM_CFLAGS): Compile with -Wall. * Makefile.in: Regenerated. * gdbserv-thread-db.h (stop_lwp, handle_waitstatus, ps_pdread, ps_pdwrite): Add declarations for these functions to gdbserv-thread-db.h. * linux-target.c: #include , , and to get declarations for system functions used in this file. (linux_get_reg): When register REGNO doesn't exist, provide zeros for its value; don't use an uninitialized pointer. (linux_set_reg): Delete unused variables. (decr_pc_after_break): Fix printf format directive to match arguments. * ptrace-target.c (ptrace_read_user, ptrace_check_child_state, ptrace_attach): Delete unused variables. (ptrace_singlestep_program, ptrace_continue_program): Fix printf format directive to match arguments. * server.c (invalid_speed): Same. (main): Initialize infd, outfd, and speed. (tty_raw): Use proper name for speed_t "zero baud" value. * thread-db.c: #include and "gdbserv-utils.h", to get declarations for functions used in this file. (thread_db_open, wait_all_threads) (thread_db_check_child_state, thread_db_get_thread_reg) (thread_db_set_thread_reg): Fix printf format directive to match arguments. (continue_thread, thread_db_get_thread_reg, continue_all_threads, thread_db_attach): Delete unused variables. Index: rda/unix/ChangeLog =================================================================== RCS file: /cvs/src/src/rda/unix/ChangeLog,v retrieving revision 1.44 diff -c -p -r1.44 ChangeLog *** rda/unix/ChangeLog 10 Mar 2005 23:15:35 -0000 1.44 --- rda/unix/ChangeLog 10 Mar 2005 23:44:35 -0000 *************** *** 1,5 **** --- 1,34 ---- 2005-03-10 Jim Blandy + Compile with no warnings. + * Makefile.am (AM_CFLAGS): Compile with -Wall. + * Makefile.in: Regenerated. + * gdbserv-thread-db.h (stop_lwp, handle_waitstatus, ps_pdread, + ps_pdwrite): Add declarations for these functions to + gdbserv-thread-db.h. + * linux-target.c: #include , , and + to get declarations for system functions used in this + file. + (linux_get_reg): When register REGNO doesn't exist, provide zeros + for its value; don't use an uninitialized pointer. + (linux_set_reg): Delete unused variables. + (decr_pc_after_break): Fix printf format directive to match + arguments. + * ptrace-target.c (ptrace_read_user, ptrace_check_child_state, + ptrace_attach): Delete unused variables. + (ptrace_singlestep_program, ptrace_continue_program): Fix printf + format directive to match arguments. + * server.c (invalid_speed): Same. + (main): Initialize infd, outfd, and speed. + (tty_raw): Use proper name for speed_t "zero baud" value. + * thread-db.c: #include and "gdbserv-utils.h", to get + declarations for functions used in this file. + (thread_db_open, wait_all_threads) + (thread_db_check_child_state, thread_db_get_thread_reg) + (thread_db_set_thread_reg): Fix printf format directive to match + arguments. + (continue_all_threads, thread_db_attach): Delete unused variables. + * Makefile.in, aclocal.m4: Regenerated with automake 1.9.4. Make config.in generated automatically again. Index: rda/unix/Makefile.am =================================================================== RCS file: /cvs/src/src/rda/unix/Makefile.am,v retrieving revision 1.2 diff -c -p -r1.2 Makefile.am *** rda/unix/Makefile.am 7 Oct 2004 19:18:22 -0000 1.2 --- rda/unix/Makefile.am 10 Mar 2005 23:44:35 -0000 *************** *** 2,7 **** --- 2,9 ---- AUTOMAKE_OPTIONS = foreign + AM_CFLAGS = -Wall + noinst_PROGRAMS = rda INCLUDES = -I$(srcdir) -I$(srcdir)/../include Index: rda/unix/Makefile.in =================================================================== RCS file: /cvs/src/src/rda/unix/Makefile.in,v retrieving revision 1.7 diff -c -p -r1.7 Makefile.in *** rda/unix/Makefile.in 10 Mar 2005 23:15:35 -0000 1.7 --- rda/unix/Makefile.in 10 Mar 2005 23:44:35 -0000 *************** target_cpu = @target_cpu@ *** 179,184 **** --- 179,185 ---- target_os = @target_os@ target_vendor = @target_vendor@ AUTOMAKE_OPTIONS = foreign + AM_CFLAGS = -Wall INCLUDES = -I$(srcdir) -I$(srcdir)/../include rda_SOURCES = server.c EXTRA_rda_SOURCES = linux-target.c solaris-target.c \ Index: rda/unix/gdbserv-thread-db.h =================================================================== RCS file: /cvs/src/src/rda/unix/gdbserv-thread-db.h,v retrieving revision 1.2 diff -c -p -r1.2 gdbserv-thread-db.h *** rda/unix/gdbserv-thread-db.h 7 Feb 2003 23:03:08 -0000 1.2 --- rda/unix/gdbserv-thread-db.h 10 Mar 2005 23:44:36 -0000 *************** extern unsigned long debug_get_pc (struc *** 102,104 **** --- 102,123 ---- /* Adjust PC value after trap has been hit. */ extern int decr_pc_after_break (struct gdbserv *serv, pid_t pid); + + /* Send SIGSTOP to an LWP. */ + extern int stop_lwp (lwpid_t lwpid); + + struct child_process; + extern int handle_waitstatus (struct child_process *process, union wait w); + + + /* read from data segment */ + ps_err_e ps_pdread (gdb_ps_prochandle_t ph, + paddr_t addr, + gdb_ps_read_buf_t buf, + gdb_ps_size_t size); + + /* write to data segment */ + ps_err_e ps_pdwrite (gdb_ps_prochandle_t ph, + paddr_t addr, + gdb_ps_write_buf_t buf, + gdb_ps_size_t size); Index: rda/unix/linux-target.c =================================================================== RCS file: /cvs/src/src/rda/unix/linux-target.c,v retrieving revision 1.14 diff -c -p -r1.14 linux-target.c *** rda/unix/linux-target.c 10 Mar 2005 22:00:16 -0000 1.14 --- rda/unix/linux-target.c 10 Mar 2005 23:44:36 -0000 *************** *** 27,32 **** --- 27,35 ---- #include #include #include + #include + #include + #include #if !defined(_MIPSEL) && !defined(_MIPSEB) #include #else *************** linux_get_reg (struct gdbserv *serv, int *** 1821,1827 **** } else if (reginfo[regno].whichregs == NOREGS) { ! /* Do nothing. */ } else { --- 1824,1836 ---- } else if (reginfo[regno].whichregs == NOREGS) { ! /* A buffer initialized to zeros we can refer to. */ ! static struct gdbserv_reg zeros; ! ! /* Make sure we're not going to try to copy out more than we have. */ ! assert (reginfo[regno].ptrace_size <= sizeof (zeros.buf)); ! ! buf = (char *) zeros.buf; } else { *************** linux_set_reg (struct gdbserv *serv, int *** 1850,1856 **** elf_fpregset_t fpregs; void *fpxregs = NULL; char *buf; - char tmp_buf[MAX_REG_SIZE]; if (regno < 0 || regno >= NUM_REGS) { --- 1859,1864 ---- *************** decr_pc_after_break (struct gdbserv *ser *** 2779,2785 **** pc -= 1; if (thread_db_noisy) ! fprintf (stderr, "\n", pid, pc); status = write_reg_as_ulong (serv, pid, PC_REGNUM, pc); return status; } --- 2787,2793 ---- pc -= 1; if (thread_db_noisy) ! fprintf (stderr, "\n", pid, pc); status = write_reg_as_ulong (serv, pid, PC_REGNUM, pc); return status; } Index: rda/unix/ptrace-target.c =================================================================== RCS file: /cvs/src/src/rda/unix/ptrace-target.c,v retrieving revision 1.7 diff -c -p -r1.7 ptrace-target.c *** rda/unix/ptrace-target.c 19 Oct 2004 21:16:45 -0000 1.7 --- rda/unix/ptrace-target.c 10 Mar 2005 23:44:37 -0000 *************** ptrace_read_user (struct gdbserv *serv, *** 206,212 **** int len, void *buff) { - struct child_process *process = gdbserv_target_data (serv); int i; /* Require: addr is on the proper boundary, and --- 206,211 ---- *************** ptrace_singlestep_program (struct gdbser *** 667,673 **** /* FIXME: handle signals! */ if (process->debug_backend) ! fprintf (stderr, "PTRACE_SINGLESTEP %d signal %d\n", process->pid, process->signal_to_send); process->stop_signal = 0; process->stop_status = 0; --- 666,672 ---- /* FIXME: handle signals! */ if (process->debug_backend) ! fprintf (stderr, "PTRACE_SINGLESTEP %d signal %ld\n", process->pid, process->signal_to_send); process->stop_signal = 0; process->stop_status = 0; *************** ptrace_continue_program (struct gdbserv *** 691,697 **** /* FIXME: handle signals! */ if (process->debug_backend) ! fprintf (stderr, "PTRACE_CONT %d signal %d\n", process->pid, process->signal_to_send); process->stop_signal = 0; process->stop_status = 0; --- 690,696 ---- /* FIXME: handle signals! */ if (process->debug_backend) ! fprintf (stderr, "PTRACE_CONT %d signal %ld\n", process->pid, process->signal_to_send); process->stop_signal = 0; process->stop_status = 0; *************** ptrace_attach (struct gdbserv *serv, voi *** 1248,1254 **** int ptrace_check_child_state (struct child_process *process) { - struct gdbserv *serv = process->serv; int ret; union wait w; --- 1247,1252 ---- Index: rda/unix/server.c =================================================================== RCS file: /cvs/src/src/rda/unix/server.c,v retrieving revision 1.9 diff -c -p -r1.9 server.c *** rda/unix/server.c 20 Oct 2004 19:19:39 -0000 1.9 --- rda/unix/server.c 10 Mar 2005 23:44:37 -0000 *************** tty_raw (int fd, speed_t speed) *** 108,114 **** buf.c_cc[VMIN] = 1; buf.c_cc[VTIME] = 0; ! if (speed != 0) { cfsetispeed (&buf, speed); cfsetospeed (&buf, speed); --- 108,114 ---- buf.c_cc[VMIN] = 1; buf.c_cc[VTIME] = 0; ! if (speed != B0) { cfsetispeed (&buf, speed); cfsetospeed (&buf, speed); *************** invalid_speed (char *str) *** 204,210 **** { char str[20]; int cnt; ! cnt = snprintf (str, sizeof (str), "%d", speed_table[i].speed); if (cnt + ll + 1 > 80) { fprintf (stderr, "\n"); --- 204,210 ---- { char str[20]; int cnt; ! cnt = snprintf (str, sizeof (str), "%ld", speed_table[i].speed); if (cnt + ll + 1 > 80) { fprintf (stderr, "\n"); *************** main (int argc, char **argv) *** 290,299 **** int verbose = 0; int attach = 0; int optidx; ! int infd, outfd; struct child_process *process; char *devicename = ""; ! speed_t speed; /* Parse options. */ for (optidx = 1; optidx < argc; optidx++) --- 290,299 ---- int verbose = 0; int attach = 0; int optidx; ! int infd = 0, outfd = 0; struct child_process *process; char *devicename = ""; ! speed_t speed = B0; /* Parse options. */ for (optidx = 1; optidx < argc; optidx++) Index: rda/unix/thread-db.c =================================================================== RCS file: /cvs/src/src/rda/unix/thread-db.c,v retrieving revision 1.12 diff -c -p -r1.12 thread-db.c *** rda/unix/thread-db.c 8 Feb 2005 18:29:04 -0000 1.12 --- rda/unix/thread-db.c 10 Mar 2005 23:44:37 -0000 *************** *** 26,31 **** --- 26,32 ---- #include #include + #include #include #include #include *************** *** 33,38 **** --- 34,40 ---- #include #include "gdbserv.h" + #include "gdbserv-utils.h" #include "gdbserv-target.h" #include "server.h" #include "gdb_proc_service.h" *************** thread_db_open (struct gdbserv *serv, in *** 866,873 **** } else if (thread_db_noisy) { ! fprintf (stderr, "< -- failed, thread_agent = 0x%08x>\n", ! (long) thread_agent); } return 0; /* failure */ } --- 868,874 ---- } else if (thread_db_noisy) { ! fprintf (stderr, "< -- failed, thread_agent = %p>\n", thread_agent); } return 0; /* failure */ } *************** wait_all_threads (struct child_process * *** 1646,1652 **** else { if (thread_db_noisy) ! fprintf (stderr, "\n", stopsig, thread->ti.ti_lid, (unsigned long) debug_get_pc (process->serv, thread->ti.ti_lid)); --- 1647,1653 ---- else { if (thread_db_noisy) ! fprintf (stderr, "\n", stopsig, thread->ti.ti_lid, (unsigned long) debug_get_pc (process->serv, thread->ti.ti_lid)); *************** continue_thread (struct gdbserv_thread * *** 1691,1699 **** static void continue_all_threads (struct gdbserv *serv) { - struct child_process *process = gdbserv_target_data (serv); struct gdbserv_thread *thread; - int signal; for (thread = first_thread_in_list (); thread; --- 1692,1698 ---- *************** thread_db_check_child_state (struct chil *** 1922,1930 **** bad from the point of view of synchronization. */ handle_waitstatus (process, w); if (thread_db_noisy) ! fprintf (stderr, "\n", process->pid, process->stop_status, process->stop_signal, ! (unsigned long) debug_get_pc (process->serv, process->pid)); /* Update the thread list. */ update_thread_list (); --- 1921,1930 ---- bad from the point of view of synchronization. */ handle_waitstatus (process, w); if (thread_db_noisy) ! fprintf (stderr, ! "\n", process->pid, process->stop_status, process->stop_signal, ! debug_get_pc (process->serv, process->pid)); /* Update the thread list. */ update_thread_list (); *************** thread_db_get_thread_reg (struct gdbserv *** 2038,2044 **** { struct child_process *process = gdbserv_target_data (serv); td_thrhandle_t thread_handle; - td_thrinfo_t ti; FPREGSET_T fpregset; GREGSET_T gregset; td_err_e ret; --- 2038,2043 ---- *************** thread_db_get_thread_reg (struct gdbserv *** 2082,2089 **** } else if (ret != TD_OK) { ! fprintf (stderr, "<<< ERROR get_thread_reg map_id2thr %d >>>\n", ! thread->ti.ti_tid); return -1; /* fail */ } --- 2081,2088 ---- } else if (ret != TD_OK) { ! fprintf (stderr, "<<< ERROR get_thread_reg map_id2thr %lu >>>\n", ! (unsigned long) thread->ti.ti_tid); return -1; /* fail */ } *************** thread_db_get_thread_reg (struct gdbserv *** 2098,2105 **** /* Now extract the register from the fpregset. */ if (reg_from_fpregset (serv, reg, regnum, &fpregset) < 0) { ! fprintf (stderr, "<<< ERROR reg_from_fpregset %d %d>>>\n", ! thread->ti.ti_tid, regnum); return -1; } } --- 2097,2104 ---- /* Now extract the register from the fpregset. */ if (reg_from_fpregset (serv, reg, regnum, &fpregset) < 0) { ! fprintf (stderr, "<<< ERROR reg_from_fpregset %lu %d>>>\n", ! (unsigned long) thread->ti.ti_tid, regnum); return -1; } } *************** thread_db_get_thread_reg (struct gdbserv *** 2138,2145 **** /* Now extract the register from the extended regset. */ if (reg_from_xregset (serv, reg, regnum, xregset) < 0) { ! fprintf (stderr, "<<< ERROR reg_from_xregset %d %d>>>\n", ! thread->ti.ti_tid, regnum); return -1; } } --- 2137,2144 ---- /* Now extract the register from the extended regset. */ if (reg_from_xregset (serv, reg, regnum, xregset) < 0) { ! fprintf (stderr, "<<< ERROR reg_from_xregset %lu %d>>>\n", ! (unsigned long) thread->ti.ti_tid, regnum); return -1; } } *************** thread_db_get_thread_reg (struct gdbserv *** 2147,2161 **** { if (thread_db_getgregs (&thread_handle, gregset) != TD_OK) { ! fprintf (stderr, "<<< ERROR get_thread_reg td_thr_getgregs %d >>>\n", ! thread->ti.ti_tid); return -1; /* fail */ } /* Now extract the requested register from the gregset. */ if (reg_from_gregset (serv, reg, regnum, gregset) < 0) { ! fprintf (stderr, "<<< ERROR reg_from_gregset %d %d>>>\n", ! thread->ti.ti_tid, regnum); return -1; /* fail */ } } --- 2146,2161 ---- { if (thread_db_getgregs (&thread_handle, gregset) != TD_OK) { ! fprintf (stderr, ! "<<< ERROR get_thread_reg td_thr_getgregs %lu >>>\n", ! (unsigned long) thread->ti.ti_tid); return -1; /* fail */ } /* Now extract the requested register from the gregset. */ if (reg_from_gregset (serv, reg, regnum, gregset) < 0) { ! fprintf (stderr, "<<< ERROR reg_from_gregset %lu %d>>>\n", ! (unsigned long) thread->ti.ti_tid, regnum); return -1; /* fail */ } } *************** thread_db_set_thread_reg (struct gdbserv *** 2219,2226 **** } else if (ret != TD_OK) { ! fprintf (stderr, "<<< ERROR set_thread_reg map_id2thr %d >>>\n", ! thread->ti.ti_tid); return -1; /* fail */ } --- 2219,2226 ---- } else if (ret != TD_OK) { ! fprintf (stderr, "<<< ERROR set_thread_reg map_id2thr %lu >>>\n", ! (unsigned long) thread->ti.ti_tid); return -1; /* fail */ } *************** thread_db_set_thread_reg (struct gdbserv *** 2237,2251 **** /* Now write the new reg value into the fpregset. */ if (reg_to_fpregset (serv, reg, regnum, &fpregset) < 0) { ! fprintf (stderr, "<<< ERROR reg_to_fpregset %d %d >>>\n", ! thread->ti.ti_tid, regnum); return -1; /* fail */ } /* Now write the fpregset back to the child. */ if (thread_db_setfpregs (&thread_handle, &fpregset) != TD_OK) { ! fprintf (stderr, "<<< ERROR set_thread_reg td_thr_setfpregs %d>>>\n", ! thread->ti.ti_tid); return -1; /* fail */ } } --- 2237,2252 ---- /* Now write the new reg value into the fpregset. */ if (reg_to_fpregset (serv, reg, regnum, &fpregset) < 0) { ! fprintf (stderr, "<<< ERROR reg_to_fpregset %lu %d >>>\n", ! (unsigned long) thread->ti.ti_tid, regnum); return -1; /* fail */ } /* Now write the fpregset back to the child. */ if (thread_db_setfpregs (&thread_handle, &fpregset) != TD_OK) { ! fprintf (stderr, ! "<<< ERROR set_thread_reg td_thr_setfpregs %lu>>>\n", ! (unsigned long) thread->ti.ti_tid); return -1; /* fail */ } } *************** thread_db_set_thread_reg (struct gdbserv *** 2284,2298 **** /* Now write the new reg value into the extended regset. */ if (reg_to_xregset (serv, reg, regnum, xregset) < 0) { ! fprintf (stderr, "<<< ERROR reg_to_xregset %d %d >>>\n", ! thread->ti.ti_tid, regnum); return -1; /* fail */ } /* Now write the extended regset back to the child. */ if (td_thr_setxregs_p (&thread_handle, gregset) != TD_OK) { ! fprintf (stderr, "<<< ERROR set_thread_reg td_thr_setxregs %d >>>\n", ! thread->ti.ti_tid); return -1; /* fail */ } } --- 2285,2300 ---- /* Now write the new reg value into the extended regset. */ if (reg_to_xregset (serv, reg, regnum, xregset) < 0) { ! fprintf (stderr, "<<< ERROR reg_to_xregset %lu %d >>>\n", ! (unsigned long) thread->ti.ti_tid, regnum); return -1; /* fail */ } /* Now write the extended regset back to the child. */ if (td_thr_setxregs_p (&thread_handle, gregset) != TD_OK) { ! fprintf (stderr, ! "<<< ERROR set_thread_reg td_thr_setxregs %lu >>>\n", ! (unsigned long) thread->ti.ti_tid); return -1; /* fail */ } } *************** thread_db_set_thread_reg (struct gdbserv *** 2301,2322 **** /* First get the current gregset. */ if (thread_db_getgregs (&thread_handle, gregset) != TD_OK) { ! fprintf (stderr, "<<< ERROR set_thread_reg td_thr_getgregs %d >>>\n", ! thread->ti.ti_tid); return -1; /* fail */ } /* Now write the new reg value into the gregset. */ if (reg_to_gregset (serv, reg, regnum, gregset) < 0) { ! fprintf (stderr, "<<< ERROR reg_to_gregset %d %d >>>\n", ! thread->ti.ti_tid, regnum); return -1; /* fail */ } /* Now write the gregset back to the child. */ if (thread_db_setgregs (&thread_handle, gregset) != TD_OK) { ! fprintf (stderr, "<<< ERROR set_thread_reg td_thr_setgregs %d >>>\n", ! thread->ti.ti_tid); return -1; /* fail */ } } --- 2303,2326 ---- /* First get the current gregset. */ if (thread_db_getgregs (&thread_handle, gregset) != TD_OK) { ! fprintf (stderr, ! "<<< ERROR set_thread_reg td_thr_getgregs %lu >>>\n", ! (unsigned long) thread->ti.ti_tid); return -1; /* fail */ } /* Now write the new reg value into the gregset. */ if (reg_to_gregset (serv, reg, regnum, gregset) < 0) { ! fprintf (stderr, "<<< ERROR reg_to_gregset %lu %d >>>\n", ! (unsigned long) thread->ti.ti_tid, regnum); return -1; /* fail */ } /* Now write the gregset back to the child. */ if (thread_db_setgregs (&thread_handle, gregset) != TD_OK) { ! fprintf (stderr, ! "<<< ERROR set_thread_reg td_thr_setgregs %lu >>>\n", ! (unsigned long) thread->ti.ti_tid); return -1; /* fail */ } } *************** thread_db_attach (struct gdbserv *serv, *** 2336,2342 **** td_err_e ret; struct child_process *process = target->data; extern struct server_vector gdbserver; - paddr_t dummy; if ((thread_db_dlopen ()) < 0) return -1; /* fail */ --- 2340,2345 ----