Skip to main content
The SymbolTable manages the symbols defined in a program. A symbol is an association between an address and a string name, optionally within a namespace.

Overview

The Symbol Table provides:
  • Symbol Management - Create, retrieve, and delete symbols
  • Labels - Named locations in memory
  • Functions - Function symbols and signatures
  • Namespaces - Hierarchical organization
  • References - Cross-references between symbols
  • External Symbols - Symbols from external libraries

Key Concepts

Symbol Types

  • Label - Simple named location
  • Function - Function entry point
  • Parameter - Function parameter
  • Local Variable - Function local variable
  • Class - Class namespace
  • Namespace - Generic namespace
  • Library - External library

Primary vs Non-Primary

Any address can have multiple symbols. One symbol is designated as the primary symbol, which is the default symbol displayed for that address.

Global vs Local

Symbols can be global (in the global namespace) or local (in another namespace like a function or class).

Dynamic Symbols

Dynamic symbols are generated automatically by the system based on context (e.g., FUN_00401000 for unnamed functions).

Creating Symbols

Create Labels

Symbol
Creates a label in the global namespace.
Symbol
Creates a label in a specific namespace.

Source Types

  • SourceType.USER_DEFINED - Created by the user
  • SourceType.IMPORTED - Imported from external source
  • SourceType.ANALYSIS - Created by analysis
  • SourceType.DEFAULT - System-generated default symbol

Retrieving Symbols

Get by ID

Symbol
Returns the symbol with the specified ID.

Get by Address

Symbol
Returns the primary symbol at the specified address.
Symbol[]
Returns all symbols at the specified address.
The primary symbol is at index 0 in the array.
SymbolIterator
Returns an iterator over symbols at the address (excludes dynamic symbols).Use this instead of getSymbols() when searching for a specific symbol to avoid loading all symbols.
Symbol[]
Returns defined symbols at the address (excludes dynamic symbols).

Get by Name

Symbol
Returns the symbol with the specified name, address, and namespace.
All three parameters are required to uniquely identify a symbol.
Symbol
Returns the global symbol with the specified name and address.
List<Symbol>
Returns all global symbols with the specified name.
List<Symbol>
Returns all label or function symbols with the specified name in the namespace.

Get by Reference

Symbol
Returns the symbol associated with a reference.

Iterating Symbols

All Symbols

SymbolIterator
Returns an iterator over all symbols.
SymbolIterator
Returns an iterator over all label symbols.
SymbolIterator
Returns an iterator over all defined symbols (excludes dynamic labels).

By Name

SymbolIterator
Returns an iterator over all symbols with the specified name.
SymbolIterator
Returns symbols matching a wildcard query (* and ? supported).
SymbolIterator
Returns symbols in lexicographical order starting from the specified name.

By Namespace

SymbolIterator
Returns all symbols in the specified namespace.
List<Symbol>
Returns symbols with the specified name in the namespace.

By Type

SymbolIterator
Returns symbols of the specified type within the address set.

By Address

SymbolIterator
Returns symbols in address order.
SymbolIterator
Returns symbols starting from the specified address.
SymbolIterator
Returns primary symbols in address order.
SymbolIterator
Returns primary symbols within the address set.

Removing Symbols

boolean
Removes the specified symbol.For non-function symbols, behaves the same as Symbol.delete().For function symbols:
  • Default function symbols (e.g., FUN_12345678) are not removed
  • If no other labels exist at the entry point, function is renamed to default
  • If another label exists, that label is removed and function is renamed to it

Namespace Management

Create Namespaces

Namespace
Creates a new generic namespace.
GhidraClass
Creates a new class namespace.
Library
Creates a new external library namespace.

Get Namespaces

Namespace
Returns the namespace with the specified name in the parent namespace.
Namespace
Returns the deepest namespace containing the specified address.
Namespace
Gets or creates a namespace.

Namespace Queries

Symbol
Returns the generic namespace symbol.
Symbol
Returns the class symbol.
Symbol
Returns the library symbol.
Iterator<GhidraClass>
Returns an iterator over all class namespaces.

External Symbols

SymbolIterator
Returns all external symbols.
Symbol
Returns the first external symbol with the specified name.
SymbolIterator
Returns all external symbols with the specified name.

Entry Points

void
Adds an address to the external entry points.
void
Removes an address from the external entry points.
boolean
Checks if the address is an external entry point.
AddressIterator
Returns an iterator over all external entry point addresses.

Label History

LabelHistory[]
Returns the label history for the specified address.
Iterator<LabelHistory>
Returns an iterator over the complete label history.
boolean
Checks if there is label history at the address.

Symbol Queries

boolean
Checks if any symbol exists at the address.
int
Returns the total number of symbols.
long
Returns the unique symbol ID for a dynamic symbol at the address.
This ID should not be permanently stored as the encoding may change between releases.

Example Usage

Creating and Managing Symbols

Searching for Symbols

Analyzing Symbol Usage

Package Location