# Other Diagnostics

There are various diagnostic tools that the kernel can make use of, including those listed below.

## Stack Frames

This is internally used by the kernel debugger and the kernel exception to allow getting information about the source code that generated the call. Currently, this information is provided:

* Method name: The routine name that made a call to the class constructor
* Line number: The line number of the method described above
* Column number: The column number found within the line
* File name: The file name of the class that the method situates

When the constructor is called, it generates information about the third stack frame to get the caller's method info. If the frame number is specified, it gets offset by `+1` to get info about the needed method.

{% hint style="info" %}
This method is internally called by the debug writer. If you really want to create an instance of this class, you'll have to use Reflection. The class name is `DebugStackFrame` in the `KS.Kernel.Debugging.Trace` namespace.
{% endhint %}

## Kernel dump files

<figure><img src="/files/GLcNRY8uyT9yR1T9dsSQ" alt=""><figcaption></figcaption></figure>

In the event that the kernel reported a kernel panic in all of the types, whether continuable or uncontinuable, the kernel dump file will be generated under the name of `dmp_date_time.txt` in the kernel configuration directory. These files assist us in debugging the severe kernel crashes in case the bug involves this event.

The kernel error codes are listed below from the least severe to the most severe:

* `C`: Indicates that the kernel error is minor, but still serious
* `S`: Serious kernel error
* `F`: Fatal kernel error
* `U`: Unrecoverable kernel error

The first-chance kernel errors of the above types are the first failures. During the error handling, if it encountered a second failure, it escalates the severity of the error to the double panic. Finally, if the double panic handler experiences a third fault, the host operating system will force the kernel to exit.

{% hint style="info" %}
In case of the third failure events, you can find the event in the Application Events within the Event Viewer if running on Windows or the error directly dumped to the application on Linux.
{% endhint %}

## Kernel Exceptions

The kernel exceptions are just normal errors with a generic message intended to display extended information about the error the kernel is experiencing. The kernel exception types and their messages are typically found in this file:

{% embed url="<https://github.com/Aptivi/Kernel-Simulator/blob/master/public/Kernel%20Simulator/Kernel/Exceptions/KernelExceptionMessages.cs>" %}

To make a kernel exception, throw a new instance of `KernelException` found in the `KS.Kernel.Exceptions` namespace in one of the forms:

```csharp
public KernelException(KernelExceptionType exceptionType)
public KernelException(KernelExceptionType exceptionType, Exception e)
public KernelException(KernelExceptionType exceptionType, string message)
public KernelException(KernelExceptionType exceptionType, string message, params object[] vars)
public KernelException(KernelExceptionType exceptionType, string message, Exception e)
public KernelException(KernelExceptionType exceptionType, string message, Exception e, params object[] vars)
```

Typically, the message displays the exception type, the message, and the exception information. As always, if you believe that it's a bug, make an issue in our GitHub repository.


---

# 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://aptivi.gitbook.io/deprecated/nitrocid-ks-v0.1.0-beta-2-manual/advanced-and-power-users/diagnostics/other-diagnostics.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.
