# x64dbg

{% hint style="warning" %}
The GitBook based NorthstarWiki has been replaced in favour of the [NorthstarDocs](https://docs.northstar.tf/) where this wiki has been integrated.

Check it out here: <https://docs.northstar.tf/Wiki/>

The same page on the new wiki should be located here: <https://docs.northstar.tf/Wiki/development/debugging/x64dbg>
{% endhint %}

{% hint style="warning" %}
If you are not experienced with x64dbg it its recommended to use [Visual Studio](https://r2northstar.gitbook.io/r2northstar-wiki/modding-and-development/development/debugging/visualstudio).
{% endhint %}

## Windows

* Download [x64dbg](https://x64dbg.com/)
* Extract the `release` folder somewhere on your PC
* Download the latest relase of [SycllaHide](https://github.com/x64dbg/ScyllaHide/releases/latest)
* Merge the contents of the `x64dbg` folder into the previously extracted `release` folder
* Run `x96dbg.exe`
  * You may receive a Windows SmartScreen prompt, x64dbg snapshots are not signed and will always cause these prompts
  * When running for the first time it will ask you some questions. After this is complete rerun the executable.
* Select `x64dbg` in the Launcher\
  ![](https://828676448-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1ZIQZZRL9Avtst3lrKej%2Fuploads%2Fgit-blob-3595ae9772660591f3fc7639b7b2fe22b858e6f1%2Fdebugger-x64dbg-launcher.png?alt=media)
* Do make debugging easier it is suggested to change your settings to the following:
  * Keeping System Breakpoint enabled is optional but useful\
    ![](https://828676448-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1ZIQZZRL9Avtst3lrKej%2Fuploads%2Fgit-blob-0928c5f9880e072d3dcf5b2a272cfc493c58bb58%2Fdebugger-x64dbg-events.png?alt=media)
  * Skipping INT3 stepping is recommended to prevent generic breakpoints from stopping the program\
    ![](https://828676448-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1ZIQZZRL9Avtst3lrKej%2Fuploads%2Fgit-blob-b0013598ba8af9e871d674f93c1b7f657442d62f%2Fdebugger-x64dbg-engine.png?alt=media)
  * Make sure to select the exception before disabling breaking. If you are debugging a C++ Exception you need to ignore common exceptions that occur during runtime\
    ![](https://828676448-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1ZIQZZRL9Avtst3lrKej%2Fuploads%2Fgit-blob-3dfa820449011e57452585b3eb497267c83c09c6%2Fdebugger-x64dbg-exceptions.png?alt=media)
* Open `NorthstarLauncher.exe` in x64dbg
* You are now free to debug Northstar

## Linux

{% hint style="warning" %}
Debugging Northstar under Linux is not trivial due to the direct dependency on Origin, unless you know your way around wine its recommended to debug on Windows.
{% endhint %}

To simplify the use of x64dbg and automate running Origin a community member has created a script: [ns-linux-dbg](https://github.com/R2NorthstarTools/ns-linux-dbg)

To run it simply invoke it: `./nsdbg.py`\
It supports a variety of options as well as vanilla wine and Proton, use the help flag to see all possible options: `./nsdbg.py --help`


---

# 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://r2northstar.gitbook.io/r2northstar-wiki/modding-and-development/development/debugging/x64dbg.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.
