In a program, the same name might refer to different types of program entities and occur in many scopes. The dbx whereis command lists the fully qualified name, and hence the location, of all symbols of that name. The dbx which command tells you which occurrence of a symbol dbx would use if you give that name in an expression.