Avoid shadowing in gdbserver
authorTom Tromey <tom@tromey.com>
Sun, 22 Apr 2018 16:50:27 +0000 (10:50 -0600)
committerTom Tromey <tom@tromey.com>
Fri, 5 Oct 2018 04:51:46 +0000 (22:51 -0600)
This fixes a few instances of shadowing in gdbserver.  These are all
simple fixes.

gdb/gdbserver/ChangeLog
2018-10-04  Tom Tromey  <tom@tromey.com>

* server.c (handle_status): Rename inner "thread".
(process_serial_event): Declare "res" in 'm' case.
* linux-low.c (last_thread_of_process_p, find_lwp_pid)
(iterate_over_lwps): Rename inner "thread".
(linux_qxfer_libraries_svr4): Rename inner "len".
* gdbthread.h (find_thread_in_random): Rename inner "thread".

gdb/gdbserver/ChangeLog
gdb/gdbserver/gdbthread.h
gdb/gdbserver/linux-low.c
gdb/gdbserver/server.c

index f74b4fdc90376e0827f67ffcd8cb6accb8506884..5e35062b40a0761a70c03f26e869efdc43cf4328 100644 (file)
@@ -1,3 +1,12 @@
+2018-10-04  Tom Tromey  <tom@tromey.com>
+
+       * server.c (handle_status): Rename inner "thread".
+       (process_serial_event): Declare "res" in 'm' case.
+       * linux-low.c (last_thread_of_process_p, find_lwp_pid)
+       (iterate_over_lwps): Rename inner "thread".
+       (linux_qxfer_libraries_svr4): Rename inner "len".
+       * gdbthread.h (find_thread_in_random): Rename inner "thread".
+
 2018-10-01  Gary Benson <gbenson@redhat.com>
 
        * gdb_proc_service.h: Moved common code to
index 0edf870c56f4c9acc12cbe8fbe6b185a396830d4..03ace2ee16d58a95673be51207655836a319ad82 100644 (file)
@@ -188,8 +188,8 @@ find_thread_in_random (Func func)
   random_selector = (int)
     ((count * (double) rand ()) / (RAND_MAX + 1.0));
 
-  thread_info *thread = find_thread ([&] (thread_info *thread) {
-    return func (thread) && (random_selector-- == 0);
+  thread_info *thread = find_thread ([&] (thread_info *thr_arg) {
+    return func (thr_arg) && (random_selector-- == 0);
   });
 
   gdb_assert (thread != NULL);
index 984464fcc217f98b9b35868e410c164ec1cbb84a..701f3e863c0a665832549680a22f9bc1c80dd13f 100644 (file)
@@ -1255,7 +1255,7 @@ last_thread_of_process_p (int pid)
 {
   bool seen_one = false;
 
-  thread_info *thread = find_thread (pid, [&] (thread_info *thread)
+  thread_info *thread = find_thread (pid, [&] (thread_info *thr_arg)
     {
       if (!seen_one)
        {
@@ -1811,10 +1811,10 @@ status_pending_p_callback (thread_info *thread, ptid_t ptid)
 struct lwp_info *
 find_lwp_pid (ptid_t ptid)
 {
-  thread_info *thread = find_thread ([&] (thread_info *thread)
+  thread_info *thread = find_thread ([&] (thread_info *thr_arg)
     {
       int lwp = ptid.lwp () != 0 ? ptid.lwp () : ptid.pid ();
-      return thread->id.lwp () == lwp;
+      return thr_arg->id.lwp () == lwp;
     });
 
   if (thread == NULL)
@@ -1845,9 +1845,9 @@ iterate_over_lwps (ptid_t filter,
                   iterate_over_lwps_ftype callback,
                   void *data)
 {
-  thread_info *thread = find_thread (filter, [&] (thread_info *thread)
+  thread_info *thread = find_thread (filter, [&] (thread_info *thr_arg)
     {
-      lwp_info *lwp = get_thread_lwp (thread);
+      lwp_info *lwp = get_thread_lwp (thr_arg);
 
       return callback (lwp, data);
     });
@@ -7032,16 +7032,16 @@ linux_qxfer_libraries_svr4 (const char *annex, unsigned char *readbuf,
     {
       const char *sep;
       CORE_ADDR *addrp;
-      int len;
+      int name_len;
 
       sep = strchr (annex, '=');
       if (sep == NULL)
        break;
 
-      len = sep - annex;
-      if (len == 5 && startswith (annex, "start"))
+      name_len = sep - annex;
+      if (name_len == 5 && startswith (annex, "start"))
        addrp = &lm_addr;
-      else if (len == 4 && startswith (annex, "prev"))
+      else if (name_len == 4 && startswith (annex, "prev"))
        addrp = &lm_prev;
       else
        {
index a491ae025744458cd1ead895c4fb03e637a763df..d711c53e5fd6520648ef973552bf893344eff774 100644 (file)
@@ -3367,9 +3367,9 @@ handle_status (char *own_buf)
       /* If the last event thread is not found for some reason, look
         for some other thread that might have an event to report.  */
       if (thread == NULL)
-       thread = find_thread ([] (thread_info *thread)
+       thread = find_thread ([] (thread_info *thr_arg)
          {
-           return thread->status_pending_p;
+           return thr_arg->status_pending_p;
          });
 
       /* If we're still out of luck, simply pick the first thread in
@@ -4028,7 +4028,6 @@ process_serial_event (void)
   client_state &cs = get_client_state ();
   int signal;
   unsigned int len;
-  int res;
   CORE_ADDR mem_addr;
   unsigned char sig;
   int packet_len;
@@ -4172,13 +4171,15 @@ process_serial_event (void)
        }
       break;
     case 'm':
-      require_running_or_break (cs.own_buf);
-      decode_m_packet (&cs.own_buf[1], &mem_addr, &len);
-      res = gdb_read_memory (mem_addr, mem_buf, len);
-      if (res < 0)
-       write_enn (cs.own_buf);
-      else
-       bin2hex (mem_buf, cs.own_buf, res);
+      {
+       require_running_or_break (cs.own_buf);
+       decode_m_packet (&cs.own_buf[1], &mem_addr, &len);
+       int res = gdb_read_memory (mem_addr, mem_buf, len);
+       if (res < 0)
+         write_enn (cs.own_buf);
+       else
+         bin2hex (mem_buf, cs.own_buf, res);
+      }
       break;
     case 'M':
       require_running_or_break (cs.own_buf);
This page took 0.037866 seconds and 4 git commands to generate.