diff options
| author | Anders Leino <aleino@nvidia.com> | 2025-01-08 08:30:18 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-07 22:30:18 -0800 |
| commit | 5b9931456f595b0a2163fabb65dceac99e0e220f (patch) | |
| tree | 1329b9bdb3fd77349e6a03dc4d2d1c34251f219b /examples/example-base/example-base.h | |
| parent | c43f6fa55aca23365c86c6ec1737d42be74d9d3e (diff) | |
Add backtraces to examples (#5973)
* examples: Log stack trace on exceptions
For now, this is only implemented on Windows.
This helps to address #5520.
* examples: Print log file if there is any
* format code
---------
Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
Co-authored-by: Yong He <yonghe@outlook.com>
Diffstat (limited to 'examples/example-base/example-base.h')
| -rw-r--r-- | examples/example-base/example-base.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/examples/example-base/example-base.h b/examples/example-base/example-base.h index 6988d613b..9aabac8d4 100644 --- a/examples/example-base/example-base.h +++ b/examples/example-base/example-base.h @@ -10,6 +10,19 @@ void _Win32OutputDebugString(const char* str); #endif +#define SLANG_STRINGIFY(x) #x +#define SLANG_EXPAND_STRINGIFY(x) SLANG_STRINGIFY(x) + +#ifdef _WIN32 +#define EXAMPLE_MAIN(innerMain) \ + extern const char* const g_logFileName = \ + "log-" SLANG_EXPAND_STRINGIFY(SLANG_EXAMPLE_NAME) ".txt"; \ + PLATFORM_UI_MAIN(innerMain); + +#else +#define EXAMPLE_MAIN(innerMain) PLATFORM_UI_MAIN(innerMain) +#endif // _WIN32 + struct WindowedAppBase : public TestBase { protected: |
