Skip to content

Plugin Debugging Request Stack Trace #684

@Headline

Description

@Headline

This is a github remake of the older Dump call stack request, but I wanted to have some more discussion about it in regards to how it'll look in the SM API, and how it'll actually be implemented. I'm thinking that the usage will look something like this

public void OnPluginStart() {
     RequestStackTrace("Some message");
}

and the expected output would be something like

L 09/16/2017 - 22:40:21: [SM] Stack trace requested: Some message
L 09/16/2017 - 22:40:21: [SM] Displaying call stack trace for plugin "test.smx":
L 09/16/2017 - 22:40:21: [SM] [0] Line 1, test.sp::OnPluginStart()
L 09/16/2017 - 22:40:21: [SM] [1] Line 2, test.sp::RequestStackTrace()

As far as implementation here are my notes I took while brainstorming. This is where I'd like anyone's criticisms

Looked at the definition for DebugReport::ReportError ; https://github.com/alliedmodders/sourcemod/blob/master/core/logic/DebugReporter.cpp#L158

Looking to either create 'DebugReport::GetTrace(IFrameIterator)', but the problem is that the trace is logged step by step, and not cached at all.
This means that DebugReport::GetTrace would have to return a 2d char array. One column per line of the stack trace. Then I'd have to change DebugReport::ReportError
and have it just loop that array and throw it's contents to logs.

This adds an extra step for DebugReport::ReportError, but also allows us to make stack traces more dynamically. In fact, the presence of a bool 'isIntentional' could
allow us to determine if "Stack trace requested: %s" should be used instead of "Exception reported: %s"

I'd like to implement this myself, but this issue is primarily for discussion & approval from SM Core devs

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions