diff options
| author | Copilot <198982749+Copilot@users.noreply.github.com> | 2025-07-21 09:30:24 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-07-21 16:30:24 +0000 |
| commit | 368ddbb7b99dfb939d20f53c35d05b2b4758bd64 (patch) | |
| tree | 25f86c54c3949a5fe4dd11c704d67e63a6e7d4e3 /source/slang/slang.cpp | |
| parent | 7343c7110c38b3ce71d679222dccf438190865b0 (diff) | |
Add utility to trace creation of problematic IRInsts to assist LLM in debugging (#7820)
* Initial plan
* Add SLANG_DEBUG_IR_BREAK environment variable support
Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com>
* Apply code formatting to SLANG_DEBUG_IR_BREAK implementation
Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com>
* Improve stack trace debugging with -rdynamic flag and backtrace_symbols
Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com>
* Address PR feedback: use PlatformUtil::getEnvironmentVariable, remove -rdynamic flag, and delete fallback branch
Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com>
* Address PR feedback: simplify env var parsing, move backtrace to PlatformUtil, use #if for SLANG_LINUX_FAMILY
Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com>
* Address PR feedback: remove unneeded include, make backtrace() more generic by removing uid parameter
Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com>
* Fix and clone source tracking.
* Add python script to dump traces.
* Update instructions.
* Batch calls to addr2line
* Cleanup claude instructions.
* update claude action.
* Remove duplicated build instructions from claude.yml workflow
Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com>
* fix build error.
* Fix build errors
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com>
Co-authored-by: Yong He <yonghe@outlook.com>
Co-authored-by: Gangzheng Tong <tonggangzheng@gmail.com>
Diffstat (limited to 'source/slang/slang.cpp')
| -rw-r--r-- | source/slang/slang.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/source/slang/slang.cpp b/source/slang/slang.cpp index f65681e4b..29ca2328b 100644 --- a/source/slang/slang.cpp +++ b/source/slang/slang.cpp @@ -4,8 +4,10 @@ #include "../core/slang-castable.h" #include "../core/slang-io.h" #include "../core/slang-performance-profiler.h" +#include "../core/slang-platform.h" #include "../core/slang-shared-library.h" #include "../core/slang-string-util.h" +#include "../core/slang-string.h" #include "../core/slang-type-convert-util.h" #include "../core/slang-type-text-util.h" // Artifact @@ -24,6 +26,7 @@ #include "slang-check.h" #include "slang-doc-ast.h" #include "slang-doc-markdown-writer.h" +#include "slang-ir.h" #include "slang-lookup.h" #include "slang-lower-to-ir.h" #include "slang-mangle.h" @@ -160,6 +163,21 @@ void Session::init() { SLANG_ASSERT(BaseTypeInfo::check()); +#if SLANG_ENABLE_IR_BREAK_ALLOC + // Read environment variable for IR debugging + StringBuilder irBreakEnv; + if (SLANG_SUCCEEDED(PlatformUtil::getEnvironmentVariable( + UnownedStringSlice("SLANG_DEBUG_IR_BREAK"), + irBreakEnv))) + { + String envValue = irBreakEnv.produceString(); + if (envValue.getLength()) + { + _slangIRAllocBreak = stringToInt(envValue); + _slangIRPrintStackAtBreak = true; + } + } +#endif _initCodeGenTransitionMap(); |
