Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 1 Jan 2021 00:03:59 GMT
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: ae450907c639 - main - Use kdb_thr_from_pid() in db_lookup_thread().
Message-ID:  <202101010003.10103xdw093730@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by jhb:

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

commit ae450907c6394332063566b0009f7aa0c296133e
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2021-01-01 00:01:27 +0000
Commit:     John Baldwin <jhb@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);
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202101010003.10103xdw093730>