New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin Debugging Request Stack Trace #684

Closed
Headline opened this Issue Sep 16, 2017 · 1 comment

Comments

Projects
None yet
2 participants
@Headline
Member

Headline commented Sep 16, 2017

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

@KyleSanderson

This comment has been minimized.

Show comment
Hide comment
@KyleSanderson

KyleSanderson Sep 24, 2017

Member

Lets track this in the PR (SM imp is fine, awaiting the SP merge).

Member

KyleSanderson commented Sep 24, 2017

Lets track this in the PR (SM imp is fine, awaiting the SP merge).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment