Skip to content

Instantly share code, notes, and snippets.

Yury Delendik yurydelendik

Block or report user

Report or block yurydelendik

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View run_wasmtime.md

This document shows how to embed the wasmtime and run a simple wasm code.

Create wasm

Let's create a simple WebAssembly file with a single exported function that returns an integer:

(;; wat2wasm hello.wat -o $WASM_FILES/hello.wasm ;;)
(module
  (func (export "answer") (result i32)
View fluence_hacks.patch
diff --git a/bench/vm/bencher/project/BenchTestGenerator.py b/bench/vm/bencher/project/BenchTestGenerator.py
index a7b8ff41..933e6f2b 100644
--- a/bench/vm/bencher/project/BenchTestGenerator.py
+++ b/bench/vm/bencher/project/BenchTestGenerator.py
@@ -47,7 +47,7 @@ class BenchTestGenerator:
generated_tests_dir_full_path = join(out_dir, self.generated_tests_dir)
test_mv_cmd = "mv {} {}".format(
- join(out_dir, "wasm32-unknown-unknown", "release", "{}.wasm"),
+ join(out_dir, "wasm32-unknown-unknown", "release", "{}_wasm.wasm"),
View hello2.expanded.rs
#![feature(prelude_import)]
#![no_std]
#![doc = " Translation of hello example"]
#[prelude_import]
use ::std::prelude::v1::*;
#[macro_use]
extern crate std as std;
use failure::{bail, format_err, Error};
use std::cell::Ref;
use std::fs::read;
View node-wasi-sassc.patch
diff --git a/run.js b/run.js
index 87928f1..94f353d 100755
--- a/run.js
+++ b/run.js
@@ -30,9 +30,11 @@ USAGE:
const bin = fs.readFileSync(process.argv[2]);
const mod = new WebAssembly.Module(bin);
+const preopenDirectories = {};
+preopenDirectories[process.cwd()] = process.cwd();
@yurydelendik
yurydelendik / lldb-jit-unwind.diff
Created Feb 12, 2019
Trust JIT unwind plan patch for lldb
View lldb-jit-unwind.diff
diff --git a/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp b/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
index 423b2e53c66..62dedbd75a6 100644
--- a/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
+++ b/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
@@ -829,6 +829,22 @@ UnwindPlanSP RegisterContextLLDB::GetFullUnwindPlanForFrame() {
}
}
+ // The JIT generated module may generate their .eh_frame or .debug_frame
+ // sections. It makes sense to trust that unwind plan if it is valid.
@yurydelendik
yurydelendik / sourceURLPrefixes.md
Created Aug 29, 2018
sourceURLPrefixes WebAssembly custom section
View sourceURLPrefixes.md

sourceURLPrefixes WebAssembly custom section

This custom section is created to provide mapping of the local (or remote) file paths to network resources. Currently we can have DWARF sections inside the binary WebAssembly file, however debugger, in most of the cases, cannot retrive local files -- this file paths needs to be mapped to some networks server location.

Format

The custom section has the following format:

@yurydelendik
yurydelendik / x-scopes.md
Created Aug 1, 2018
Experimental "x-scopes" source maps extension
View x-scopes.md

Experimental "x-scopes" source maps extension

This is crude attempt to add DWARF-like information to the existing wasm source maps. It is not intendent to be used as a final solution, but provides overview of the information that can be used by a consumer/debugger of wasm code.

The source maps JSON is extended to add the x-scopes field at the top level that will contains all information generated by LLVM's llvm-dwarfdump command. To reduce burden of parsing at the consumer side, the dump will be converted to the JSON using following rules:

  1. DW_TAG_xxx entity will be converted to a JS object with tag field with xxx value.
  2. If the above entry has nested level of children, the children field will be added and will contain JS array.
  3. DW_AT_yyy attributes will be assigned at fields to the enclosing object with yyy name. Theirs values will be:
@yurydelendik
yurydelendik / get_dwarf_info.py
Last active Jul 21, 2018
Extarct DWARF-like information from binary WASM
View get_dwarf_info.py
#!/usr/bin/env python
"""Utility to extract .debug_info section and print that in JSON format.
"""
import argparse
from collections import OrderedDict
import json
import logging
from math import ceil, log
import os
@yurydelendik
yurydelendik / dwarf-wasm.md
Last active Jul 23, 2018
DWARF for WebAssembly target
View dwarf-wasm.md
@yurydelendik
yurydelendik / dbg_value.diff
Last active Jan 20, 2019
Attept to extend DBG_VALUE functionality
View dbg_value.diff
Index: include/llvm/BinaryFormat/Dwarf.def
===================================================================
diff --git a/llvm/trunk/include/llvm/BinaryFormat/Dwarf.def b/llvm/trunk/include/llvm/BinaryFormat/Dwarf.def
--- a/llvm/trunk/include/llvm/BinaryFormat/Dwarf.def (revision 336356)
+++ b/llvm/trunk/include/llvm/BinaryFormat/Dwarf.def (working copy)
@@ -617,6 +617,8 @@
// Vendor extensions:
// Extensions for GNU-style thread-local storage.
HANDLE_DW_OP(0xe0, GNU_push_tls_address, 0, GNU)
+// Extensions for WebAssembly.
You can’t perform that action at this time.