Location References Dialog

The Location References Dialog displays all the memory reference destinations to a specific code unit that is described by the item under the current location. For example, if the current location is a referenced label, then the dialog will show references to that label and not the current address. In the following snippet, the label "LAB_40768a" is the field at the current location.



Showing the Location References Dialog dialog at this location will show all references to the label "LAB_4078d2".

This dialog also works with data types. If the item at the current location is a data type, then all places that data type is applied will be shown and the data type will be highlighted in the Data Type Manager tree.

As another example, if the location is an XRef field location, then the dialog will show references to the address that the XRef field represents. In the following snippet, the Xref field "0040767d(j)" is the field at the current location.



Showing the Location References Dialog dialog at this location will show all references to the address 0040767d.

You can also show references to data types from the Data Type Manager. In this case, all locations where the selected data type is applied will be highlighted.


To Find Location References

  1. Right-mouse anywhere on the code unit*
  2. Select whichever of the following is available from the popup menu:

*If the Location References Dialog cannot show references to the location that was clicked, then the menu item will be disabled.

The results of performing this action depend upon the location the cursor when the popup is shown. Here are some examples:

Results Window Header

This title displays the item that is the destination of all the references in the Reference(s) table.

The button will cause the code browser to return the cursor to the location from which the dialog was launched.

The button will refresh the table of references. This button will appear disabled when the data is not stale. However, if Ghidra detects that the data may be stale, then the button will become color filled, as it is here. You may push the button for a refresh in either state.

The button will create a selection in the code browser with the reference entries selected in the table. You may also access this feature by right-clicking an item in the table and selecting Make Selection.

The button toggles the highlighting of the matching references. In this case, the term highlight refers to the background color of the item in the Listing and not a Program Selection Highlight.

To instead make a Program Selection Highlight, use the select button mentioned above. Then, click from the menu bar Select -> Program Highlight -> Entire Selection

Search Results

This table displays a list a reference sources, one for each reference associated with the selected destination instruction or data item. There are four fields by default that are displayed in the table:

Location - Shows the source address.

Label - Shows the primary label at the source address (if one exists).

Preview - Shows the instruction or data item at the source address.

Context - Shows the type of reference to the current location. If the result is a Ghidra in-memory Reference, then this column will show the type of reference. If the result is found by way of the Decompiler, then the line from the decompiled function will be shown.

You can make a selection in the Code Browser from the entries in the table:

  1. Click on an entry in the table, or Ctrl-click to select multiple entries.
  2. Right mouse click and choose Make Selection.
    • The current selection in the Code Browser is set to include the addresses that you selected in the Address table.

To Find Location References to Data Types

From within the Data Type Manager you can right-click on a data type and select Find Uses of. This will show a Location References Dialog that lists all locations where the selected data type is applied, such as in function signatures, return types, structures, etc. For FunctionDefinitions the action will display all places that function is applied.

When searching for references to a field of a composite data type via the popup menu in the Data Type Manager, you can search by name or by offset within the parent data type. This is useful when the field you seek does not have a name.

By default, finding uses of data types will search not only for applied data types, but also will perform dynamic discovery of data types using the Data Type Reference Finder service. This causes the search to be slower, but also reports many more type uses. To disable the dynamic searching, use the Search-> Dynamic Data Type Discovery tool option.

To Show Location References to Code Unit

  1. Right-mouse anywhere on the code unit*
  2. Select References Show References to Address from the popup menu.

This will show all references to the current address, as well as all addresses consumed by the current instruction or data.

*If the Location References Dialog cannot show references to the location that was clicked, then the menu item will be disabled.

This action will show only direct references to the current code unit. No other special reference finding will take place.

Renaming Windows

see Docking Windows - Renaming Windows

Provided by: LocationReferencesPlugin

Related Topics: