---
name: "DB_ALIAS"
section: "9"
platform: "freebsd"
package: "base"
version: "16.0-CURRENT-20261027-61c70dc16a79"
release: "FreeBSD 16.0-CURRENT (2026-10-27)"
platforms: ["freebsd"]
url: "https://new.carta.tech/DB_ALIAS"
---

# DB\_ALIAS(9)

Extends the ddb command set

## NAME

**DB\_COMMAND**, **DB\_COMMAND\_FLAGS**, **DB\_SHOW\_COMMAND**, **DB\_SHOW\_COMMAND\_FLAGS**, **DB\_SHOW\_ALL\_COMMAND**, **DB\_TABLE\_COMMAND**, **DB\_TABLE\_COMMAND\_FLAGS**, **DB\_ALIAS**, **DB\_ALIAS\_FLAGS**, **DB\_SHOW\_ALIAS**, **DB\_SHOW\_ALIAS\_FLAGS**, **DB\_SHOW\_ALL\_ALIAS**, **DB\_TABLE\_ALIAS**, **DB\_TABLE\_ALIAS\_FLAGS**, **DB\_DECLARE\_TABLE**, **DB\_DEFINE\_TABLE** – Extends the ddb command set

## SYNOPSIS

**#include \<ddb/ddb.h\>**

**DB\_COMMAND**(*command\_name*, *command\_function*);

**DB\_COMMAND\_FLAGS**(*command\_name*, *command\_function*, *flags*);

**DB\_SHOW\_COMMAND**(*command\_name*, *command\_function*);

**DB\_SHOW\_COMMAND\_FLAGS**(*command\_name*, *command\_function*, *flags*);

**DB\_SHOW\_ALL\_COMMAND**(*command\_name*, *command\_function*);

**DB\_TABLE\_COMMAND**(*table*, *command\_name*, *command\_function*);

**DB\_TABLE\_COMMAND\_FLAGS**(*table*, *command\_name*, *command\_function*, *flags*);

**DB\_ALIAS**(*alias\_name*, *command\_function*);

**DB\_ALIAS\_FLAGS**(*alias\_name*, *command\_function*, *flags*);

**DB\_SHOW\_ALIAS**(*alias\_name*, *command\_function*);

**DB\_SHOW\_ALIAS\_FLAGS**(*alias\_name*, *command\_function*, *flags*);

**DB\_SHOW\_ALL\_ALIAS**(*alias\_name*, *command\_function*);

**DB\_TABLE\_ALIAS**(*table*, *alias\_name*, *command\_function*);

**DB\_TABLE\_ALIAS\_FLAGS**(*table*, *alias\_name*, *command\_function*, *flags*);

**DB\_DEFINE\_TABLE**(*parent*, *name*, *table*);

**DB\_DECLARE\_TABLE**(*table*);

## DESCRIPTION

The **DB\_COMMAND**() macro adds *command\_name* to the list of top-level commands. Invoking *command\_name* from ddb will call *command\_function*.

The **DB\_SHOW\_COMMAND**() and **DB\_SHOW\_ALL\_COMMAND**() macros are roughly equivalent to **DB\_COMMAND**() but in these cases, *command\_name* is a sub-command of the ddb **show** command and **show** **all** command, respectively.

The **DB\_TABLE\_COMMAND**() macro is also similar to **DB\_COMMAND**() but adds the new command as a sub-command of the ddb command *table*.

The **DB\_ALIAS**(), **DB\_SHOW\_ALIAS**(), **DB\_SHOW\_ALL\_ALIAS**(), and **DB\_TABLE\_ALIAS**() macros register the existing *command\_function* under the alternative command name *alias\_name*.

The \_FLAGS variants of these commands allow the programmer to specify a value for the *flag* field of the command structure. The possible flag values are defined alongside *struct* *db\_command* in ⟨ddb/ddb.h⟩.

The general command syntax: **command**\[/*modifier*\] *address*\[,*count*\], translates into the following parameters for *command\_function*:

- *addr*

  The address passed to the command as an argument.

- *have\_addr*

  A boolean value that is true if the addr field is valid.

- *count*

  The number of quad words starting at offset *addr* that the command must process.

- *modif*

  A pointer to the string of modifiers. That is, a series of symbols used to pass some options to the command. For example, the **examine** command will display words in decimal form if it is passed the modifier "d".

The **DB\_DEFINE\_TABLE**() macro adds a new command *name* as a sub-command of the existing command table *parent*. The new command defines a table named *table* which contains sub-commands. New commands and aliases can be added to this table by passing *table* as the first argument to one of the DB\_TABLE\_ macros.

## EXAMPLES

In your module, the command is declared as:

```
DB_COMMAND(mycmd, my_cmd_func)
{
	if (have_addr)
		db_printf("Calling my command with address %p\n", addr);
}
```

An alias for this command is declared as:

```
DB_ALIAS(mycmd2, my_cmd_func);
```

Then, when in ddb:

```
db> mycmd 0x1000
Calling my command with address 0x1000
db> mycmd2 0x2500
Calling my command with address 0x2500
db>
```

## SEE ALSO

[ddb(4)](/ddb/4.md)

## AUTHORS

This manual page was written by Guillaume Ballet ⟨*gballet@gmail.com*⟩.
