From owner-cvs-src@FreeBSD.ORG Tue Apr 25 20:22:54 2006 Return-Path: X-Original-To: cvs-src@FreeBSD.org Delivered-To: cvs-src@FreeBSD.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8960316A414; Tue, 25 Apr 2006 20:22:54 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3713B43D73; Tue, 25 Apr 2006 20:22:49 +0000 (GMT) (envelope-from jhb@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id k3PKMn2H043878; Tue, 25 Apr 2006 20:22:49 GMT (envelope-from jhb@repoman.freebsd.org) Received: (from jhb@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id k3PKMnO5043876; Tue, 25 Apr 2006 20:22:49 GMT (envelope-from jhb) Message-Id: <200604252022.k3PKMnO5043876@repoman.freebsd.org> From: John Baldwin Date: Tue, 25 Apr 2006 20:22:49 +0000 (UTC) To: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org X-FreeBSD-CVS-Branch: HEAD Cc: Subject: cvs commit: src/sys/ddb db_thread.c ddb.h X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Apr 2006 20:22:55 -0000 jhb 2006-04-25 20:22:49 UTC FreeBSD src repository Modified files: sys/ddb db_thread.c ddb.h Log: Add two helper functions: db_lookup_thread() and db_lookup_proc(). They take the addr value passed to a ddb command and attempt to use it to lookup a struct thread * or struct proc *, respectively. Each function first reparses the passed in value as if it was an ID entered in base 10. For threads the ID is treated as a thread ID, for proceses the ID is treated as a PID. If a thread or proc matching the ID is found, it is returned. For db_lookup_thread(), if the check_pid argument is true and it didn't find a thread with a matching thread ID, it will treat the ID as a PID and look for a matching process. If it finds one it returns the first thread in the process. If none of the ID lookups succeeded, then the functions assume that the passed in address is a thread or proc pointer, respectively. This allows one to use tids, pids, or structure pointers interchangeably in ddb functions that want to lookup threads or processes if desired. Revision Changes Path 1.5 +92 -0 src/sys/ddb/db_thread.c 1.42 +2 -0 src/sys/ddb/ddb.h