# Debugging

When you are coding, things happen. When code goes live, things happen. Sometime, when those things happen it isn't practical, or in some cases even possible, to use XDebug in a fancy IDE. The old fashioned, light weight approach of echoing variables from deep inside the code comes to the rescue. But, echo and var\_export have are not the most friendly or productive tools. This is where `Xmf\Debug` is your friend.

```php
    \Xmf\Debug::dump($GLOBALS['xoopsModule']);
```

Output this when executed:

![dump output](/files/-LD6N0KCzVkKTNCGrwr5)

Clicking on the dump line opens it:

![dump output](/files/-LD6N0KFo8l_Lv5Tec-Z)

You can dump multiple variable in one line:

```php
    \Xmf\Debug::dump($counter, $output, $handler);
```

Need to take a look at your inputs?

```php
    \Xmf\Debug::dump($_POST);
```

How did we get here?

```php
    \Xmf\Debug::backtrace();
```

Always there, Xmf\Debug can be a handy tool to keep in mind.


---

# Agent Instructions: 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:

```
GET https://xoops.gitbook.io/xmf-cookbook/basic-ingredients/debugging.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
