Avoid shadowing in gdbserver

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".
This commit is contained in:
Tom Tromey 2018-04-22 10:50:27 -06:00
parent b926417afa
commit da4ae14a4d
4 changed files with 31 additions and 21 deletions

View 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

View 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);

View 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
{

View 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);