> For the complete documentation index, see [llms.txt](https://0x29a.gitbook.io/0x29a-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://0x29a.gitbook.io/0x29a-docs/memory-and-analysis/func.md).

# func

**analysis · global: `func`**

Function-boundary detection and cross-references (xrefs), built on top of `disasm`.

### `func.start(addr) -> addr | nil`

Tries to find the start of the function containing `addr` (scans backwards until it finds a recognizable prologue).

### `func.size(addr) -> integer`

Computes the size in bytes of the function starting at `addr`.

### `func.calls(addr) -> [addr]`

Lists the target addresses of every `call` inside the function at `addr`.

### `func.xrefs_to(addr) -> [{from, to, type}]`

Who calls/jumps/references `addr`. `type` is `"call"`, `"jmp"`, or `"data"`.

### `func.xrefs_from(addr) -> [{from, to, type}]`

The reverse: where the function at `addr` calls/jumps/references.

```lua
local start = func.start(rip)
print("function starts at", string.format("0x%X", start))

for _, x in ipairs(func.xrefs_to(start)) do
    print(string.format("  referenced from 0x%X (%s)", x.from, x.type))
end
```

See the global helper [`analyze(addr)`](/0x29a-docs/globals/helpers.md#analyze-a) which combines `func.*` and `sym.*` into a ready-to-print summary.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://0x29a.gitbook.io/0x29a-docs/memory-and-analysis/func.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
