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

Add LogStackTrace Native (#684) #685

Merged
merged 1 commit into from Jun 20, 2018

Conversation

Projects
None yet
3 participants
@Headline
Member

Headline commented Sep 17, 2017

In order for this to be merged, this pr for sourcepawn must be merged.

Essentially this adds pull request adds LogStackTrace, which will serve as a debugging function that outputs a stack trace where the native is called, but does not halt execution. For more info: see #684

#include <sourcemod>

public void OnPluginStart()
{
	SomeFunction();
}

void SomeFunction()
{
	SomeFunction2();
}

void SomeFunction2()
{
	LogStackTrace("LogStackTrace%i %.2f", 4, 10.0)
	SetFailState("SetFailState %i %.2f", 4, 10.0)
}

will output in errors

L 09/17/2017 - 15:07:55: [SM] Stack trace requested: LogStackTrace 4 10.00
L 09/17/2017 - 15:07:55: [SM] Call stack trace:
L 09/17/2017 - 15:07:55: [SM]   [0] LogStackTrace
L 09/17/2017 - 15:07:55: [SM]   [1] Line 15, C:\Users\Micha\Desktop\sourcemod\sourcemod\build\package\addons\sourcemod\Test.sp::SomeFunction2
L 09/17/2017 - 15:07:55: [SM]   [2] Line 10, C:\Users\Micha\Desktop\sourcemod\sourcemod\build\package\addons\sourcemod\Test.sp::SomeFunction
L 09/17/2017 - 15:07:55: [SM]   [3] Line 5, C:\Users\Micha\Desktop\sourcemod\sourcemod\build\package\addons\sourcemod\Test.sp::OnPluginStart
L 09/17/2017 - 15:07:55: [SM] Exception reported: SetFailState 4 10.00
L 09/17/2017 - 15:07:55: [SM] Blaming: test.smx
L 09/17/2017 - 15:07:55: [SM] Call stack trace:
L 09/17/2017 - 15:07:55: [SM]   [0] SetFailState
L 09/17/2017 - 15:07:55: [SM]   [1] Line 16, C:\Users\Micha\Desktop\sourcemod\sourcemod\build\package\addons\sourcemod\Test.sp::SomeFunction2
L 09/17/2017 - 15:07:55: [SM]   [2] Line 10, C:\Users\Micha\Desktop\sourcemod\sourcemod\build\package\addons\sourcemod\Test.sp::SomeFunction
L 09/17/2017 - 15:07:55: [SM]   [3] Line 5, C:\Users\Micha\Desktop\sourcemod\sourcemod\build\package\addons\sourcemod\Test.sp::OnPluginStart
@KyleSanderson

I'm thankful this isn't actually RequestStackFrame, but RequestStackTrace. I think this would confuse the hell out of people if it was the former :-P

Show outdated Hide outdated core/logic/smn_core.cpp
Show outdated Hide outdated core/logic/smn_core.cpp
Show outdated Hide outdated core/logic/DebugReporter.h
Show outdated Hide outdated core/logic/DebugReporter.cpp
Show outdated Hide outdated core/logic/smn_core.cpp
Show outdated Hide outdated core/logic/DebugReporter.cpp
@KyleSanderson

lgtm minus the nits (but they're nits); nice job.

Show outdated Hide outdated core/logic/DebugReporter.cpp
Show outdated Hide outdated core/logic/smn_core.cpp

@Headline Headline changed the title from Add RequestStackFrame Native (#684) to Add RequestStackTrace Native (#684) Sep 25, 2017

@Headline Headline changed the title from Add RequestStackTrace Native (#684) to Add LogStackTrace Native (#684) Sep 26, 2017

@Headline Headline closed this Oct 3, 2017

@Headline Headline reopened this Oct 3, 2017

@Headline Headline closed this Jun 19, 2018

@Headline Headline reopened this Jun 19, 2018

@KyleSanderson KyleSanderson merged commit 9ceb1af into alliedmodders:master Jun 20, 2018

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@Headline Headline referenced this pull request Jul 31, 2018

Merged

Fix LogStackTrace Anomaly #863

@Headline Headline deleted the Headline:sync-upstream branch Jul 31, 2018

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