---
name: "diag_stacktrace"
type: command
status: ok
groups: ["Diagnostic"]
arma3_since: "2.06"
locality: {"argument": null, "effect": null, "server_exec": false}
source: https://community.bistudio.com/wiki/diag_stacktrace
revid: 351630
updated: 2023-12-11T19:47:32Z
---

# diag_stacktrace

*Command · Diagnostic · Arma 3 v2.06*

## Description

Returns an array containing the function name, line number, scope name and all local variables in form of a hashmap.

## Syntax

```sqf
diag_stacktrace
```

**Returns:** [Array](../topics/Array.md) of [Array](../topics/Array.md)s, in format:

```sqf
params ["_functionName", "_lineNumber", "_scopeName", "_variablesHashmap"];
```

- _functionName: [String](../topics/String.md) - function name
- _lineNumber: [Number](../topics/Number.md) - line number
- _scopeName: [String](../topics/String.md) - scope name
- _variablesHashmap: [HashMap](../topics/HashMap.md) - all local variables

## Examples

### Example 1

```sqf
private _testvar = 1;
private _testother = 2;
call 
{
    _testvar = 3;
    if (_testvar == 3) then 
    {
        _myVariable = 4;
        hint str diag_stacktrace;
    };
};
/*
[
    ["", 3, "", [["_this", []], ["_testother", 2], ["_testvar", 3]]],
    ["", 6, "", []],
    ["", 8, "", [["_myvariable", 4]]]
]
*/
```

## See also

arma.RPT · [diag_dumpCalltraceToLog](../commands/diag_dumpCalltraceToLog.md) · [diag_log](../commands/diag_log.md)

<sub>Source: [BI Community Wiki — diag stacktrace](https://community.bistudio.com/wiki/diag_stacktrace) (revision 351630).</sub>
