![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Using PathnamesObjects in the program can be referenced explicitly using strings called pathnames. Pathnames:
- Are especially useful for referencing objects that are not currently on the screen (and so cannot easily be designated)
- Can be fully qualified or relative to the context in which the command is entered.
Pathnames are discussed in further detail in Using the Apex Debugger.
Fully Qualified Pathnames
Every object in the program being debugged has a unique, fully qualified pathname that reflects the object's unique location in the source, and program execution. An example of a fully qualified pathname is:
Airline_Reservations.Make_Res.Down_Message
In this example, Airline_Reservations is the package containing the Make_Res procedure which contains the Down_Message variable.
The :: operator can be used in a debugger pathname to associate an identifier with a specific class or struct. This is sometimes necessary to reference a class or struct member that is hidden by a locally defined identifier. An example of this kind of fully qualified pathname is:
Seat_Services::Status
where Seat_Services is a class and status is a data member of the class. If the local context was within the body of a member function of Seat_Services with a local variable "status", then a fully qualified pathname would be needed to reference Seat_Services::Status.
The other use of the :: operator is to reference names from the global scope. An example of this find of fully qualified pathname is:
::Global_Control
Relative Pathnames
Although you can always refer to an object using its fully qualified pathname, it is often more convent to use a relative pathname instead. A relative pathname traces the path to an object starting from some environment or debugger location other than the root world (for a source location or static variable) or named task for a dynamic variable). Thus, if you want to reference an object that is "in the neighborhood" of your current location in the Environment or in the debugger, you can use a relative pathname to specify the object relative to your current location.
A given relative pathname for an object:
- Starts with a name component
- Contains only a portion of the object's fully qualified name, omitting the portion that references the context. For the above example:
Relative pathnames are shorted than fully qualified pathnames because the debugger uses the context to fill in the missing name components. An example of a relative pathname is:
Make_Res.Down_Message
When the context is the Airline_Reservations package, the relative name refers the same object as the fully qualified pathname in the previous example.
In a normal debugging scenario, relative debugger pathnames are usually preferred because they are shorter. SInce a relative debugger pathname does not use the :: operator, the debugger resolves the first simple identifier in the pathname in the context determined by the current focus in the program being debugged. Within a member function, the member names can be referenced by their simple identifiers. For example, within a member function Call_Attendant or class Seat_Services, the member Light_Status is directly visible without qualification.
If the first identifier of a relative pathname cannot be resolved in a given local context using the C/C++ name resolution rules, the debugger looks for the name among the global names.
Overloading
If the search finds multiple definitions for the same name, the debugger issues a message displaying each of the possible alternatives. The notation is simple_name'n, where n is a number (for example., sin'2). An example of the debugger message follows.
=> add is overloaded. Use 'n to select one: add'1 (integer, integer) return integer add'2 (integer, integer) return real_a add'3 (integer, integer) return float add'4 (integer) add'5 (float)
=> add is overloaded. Use 'n to select one: Integer_Operations::add'1 (integer, integer) return integer Real_Operations::add'2 (integer, integer) return real_a Float_Operations::add'3 (integer, integer) return float Integer_Queue::add'4 (integer) Float_Queue::add'5 (float)
Append the suffix 'n to the subprogram/function name to indicate precisely the name to reference, where n is one of the numbers listed in the overloading message.
The debugger assigns a number to each occurrence of a simple name, starting with 1. These numbers remain constant throughout the debugging session.
Rational Software Corporation http://www.rational.com support@rational.com techpubs@rational.com Copyright © 1993-2001, Rational Software Corporation. All rights reserved. |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |