git: ae450907c639 - main - Use kdb_thr_from_pid() in db_lookup_thread().

John Baldwin jhb at FreeBSD.org
Fri Jan 1 00:04:00 UTC 2021


The branch main has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=ae450907c6394332063566b0009f7aa0c296133e

commit ae450907c6394332063566b0009f7aa0c296133e
Author:     John Baldwin <jhb at FreeBSD.org>
AuthorDate: 2021-01-01 00:01:27 +0000
Commit:     John Baldwin <jhb at FreeBSD.org>
CommitDate: 2021-01-01 00:01:27 +0000

    Use kdb_thr_from_pid() in db_lookup_thread().
    
    The code is identical, so this should be a no-op.
    
    Reviewed by:    kib
    Sponsored by:   Netflix
    Differential Revision:  https://reviews.freebsd.org/D27828
---
 sys/ddb/db_thread.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/sys/ddb/db_thread.c b/sys/ddb/db_thread.c
index e7619dc368fe..17b74c989ede 100644
--- a/sys/ddb/db_thread.c
+++ b/sys/ddb/db_thread.c
@@ -114,7 +114,6 @@ db_lookup_thread(db_expr_t addr, bool check_pid)
 {
 	struct thread *td;
 	db_expr_t decaddr;
-	struct proc *p;
 
 	/*
 	 * If the parsed address was not a valid decimal expression,
@@ -128,10 +127,9 @@ db_lookup_thread(db_expr_t addr, bool check_pid)
 	if (td != NULL)
 		return (td);
 	if (check_pid) {
-		LIST_FOREACH(p, PIDHASH(decaddr), p_hash) {
-			if (p->p_pid == decaddr)
-				return (FIRST_THREAD_IN_PROC(p));
-		}
+		td = kdb_thr_from_pid(decaddr);
+		if (td != NULL)
+			return (td);
 	}
 	return ((struct thread *)addr);
 }


More information about the dev-commits-src-all mailing list