* Lookup a process based on a db expression address. We assume that the * address was parsed in hexadecimal. We reparse the address in decimal * first and try to treat it as a PID to find an associated process. * If that fails we treat the addr as a pointer to a process. */
| 141 | * If that fails we treat the addr as a pointer to a process. |
| 142 | */ |
| 143 | struct proc * |
| 144 | db_lookup_proc(db_expr_t addr) |
| 145 | { |
| 146 | db_expr_t decaddr; |
| 147 | struct proc *p; |
| 148 | |
| 149 | decaddr = db_hex2dec(addr); |
| 150 | if (decaddr != -1) { |
| 151 | LIST_FOREACH(p, PIDHASH(decaddr), p_hash) { |
| 152 | if (p->p_pid == decaddr) |
| 153 | return (p); |
| 154 | } |
| 155 | } |
| 156 | return ((struct proc *)addr); |
| 157 | } |
no test coverage detected