namespaces
Organize and recover C++ namespaces and classes in stripped firmware: list existing ones, create new hierarchy levels, move symbols into them, and auto-type class methods with the this pointer.
Instructions
List, create, or populate C++ namespaces and classes.
Namespaces and classes are real Ghidra `Namespace`/`GhidraClass` objects,
not name prefixes. Use this to recover C++ structure in stripped firmware:
create a class per recovered vtable, then move its methods into it.
Actions:
- `list`: return the namespaces and classes in the program as JSON, each
with its qualified name, `type` (`Namespace`/`Class`/...), and member
count. Filter with `filter` (substring or glob over name/qualified name).
- `create`: create the namespace or class at `path` (a `::`-separated path
such as `MyClass` or `ns::sub::Inner`). Missing parent levels are created
as plain namespaces. `kind="class"` makes the final level a `GhidraClass`
(an existing plain namespace at that path is converted to a class);
`kind="namespace"` makes it a plain namespace. Existing entries are
reused, so this is idempotent.
- `move`: move the symbol at `target` (address, label, or function name)
into `namespace` (created if missing, honoring `kind`). Functions are
reparented; other symbols are moved with their name preserved.
- `type_methods`: for the class at `path`, set the first parameter of every
function member to `<class> *this` (adding one if a method has none) so
the decompiler propagates the class type. The class is created if missing.
Methods already typed with the class pointer are left as-is. Reports
`typed_methods` and `already_typed`. Use this to type a whole class at
once instead of calling `set_prototype` per method.
Args:
program: Required Ghidra project path or name to target.
action: One of `list`, `create`, `move`, or `type_methods`.
path: Namespace/class path for `create`/`type_methods`, e.g. `MyClass`
or `a::b::C`.
target: Symbol selector for `move` (address, label, or function name).
namespace: Destination namespace/class path for `move`.
kind: `namespace` or `class`; the kind of the final level that
`create`/`move` resolves or creates.
filter: Substring/glob filter for `list`. `*` returns everything.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| kind | No | namespace | |
| path | No | ||
| action | No | list | |
| filter | No | * | |
| target | No | ||
| program | Yes | ||
| namespace | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |