This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH 01/19] Remove usage of find_inferior in regcache_invalidate_pid
- From: Simon Marchi <simon dot marchi at ericsson dot com>
- To: <gdb-patches at sourceware dot org>
- Cc: Simon Marchi <simon dot marchi at polymtl dot ca>
- Date: Mon, 20 Nov 2017 11:34:25 -0500
- Subject: [PATCH 01/19] Remove usage of find_inferior in regcache_invalidate_pid
- Authentication-results: sourceware.org; auth=none
- Authentication-results: spf=none (sender IP is ) smtp.mailfrom=simon dot marchi at ericsson dot com;
- References: <1511195683-2055-1-git-send-email-simon.marchi@ericsson.com>
- Spamdiagnosticmetadata: NSPM
- Spamdiagnosticoutput: 1:99
From: Simon Marchi <simon.marchi@polymtl.ca>
Replace with for_each_thread with pid filtering.
regcache_invalidate_one is not longer needed, as it was only used to
filter the pid. We can call regcache_invalidate_thread directly.
gdb/gdbserver/ChangeLog:
* regcache.c (regcache_invalidate_one): Remove.
(regcache_invalidate_pid): use for_each_thread.
---
gdb/gdbserver/regcache.c | 15 ++-------------
1 file changed, 2 insertions(+), 13 deletions(-)
diff --git a/gdb/gdbserver/regcache.c b/gdb/gdbserver/regcache.c
index e45e60e..5f71523 100644
--- a/gdb/gdbserver/regcache.c
+++ b/gdb/gdbserver/regcache.c
@@ -93,24 +93,13 @@ regcache_invalidate_thread (struct thread_info *thread)
regcache->registers_valid = 0;
}
-static int
-regcache_invalidate_one (thread_info *thread, void *pid_p)
-{
- int pid = *(int *) pid_p;
-
- /* Only invalidate the regcaches of threads of this process. */
- if (thread->id.pid () == pid)
- regcache_invalidate_thread (thread);
-
- return 0;
-}
-
/* See regcache.h. */
void
regcache_invalidate_pid (int pid)
{
- find_inferior (&all_threads, regcache_invalidate_one, &pid);
+ /* Only invalidate the regcaches of threads of this process. */
+ for_each_thread (pid, regcache_invalidate_thread);
}
/* See regcache.h. */
--
2.7.4