The whereis Command

The whereis command lists all declarations of a variable and each declaration's fully qualified scope information.

The scope information of a variable usually consists of the name of the source file that contains the function in which the variable is declared, the name of that function, and the name of the variable. The components of the scope information are separated by back-quotes (`).

 

whereis_command

        : whereis whereis_name

        | whereis whereis_string

 

whereis_name

        : identifier_or_typedef_name

        | ( identifier_or_typedef_name )

 

whereis_string

      : string

 

You can use the whereis command with the whereis_name to obtain information needed to differentiate overloaded identifiers that are in different units, or within different routines in the same unit. The following example shows how to set breakpoints in two C++ methods, both named print:

 

(idb) whereis printBody

"/home/user/examples/solarSystemSrc/heavenlyBody.cxx"`HeavenlyBody::printBody(const class HeavenlyBody*, unsigned int)

"/home/user/examples/solarSystemSrc/heavenlyBody.cxx"`HeavenlyBody::printBody(const class HeavenlyBody*, unsigned int)

"/home/user/examples/solarSystemSrc/heavenlyBody.cxx"`HeavenlyBody::printBody(const class HeavenlyBody*, unsigned int)

"/home/user/examples/solarSystemSrc/heavenlyBody.cxx"`HeavenlyBody::printBody(const class HeavenlyBody*, unsigned int)

"/home/user/examples/solarSystemSrc/heavenlyBody.cxx"`HeavenlyBody::printBody(const class HeavenlyBody*, unsigned int)

"/home/user/examples/solarSystemSrc/heavenlyBody.cxx"`HeavenlyBody::printBody(const class HeavenlyBody*, unsigned int)

"/home/user/examples/solarSystemSrc/heavenlyBody.cxx"`HeavenlyBody::printBody(const class HeavenlyBody*, unsigned int)

"/home/user/examples/solarSystemSrc/heavenlyBody.cxx"`HeavenlyBody::printBody(const class HeavenlyBody*, unsigned int)

"/home/user/examples/solarSystemSrc/heavenlyBody.cxx"`HeavenlyBody::printBody(const class HeavenlyBody*, unsigned int)

"/home/user/examples/solarSystemSrc/heavenlyBody.cxx"`HeavenlyBody::printBody(const class HeavenlyBody*, unsigned int)

"/home/user/examples/solarSystemSrc/heavenlyBody.cxx"`HeavenlyBody::printBody(const class HeavenlyBody*, unsigned int)

"/home/user/examples/solarSystemSrc/heavenlyBody.cxx"`HeavenlyBody::printBody(const class HeavenlyBody*, unsigned int)

"/home/user/examples/solarSystemSrc/heavenlyBody.cxx"`HeavenlyBody::printBody(const class HeavenlyBody*, unsigned int)

"/home/user/examples/solarSystemSrc/heavenlyBody.cxx"`HeavenlyBody::printBody(const class HeavenlyBody*, unsigned int)

"/home/user/examples/solarSystemSrc/heavenlyBody.cxx"`HeavenlyBody::printBody(const class HeavenlyBody*, unsigned int)

"/home/user/examples/solarSystemSrc/heavenlyBody.cxx"`HeavenlyBody::printBody(const class HeavenlyBody*, unsigned int)

"/home/user/examples/solarSystemSrc/heavenlyBody.cxx"`HeavenlyBody::printBody(const class HeavenlyBody*, unsigned int)

"/home/user/examples/solarSystemSrc/heavenlyBody.cxx"`HeavenlyBody::printBody(const class HeavenlyBody*, unsigned int)

"/home/user/examples/solarSystemSrc/heavenlyBody.cxx"`HeavenlyBody::printBody(const class HeavenlyBody*, unsigned int)

"/home/user/examples/solarSystemSrc/heavenlyBody.cxx"`HeavenlyBody::printBody(const class HeavenlyBody*, unsigned int)

"/home/user/examples/solarSystemSrc/heavenlyBody.cxx"`HeavenlyBody::printBody(const class HeavenlyBody*, unsigned int)

"/home/user/examples/solarSystemSrc/heavenlyBody.cxx"`HeavenlyBody::printBody(const class HeavenlyBody*, unsigned int)

"/home/user/examples/solarSystemSrc/heavenlyBody.cxx"`HeavenlyBody::printBody(const class HeavenlyBody*, unsigned int)

"/home/user/examples/solarSystemSrc/heavenlyBody.cxx"`HeavenlyBody::printBody(const class HeavenlyBody*, unsigned int)

"/home/user/examples/solarSystemSrc/heavenlyBody.cxx"`HeavenlyBody::printBody(const class HeavenlyBody*, unsigned int)

"/home/user/examples/solarSystemSrc/planet.cxx"`Moon::printBody(unsigned int)

"/home/user/examples/solarSystemSrc/planet.cxx"`Moon::printBody(unsigned int)

"/home/user/examples/solarSystemSrc/planet.cxx"`Planet::printBody(unsigned int)

"/home/user/examples/solarSystemSrc/planet.cxx"`Planet::printBody(unsigned int)

"/home/user/examples/solarSystemSrc/star.cxx"`Star::printBody(unsigned int)

"/home/user/examples/solarSystemSrc/star.cxx"`Star::printBody(unsigned int)

(idb) stop in "star.h"`Star::printBody

Select from

----------------------------------------------------

     1 /home/user/examples/solarSystemSrc/main/solarSystem.cxx

     2 /home/user/examples/solarSystemSrc/star.cxx

     3 None of the above

----------------------------------------------------

1

[#2: stop in virtual void Star::printBody(unsigned int)]

 

See also the which command for another example of the whereis command.

If you are not sure how to spell a symbol, you can use the whereis command with the whereis_string  to search the symbol table for the regular expression represented by the quoted string. All symbols that match the rules of the regular expression are displayed in ascending order. For example:

 

(idb) whereis planet

Symbol not found

(idb) whereis "[Pp]lanet"

"solarSystemSrc/derived_class_includes/planet.h"`Moon::Moon(char*, Megameters, Kilometers, class Planet*)

"solarSystemSrc/derived_class_includes/planet.h"`Planet

"solarSystemSrc/derived_class_includes/planet.h"`Planet

"solarSystemSrc/derived_class_includes/planet.h"`Planet

"solarSystemSrc/derived_class_includes/planet.h"`Planet::Planet(char*, Megameters, class HeavenlyBody*)

"solarSystemSrc/derived_class_includes/planet.h"`Planet::Planet(char*, Megameters, class HeavenlyBody*)

"solarSystemSrc/derived_class_includes/planet.h"`Planet::print(unsigned int)

"solarSystemSrc/derived_class_includes/planet.h"`__INTER__Moon_Moon_Orbit_Planet_Xv

"solarSystemSrc/derived_class_includes/planet.h"`__INTER__Planet_Planet_Orbit_Xv

"solarSystemSrc/derived_class_includes/planet.h"`__dt__6PlanetXv

__T_6Planet

__cxxexsig6Planet

__vtbl_5Orbit6Planet

__vtbl_5Orbit6Planet4Moon

__vtbl_6Planet

solarSystemSrc/derived_class_includes/planet.h

solarSystemSrc/derived_class_includes/planet.h

solarSystemSrc/derived_class_includes/planet.h

solarSystemSrc/planet.cxx

(idb) whereis "^Planet$"

"solarSystemSrc/derived_class_includes/planet.h"`Planet

"solarSystemSrc/derived_class_includes/planet.h"`Planet

"solarSystemSrc/derived_class_includes/planet.h"`Planet

"solarSystemSrc/derived_class_includes/planet.h"`Planet::Planet(char*, Megameters, class HeavenlyBody*)

(idb) whereis Planet

"solarSystemSrc/derived_class_includes/planet.h"`Planet

"solarSystemSrc/derived_class_includes/planet.h"`Planet

"solarSystemSrc/derived_class_includes/planet.h"`Planet

"solarSystemSrc/derived_class_includes/planet.h"`Planet::Planet(char*, Megameters, class HeavenlyBody*)

(idb) which Planet

"solarSystemSrc/derived_class_includes/planet.h"`Planet

(idb) whatis Planet

class Planet : HeavenlyBody, Orbit {

  Planet(char*, Megameters, class HeavenlyBody*);

  virtual void print(unsigned int);

}

 

You can use the $symbolsearchlimit debugger variable to specify the maximum number of symbols that will be returned by the whereis command for a regular expression search. The default value for the $symbolsearchlimit variable is 100; a value of 0 indicates no limit.