-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This PR supports cpptrace as an debug utility. Set `XGRAMMAR_ENABLE_CPPTRACE` to `ON` in config.cmake to enable it. Now it is only supported in Linux.
- Loading branch information
Showing
6 changed files
with
39 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
set(CMAKE_BUILD_TYPE RelWithDebInfo) | ||
set(XGRAMMAR_BUILD_PYTHON_BINDINGS ON) | ||
set(XGRAMMAR_BUILD_CXX_TESTS OFF) | ||
set(XGRAMMAR_ENABLE_CPPTRACE OFF) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/*! | ||
* Copyright (c) 2024 by Contributors | ||
* \file xgrammar/support/cpptrace.h | ||
* \details This file is an encapsulation of the cpptrace library. It helps debugging. This file | ||
* can only be included when XGRAMMAR_ENABLE_CPPTRACE is set to ON, and only support Linux and | ||
* RelWithDebugInfo or Debug build. | ||
*/ | ||
#ifndef XGRAMMAR_SUPPORT_CPPTRACE_H_ | ||
#define XGRAMMAR_SUPPORT_CPPTRACE_H_ | ||
|
||
#include <cpptrace/cpptrace.hpp> | ||
|
||
namespace xgrammar { | ||
|
||
inline void PrintTrace() { cpptrace::generate_trace().print(); } | ||
|
||
} // namespace xgrammar | ||
|
||
#endif // XGRAMMAR_SUPPORT_CPPTRACE_H_ |