Skip to content

Commit

Permalink
Support showing line:column numbers in stacktraces from JS builtins
Browse files Browse the repository at this point in the history
  • Loading branch information
Jarred-Sumner committed Aug 3, 2023
1 parent 157bd25 commit d3fbd84
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ RUN --mount=type=tmpfs,target=/webkitbuild \
-DUSE_THIN_ARCHIVES=OFF \
-DENABLE_FTL_JIT=ON \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-DALLOW_LINE_AND_COLUMN_NUMBER_IN_BUILTINS=ON \
-DENABLE_SINGLE_THREADED_VM_ENTRY_SCOPE=ON \
-G Ninja \
-DCMAKE_CXX_COMPILER=$(which clang++-15) \
Expand Down
4 changes: 4 additions & 0 deletions Source/JavaScriptCore/interpreter/Interpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,11 @@ class GetStackTraceFunctor {
if (m_results.size() < m_results.capacity()) {
if (visitor->isWasmFrame()) {
m_results.uncheckedAppend(StackFrame(visitor->wasmFunctionIndexOrName()));
#if USE(ALLOW_LINE_AND_COLUMN_NUMBER_IN_BUILTINS)
} else if (!!visitor->codeBlock()) {
#else
} else if (!!visitor->codeBlock() && !visitor->codeBlock()->unlinkedCodeBlock()->isBuiltinFunction()) {
#endif
m_results.uncheckedAppend(
StackFrame(m_vm, m_owner, visitor->callee().asCell(), visitor->codeBlock(), visitor->bytecodeIndex()));
} else {
Expand Down
8 changes: 8 additions & 0 deletions Source/cmake/OptionsJSCOnly.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@ set(ALL_EVENT_LOOP_TYPES
Generic
)

WEBKIT_OPTION_BEGIN()
WEBKIT_OPTION_DEFINE(ALLOW_LINE_AND_COLUMN_NUMBER_IN_BUILTINS "Whether to allow line numbers & column numbers in builtins" PUBLIC OFF)
if (ALLOW_LINE_AND_COLUMN_NUMBER_IN_BUILTINS)
set(ALLOW_LINE_AND_COLUMN_NUMBER_IN_BUILTINS ON)
SET_AND_EXPOSE_TO_BUILD(USE_ALLOW_LINE_AND_COLUMN_NUMBER_IN_BUILTINS 1)
endif ()
WEBKIT_OPTION_END()

set(DEFAULT_EVENT_LOOP_TYPE "Generic")

set(EVENT_LOOP_TYPE ${DEFAULT_EVENT_LOOP_TYPE} CACHE STRING "Implementation of event loop to be used in JavaScriptCore (one of ${ALL_EVENT_LOOP_TYPES})")
Expand Down
1 change: 1 addition & 0 deletions mac-release.bash
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ cmake \
-DCMAKE_EXE_LINKER_FLAGS="-fuse-ld=lld" \
-DCMAKE_AR=$(which llvm-ar) \
-DCMAKE_RANLIB=$(which llvm-ranlib) \
-DALLOW_LINE_AND_COLUMN_NUMBER_IN_BUILTINS=ON \
-G Ninja \
-DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 \
-DPTHREAD_JIT_PERMISSIONS_API=1 \
Expand Down

0 comments on commit d3fbd84

Please sign in to comment.