Skip to content

Building V8 Disasm

hasherezade edited this page Jul 31, 2026 · 6 revisions

In order to use jsc_deobfuscator and View8 you need to first disassemble the file of your interest. This can be only done with a disassembler relevant to the particular V8 version for which your file was compiled.

This may require building V8 from sources, and then building the disassembler on the top of it.

Preparing the build toolkit

Depot Tools

Install depot_tools . It is enough to clone them:

git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git

Add them to the path:

export PATH=/home/tester/code/depot_tools:$PATH

Then we can leave the directory.

Ninja

Install Ninja build. In my case, installing it from the system repository was giving me errors, so I installed it directly from the github.

git clone https://github.com/ninja-build/ninja.git && cd ninja
git checkout release

Then follow the README to build it. Make sure that CMake is installed on your system.

The required steps:

./configure.py --bootstrap
cmake -Bbuild-cmake
cmake --build build-cmake

Test that everything built fine by running:

./build-cmake/ninja_test

Add the Ninja directory to the path. Together with depot tools it may look like:

export PATH="/home/tester/code/depot_tools:/home/tester/code/ninja:$PATH"

Building V8

Clone V8 by:

fetch v8
cd v8/
git checkout main
git pull origin

Select the tag that you need (the version compatible with the script to be decompiled). In my case I need to build version 10.2.154.26 so this is the tag I am checking out.

git checkout 10.2.154.26
git pull origin
gclient sync

Patching V8

Now we are ready to apply the patches required for the V8 code.

The View8 patch

The first patch can be found in the View8 fork repository by j4k0xb. We apply it by:

git apply -3 ~/v8.patch

Check for conflicts. Compare the conflicting part with the content of the patch, and remove the lines that were added unnecessarily.

Bugfix for string printing

There is one more patch that needs to be applied to fix a bug in the V8 code. This bug is causing some unwanted line breaks inside the strings. This is the patch:

v8_string_patch.diff

git apply ~/v8_string_patch.diff

Generating the build settings

Once the patches are applied, we are ready to build it, using depot tools and Ninja.

First issue the command:

python3 tools/dev/v8gen.py x64.release

It may happen that some error will occur, showing the error returned by the run commandline. Try to run those commands manually, to see what exactly happened.

/usr/bin/python3 -u tools/mb/mb.py gen -f infra/mb/mb_config.pyl -m developer_default -b x64.release out.gn/x64.release

In my case, I had to install the missing application pkd-config

sudo apt-get install pkd-config

After that, try again. Once the output was successfully generated, edit the file: out.gn/x64.release/args.gn as it is described in the View8 readme.

dcheck_always_on = false
is_component_build = false
is_debug = false
target_cpu = "x64"
use_custom_libcxx = false
v8_monolithic = true
v8_use_external_startup_data = false

v8_static_library = true
v8_enable_disassembler = true
v8_enable_object_print = true
v8_enable_pointer_compression = false

Building V8

Now we are ready to build View8 with Ninja.

ninja -C out.gn/x64.release v8_monolith

Building the V8Dasm

v8dasm.cpp

Once it is built, we can copy the v8dasm.cpp file into the directory with V8 and issue the command. It requires LLVM, but this can be installed easily from the package manager.

clang++ v8dasm.cpp -g -std=c++20 -Iinclude -Lout.gn/x64.release/obj -lv8_libbase -lv8_libplatform -lv8_monolith -o v8dasm

It should give us the v8dasm ELF.

Clone this wiki locally