├── .github └── workflows │ └── semgrep.yml ├── .gitignore ├── Cargo.lock ├── Cargo.toml ├── LICENSE ├── README.md ├── example ├── .gitignore ├── Cargo.toml ├── README.md ├── package.json ├── src │ ├── entry.mjs │ └── lib.rs └── wrangler.toml ├── package.json ├── src ├── lib.rs └── sentry.rs ├── wasm-coredump-js ├── .gitignore ├── index.mjs ├── package.json └── yarn.lock ├── wrangler.toml └── yarn.lock /.github/workflows/semgrep.yml: -------------------------------------------------------------------------------- 1 | on: 2 | pull_request: {} 3 | workflow_dispatch: {} 4 | push: 5 | branches: 6 | - main 7 | - master 8 | schedule: 9 | - cron: '0 0 * * *' 10 | name: Semgrep config 11 | jobs: 12 | semgrep: 13 | name: semgrep/ci 14 | runs-on: ubuntu-latest 15 | env: 16 | SEMGREP_APP_TOKEN: ${{ secrets.SEMGREP_APP_TOKEN }} 17 | SEMGREP_URL: https://cloudflare.semgrep.dev 18 | SEMGREP_APP_URL: https://cloudflare.semgrep.dev 19 | SEMGREP_VERSION_CHECK_URL: https://cloudflare.semgrep.dev/api/check-version 20 | container: 21 | image: semgrep/semgrep 22 | steps: 23 | - uses: actions/checkout@v4 24 | - run: semgrep ci 25 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | target/ 3 | -------------------------------------------------------------------------------- /Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | version = 3 4 | 5 | [[package]] 6 | name = "adler" 7 | version = "1.0.2" 8 | source = "registry+https://github.com/rust-lang/crates.io-index" 9 | checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" 10 | 11 | [[package]] 12 | name = "aho-corasick" 13 | version = "1.0.2" 14 | source = "registry+https://github.com/rust-lang/crates.io-index" 15 | checksum = "43f6cb1bf222025340178f382c426f13757b2960e89779dfcb319c32542a5a41" 16 | dependencies = [ 17 | "memchr", 18 | ] 19 | 20 | [[package]] 21 | name = "android-tzdata" 22 | version = "0.1.1" 23 | source = "registry+https://github.com/rust-lang/crates.io-index" 24 | checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" 25 | 26 | [[package]] 27 | name = "async-trait" 28 | version = "0.1.71" 29 | source = "registry+https://github.com/rust-lang/crates.io-index" 30 | checksum = "a564d521dd56509c4c47480d00b80ee55f7e385ae48db5744c67ad50c92d2ebf" 31 | dependencies = [ 32 | "proc-macro2", 33 | "quote", 34 | "syn 2.0.26", 35 | ] 36 | 37 | [[package]] 38 | name = "atty" 39 | version = "0.2.14" 40 | source = "registry+https://github.com/rust-lang/crates.io-index" 41 | checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" 42 | dependencies = [ 43 | "hermit-abi 0.1.19", 44 | "libc", 45 | "winapi", 46 | ] 47 | 48 | [[package]] 49 | name = "autocfg" 50 | version = "1.1.0" 51 | source = "registry+https://github.com/rust-lang/crates.io-index" 52 | checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" 53 | 54 | [[package]] 55 | name = "bitflags" 56 | version = "2.3.3" 57 | source = "registry+https://github.com/rust-lang/crates.io-index" 58 | checksum = "630be753d4e58660abd17930c71b647fe46c27ea6b63cc59e1e3851406972e42" 59 | 60 | [[package]] 61 | name = "bumpalo" 62 | version = "3.13.0" 63 | source = "registry+https://github.com/rust-lang/crates.io-index" 64 | checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1" 65 | 66 | [[package]] 67 | name = "byteorder" 68 | version = "1.4.3" 69 | source = "registry+https://github.com/rust-lang/crates.io-index" 70 | checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" 71 | 72 | [[package]] 73 | name = "bytes" 74 | version = "1.4.0" 75 | source = "registry+https://github.com/rust-lang/crates.io-index" 76 | checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" 77 | 78 | [[package]] 79 | name = "cc" 80 | version = "1.0.79" 81 | source = "registry+https://github.com/rust-lang/crates.io-index" 82 | checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" 83 | 84 | [[package]] 85 | name = "cfg-if" 86 | version = "1.0.0" 87 | source = "registry+https://github.com/rust-lang/crates.io-index" 88 | checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" 89 | 90 | [[package]] 91 | name = "chrono" 92 | version = "0.4.26" 93 | source = "registry+https://github.com/rust-lang/crates.io-index" 94 | checksum = "ec837a71355b28f6556dbd569b37b3f363091c0bd4b2e735674521b4c5fd9bc5" 95 | dependencies = [ 96 | "android-tzdata", 97 | "js-sys", 98 | "num-traits", 99 | "wasm-bindgen", 100 | ] 101 | 102 | [[package]] 103 | name = "chrono-tz" 104 | version = "0.6.3" 105 | source = "registry+https://github.com/rust-lang/crates.io-index" 106 | checksum = "29c39203181991a7dd4343b8005bd804e7a9a37afb8ac070e43771e8c820bbde" 107 | dependencies = [ 108 | "chrono", 109 | "chrono-tz-build", 110 | "phf", 111 | ] 112 | 113 | [[package]] 114 | name = "chrono-tz-build" 115 | version = "0.0.3" 116 | source = "registry+https://github.com/rust-lang/crates.io-index" 117 | checksum = "6f509c3a87b33437b05e2458750a0700e5bdd6956176773e6c7d6dd15a283a0c" 118 | dependencies = [ 119 | "parse-zoneinfo", 120 | "phf", 121 | "phf_codegen", 122 | ] 123 | 124 | [[package]] 125 | name = "colored" 126 | version = "2.0.4" 127 | source = "registry+https://github.com/rust-lang/crates.io-index" 128 | checksum = "2674ec482fbc38012cf31e6c42ba0177b431a0cb6f15fe40efa5aab1bda516f6" 129 | dependencies = [ 130 | "is-terminal", 131 | "lazy_static", 132 | "windows-sys", 133 | ] 134 | 135 | [[package]] 136 | name = "console_error_panic_hook" 137 | version = "0.1.7" 138 | source = "registry+https://github.com/rust-lang/crates.io-index" 139 | checksum = "a06aeb73f470f66dcdbf7223caeebb85984942f22f1adb2a088cf9668146bbbc" 140 | dependencies = [ 141 | "cfg-if", 142 | "wasm-bindgen", 143 | ] 144 | 145 | [[package]] 146 | name = "core-wasm-ast" 147 | version = "0.1.22" 148 | source = "registry+https://github.com/rust-lang/crates.io-index" 149 | checksum = "e8cdb0749e4822f9afa570c98df0198c2510cb811a4c685e0c47b4ad42962884" 150 | dependencies = [ 151 | "log", 152 | "num_cpus", 153 | "threadpool", 154 | "wasm-coredump-types", 155 | ] 156 | 157 | [[package]] 158 | name = "coredump-service" 159 | version = "0.1.0" 160 | dependencies = [ 161 | "console_error_panic_hook", 162 | "core-wasm-ast", 163 | "coredump-to-stack", 164 | "getrandom", 165 | "serde", 166 | "serde-wasm-bindgen", 167 | "serde_json", 168 | "uuid", 169 | "wasm-parser", 170 | "worker", 171 | ] 172 | 173 | [[package]] 174 | name = "coredump-to-stack" 175 | version = "0.1.22" 176 | source = "registry+https://github.com/rust-lang/crates.io-index" 177 | checksum = "6296047b8ae80438a00ff7c17b74e86c59bffe940385c85cb299c88b7063dbbf" 178 | dependencies = [ 179 | "core-wasm-ast", 180 | "object", 181 | "rustc-demangle", 182 | "wasm-parser", 183 | "wasm-printer", 184 | "wasmgdb_ddbug_parser", 185 | ] 186 | 187 | [[package]] 188 | name = "crc32fast" 189 | version = "1.3.2" 190 | source = "registry+https://github.com/rust-lang/crates.io-index" 191 | checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" 192 | dependencies = [ 193 | "cfg-if", 194 | ] 195 | 196 | [[package]] 197 | name = "env_logger" 198 | version = "0.9.3" 199 | source = "registry+https://github.com/rust-lang/crates.io-index" 200 | checksum = "a12e6657c4c97ebab115a42dcee77225f7f482cdd841cf7088c657a42e9e00e7" 201 | dependencies = [ 202 | "atty", 203 | "humantime", 204 | "log", 205 | "regex", 206 | "termcolor", 207 | ] 208 | 209 | [[package]] 210 | name = "errno" 211 | version = "0.3.1" 212 | source = "registry+https://github.com/rust-lang/crates.io-index" 213 | checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a" 214 | dependencies = [ 215 | "errno-dragonfly", 216 | "libc", 217 | "windows-sys", 218 | ] 219 | 220 | [[package]] 221 | name = "errno-dragonfly" 222 | version = "0.1.2" 223 | source = "registry+https://github.com/rust-lang/crates.io-index" 224 | checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" 225 | dependencies = [ 226 | "cc", 227 | "libc", 228 | ] 229 | 230 | [[package]] 231 | name = "fallible-iterator" 232 | version = "0.2.0" 233 | source = "registry+https://github.com/rust-lang/crates.io-index" 234 | checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" 235 | 236 | [[package]] 237 | name = "flate2" 238 | version = "1.0.26" 239 | source = "registry+https://github.com/rust-lang/crates.io-index" 240 | checksum = "3b9429470923de8e8cbd4d2dc513535400b4b3fef0319fb5c4e1f520a7bef743" 241 | dependencies = [ 242 | "crc32fast", 243 | "miniz_oxide", 244 | ] 245 | 246 | [[package]] 247 | name = "fnv" 248 | version = "1.0.7" 249 | source = "registry+https://github.com/rust-lang/crates.io-index" 250 | checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" 251 | 252 | [[package]] 253 | name = "form_urlencoded" 254 | version = "1.2.0" 255 | source = "registry+https://github.com/rust-lang/crates.io-index" 256 | checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" 257 | dependencies = [ 258 | "percent-encoding", 259 | ] 260 | 261 | [[package]] 262 | name = "futures-channel" 263 | version = "0.3.28" 264 | source = "registry+https://github.com/rust-lang/crates.io-index" 265 | checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2" 266 | dependencies = [ 267 | "futures-core", 268 | ] 269 | 270 | [[package]] 271 | name = "futures-core" 272 | version = "0.3.28" 273 | source = "registry+https://github.com/rust-lang/crates.io-index" 274 | checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" 275 | 276 | [[package]] 277 | name = "futures-io" 278 | version = "0.3.28" 279 | source = "registry+https://github.com/rust-lang/crates.io-index" 280 | checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964" 281 | 282 | [[package]] 283 | name = "futures-macro" 284 | version = "0.3.28" 285 | source = "registry+https://github.com/rust-lang/crates.io-index" 286 | checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" 287 | dependencies = [ 288 | "proc-macro2", 289 | "quote", 290 | "syn 2.0.26", 291 | ] 292 | 293 | [[package]] 294 | name = "futures-sink" 295 | version = "0.3.28" 296 | source = "registry+https://github.com/rust-lang/crates.io-index" 297 | checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e" 298 | 299 | [[package]] 300 | name = "futures-task" 301 | version = "0.3.28" 302 | source = "registry+https://github.com/rust-lang/crates.io-index" 303 | checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" 304 | 305 | [[package]] 306 | name = "futures-util" 307 | version = "0.3.28" 308 | source = "registry+https://github.com/rust-lang/crates.io-index" 309 | checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" 310 | dependencies = [ 311 | "futures-core", 312 | "futures-io", 313 | "futures-macro", 314 | "futures-sink", 315 | "futures-task", 316 | "memchr", 317 | "pin-project-lite", 318 | "pin-utils", 319 | "slab", 320 | ] 321 | 322 | [[package]] 323 | name = "getrandom" 324 | version = "0.2.10" 325 | source = "registry+https://github.com/rust-lang/crates.io-index" 326 | checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" 327 | dependencies = [ 328 | "cfg-if", 329 | "js-sys", 330 | "libc", 331 | "wasi", 332 | "wasm-bindgen", 333 | ] 334 | 335 | [[package]] 336 | name = "gimli" 337 | version = "0.26.2" 338 | source = "registry+https://github.com/rust-lang/crates.io-index" 339 | checksum = "22030e2c5a68ec659fde1e949a745124b48e6fa8b045b7ed5bd1fe4ccc5c4e5d" 340 | dependencies = [ 341 | "fallible-iterator", 342 | "indexmap", 343 | "stable_deref_trait", 344 | ] 345 | 346 | [[package]] 347 | name = "hashbrown" 348 | version = "0.12.3" 349 | source = "registry+https://github.com/rust-lang/crates.io-index" 350 | checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" 351 | 352 | [[package]] 353 | name = "hermit-abi" 354 | version = "0.1.19" 355 | source = "registry+https://github.com/rust-lang/crates.io-index" 356 | checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" 357 | dependencies = [ 358 | "libc", 359 | ] 360 | 361 | [[package]] 362 | name = "hermit-abi" 363 | version = "0.3.2" 364 | source = "registry+https://github.com/rust-lang/crates.io-index" 365 | checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b" 366 | 367 | [[package]] 368 | name = "http" 369 | version = "0.2.9" 370 | source = "registry+https://github.com/rust-lang/crates.io-index" 371 | checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" 372 | dependencies = [ 373 | "bytes", 374 | "fnv", 375 | "itoa", 376 | ] 377 | 378 | [[package]] 379 | name = "humantime" 380 | version = "2.1.0" 381 | source = "registry+https://github.com/rust-lang/crates.io-index" 382 | checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" 383 | 384 | [[package]] 385 | name = "idna" 386 | version = "0.4.0" 387 | source = "registry+https://github.com/rust-lang/crates.io-index" 388 | checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" 389 | dependencies = [ 390 | "unicode-bidi", 391 | "unicode-normalization", 392 | ] 393 | 394 | [[package]] 395 | name = "indexmap" 396 | version = "1.9.3" 397 | source = "registry+https://github.com/rust-lang/crates.io-index" 398 | checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" 399 | dependencies = [ 400 | "autocfg", 401 | "hashbrown", 402 | ] 403 | 404 | [[package]] 405 | name = "is-terminal" 406 | version = "0.4.9" 407 | source = "registry+https://github.com/rust-lang/crates.io-index" 408 | checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" 409 | dependencies = [ 410 | "hermit-abi 0.3.2", 411 | "rustix", 412 | "windows-sys", 413 | ] 414 | 415 | [[package]] 416 | name = "itoa" 417 | version = "1.0.9" 418 | source = "registry+https://github.com/rust-lang/crates.io-index" 419 | checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" 420 | 421 | [[package]] 422 | name = "js-sys" 423 | version = "0.3.61" 424 | source = "registry+https://github.com/rust-lang/crates.io-index" 425 | checksum = "445dde2150c55e483f3d8416706b97ec8e8237c307e5b7b4b8dd15e6af2a0730" 426 | dependencies = [ 427 | "wasm-bindgen", 428 | ] 429 | 430 | [[package]] 431 | name = "lazy_static" 432 | version = "1.4.0" 433 | source = "registry+https://github.com/rust-lang/crates.io-index" 434 | checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" 435 | 436 | [[package]] 437 | name = "leb128" 438 | version = "0.2.5" 439 | source = "registry+https://github.com/rust-lang/crates.io-index" 440 | checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" 441 | 442 | [[package]] 443 | name = "libc" 444 | version = "0.2.147" 445 | source = "registry+https://github.com/rust-lang/crates.io-index" 446 | checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" 447 | 448 | [[package]] 449 | name = "linux-raw-sys" 450 | version = "0.4.3" 451 | source = "registry+https://github.com/rust-lang/crates.io-index" 452 | checksum = "09fc20d2ca12cb9f044c93e3bd6d32d523e6e2ec3db4f7b2939cd99026ecd3f0" 453 | 454 | [[package]] 455 | name = "log" 456 | version = "0.4.19" 457 | source = "registry+https://github.com/rust-lang/crates.io-index" 458 | checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4" 459 | 460 | [[package]] 461 | name = "matchit" 462 | version = "0.4.6" 463 | source = "registry+https://github.com/rust-lang/crates.io-index" 464 | checksum = "9376a4f0340565ad675d11fc1419227faf5f60cd7ac9cb2e7185a471f30af833" 465 | 466 | [[package]] 467 | name = "memchr" 468 | version = "2.5.0" 469 | source = "registry+https://github.com/rust-lang/crates.io-index" 470 | checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" 471 | 472 | [[package]] 473 | name = "memmap" 474 | version = "0.7.0" 475 | source = "registry+https://github.com/rust-lang/crates.io-index" 476 | checksum = "6585fd95e7bb50d6cc31e20d4cf9afb4e2ba16c5846fc76793f11218da9c475b" 477 | dependencies = [ 478 | "libc", 479 | "winapi", 480 | ] 481 | 482 | [[package]] 483 | name = "minimal-lexical" 484 | version = "0.2.1" 485 | source = "registry+https://github.com/rust-lang/crates.io-index" 486 | checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" 487 | 488 | [[package]] 489 | name = "miniz_oxide" 490 | version = "0.7.1" 491 | source = "registry+https://github.com/rust-lang/crates.io-index" 492 | checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" 493 | dependencies = [ 494 | "adler", 495 | ] 496 | 497 | [[package]] 498 | name = "nom" 499 | version = "7.1.3" 500 | source = "registry+https://github.com/rust-lang/crates.io-index" 501 | checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" 502 | dependencies = [ 503 | "memchr", 504 | "minimal-lexical", 505 | ] 506 | 507 | [[package]] 508 | name = "num-traits" 509 | version = "0.2.15" 510 | source = "registry+https://github.com/rust-lang/crates.io-index" 511 | checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" 512 | dependencies = [ 513 | "autocfg", 514 | ] 515 | 516 | [[package]] 517 | name = "num_cpus" 518 | version = "1.16.0" 519 | source = "registry+https://github.com/rust-lang/crates.io-index" 520 | checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" 521 | dependencies = [ 522 | "hermit-abi 0.3.2", 523 | "libc", 524 | ] 525 | 526 | [[package]] 527 | name = "object" 528 | version = "0.29.0" 529 | source = "registry+https://github.com/rust-lang/crates.io-index" 530 | checksum = "21158b2c33aa6d4561f1c0a6ea283ca92bc54802a93b263e910746d679a7eb53" 531 | dependencies = [ 532 | "flate2", 533 | "memchr", 534 | "wasmparser", 535 | ] 536 | 537 | [[package]] 538 | name = "once_cell" 539 | version = "1.18.0" 540 | source = "registry+https://github.com/rust-lang/crates.io-index" 541 | checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" 542 | 543 | [[package]] 544 | name = "parse-zoneinfo" 545 | version = "0.3.0" 546 | source = "registry+https://github.com/rust-lang/crates.io-index" 547 | checksum = "c705f256449c60da65e11ff6626e0c16a0a0b96aaa348de61376b249bc340f41" 548 | dependencies = [ 549 | "regex", 550 | ] 551 | 552 | [[package]] 553 | name = "percent-encoding" 554 | version = "2.3.0" 555 | source = "registry+https://github.com/rust-lang/crates.io-index" 556 | checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" 557 | 558 | [[package]] 559 | name = "phf" 560 | version = "0.11.2" 561 | source = "registry+https://github.com/rust-lang/crates.io-index" 562 | checksum = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc" 563 | dependencies = [ 564 | "phf_shared", 565 | ] 566 | 567 | [[package]] 568 | name = "phf_codegen" 569 | version = "0.11.2" 570 | source = "registry+https://github.com/rust-lang/crates.io-index" 571 | checksum = "e8d39688d359e6b34654d328e262234662d16cc0f60ec8dcbe5e718709342a5a" 572 | dependencies = [ 573 | "phf_generator", 574 | "phf_shared", 575 | ] 576 | 577 | [[package]] 578 | name = "phf_generator" 579 | version = "0.11.2" 580 | source = "registry+https://github.com/rust-lang/crates.io-index" 581 | checksum = "48e4cc64c2ad9ebe670cb8fd69dd50ae301650392e81c05f9bfcb2d5bdbc24b0" 582 | dependencies = [ 583 | "phf_shared", 584 | "rand", 585 | ] 586 | 587 | [[package]] 588 | name = "phf_shared" 589 | version = "0.11.2" 590 | source = "registry+https://github.com/rust-lang/crates.io-index" 591 | checksum = "90fcb95eef784c2ac79119d1dd819e162b5da872ce6f3c3abe1e8ca1c082f72b" 592 | dependencies = [ 593 | "siphasher", 594 | "uncased", 595 | ] 596 | 597 | [[package]] 598 | name = "pin-project" 599 | version = "1.1.2" 600 | source = "registry+https://github.com/rust-lang/crates.io-index" 601 | checksum = "030ad2bc4db10a8944cb0d837f158bdfec4d4a4873ab701a95046770d11f8842" 602 | dependencies = [ 603 | "pin-project-internal", 604 | ] 605 | 606 | [[package]] 607 | name = "pin-project-internal" 608 | version = "1.1.2" 609 | source = "registry+https://github.com/rust-lang/crates.io-index" 610 | checksum = "ec2e072ecce94ec471b13398d5402c188e76ac03cf74dd1a975161b23a3f6d9c" 611 | dependencies = [ 612 | "proc-macro2", 613 | "quote", 614 | "syn 2.0.26", 615 | ] 616 | 617 | [[package]] 618 | name = "pin-project-lite" 619 | version = "0.2.10" 620 | source = "registry+https://github.com/rust-lang/crates.io-index" 621 | checksum = "4c40d25201921e5ff0c862a505c6557ea88568a4e3ace775ab55e93f2f4f9d57" 622 | 623 | [[package]] 624 | name = "pin-utils" 625 | version = "0.1.0" 626 | source = "registry+https://github.com/rust-lang/crates.io-index" 627 | checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" 628 | 629 | [[package]] 630 | name = "proc-macro2" 631 | version = "1.0.66" 632 | source = "registry+https://github.com/rust-lang/crates.io-index" 633 | checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" 634 | dependencies = [ 635 | "unicode-ident", 636 | ] 637 | 638 | [[package]] 639 | name = "quote" 640 | version = "1.0.31" 641 | source = "registry+https://github.com/rust-lang/crates.io-index" 642 | checksum = "5fe8a65d69dd0808184ebb5f836ab526bb259db23c657efa38711b1072ee47f0" 643 | dependencies = [ 644 | "proc-macro2", 645 | ] 646 | 647 | [[package]] 648 | name = "rand" 649 | version = "0.8.5" 650 | source = "registry+https://github.com/rust-lang/crates.io-index" 651 | checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" 652 | dependencies = [ 653 | "rand_core", 654 | ] 655 | 656 | [[package]] 657 | name = "rand_core" 658 | version = "0.6.4" 659 | source = "registry+https://github.com/rust-lang/crates.io-index" 660 | checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" 661 | 662 | [[package]] 663 | name = "regex" 664 | version = "1.9.1" 665 | source = "registry+https://github.com/rust-lang/crates.io-index" 666 | checksum = "b2eae68fc220f7cf2532e4494aded17545fce192d59cd996e0fe7887f4ceb575" 667 | dependencies = [ 668 | "aho-corasick", 669 | "memchr", 670 | "regex-automata", 671 | "regex-syntax", 672 | ] 673 | 674 | [[package]] 675 | name = "regex-automata" 676 | version = "0.3.3" 677 | source = "registry+https://github.com/rust-lang/crates.io-index" 678 | checksum = "39354c10dd07468c2e73926b23bb9c2caca74c5501e38a35da70406f1d923310" 679 | dependencies = [ 680 | "aho-corasick", 681 | "memchr", 682 | "regex-syntax", 683 | ] 684 | 685 | [[package]] 686 | name = "regex-syntax" 687 | version = "0.7.4" 688 | source = "registry+https://github.com/rust-lang/crates.io-index" 689 | checksum = "e5ea92a5b6195c6ef2a0295ea818b312502c6fc94dde986c5553242e18fd4ce2" 690 | 691 | [[package]] 692 | name = "rustc-demangle" 693 | version = "0.1.23" 694 | source = "registry+https://github.com/rust-lang/crates.io-index" 695 | checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" 696 | 697 | [[package]] 698 | name = "rustix" 699 | version = "0.38.4" 700 | source = "registry+https://github.com/rust-lang/crates.io-index" 701 | checksum = "0a962918ea88d644592894bc6dc55acc6c0956488adcebbfb6e273506b7fd6e5" 702 | dependencies = [ 703 | "bitflags", 704 | "errno", 705 | "libc", 706 | "linux-raw-sys", 707 | "windows-sys", 708 | ] 709 | 710 | [[package]] 711 | name = "ryu" 712 | version = "1.0.15" 713 | source = "registry+https://github.com/rust-lang/crates.io-index" 714 | checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" 715 | 716 | [[package]] 717 | name = "serde" 718 | version = "1.0.173" 719 | source = "registry+https://github.com/rust-lang/crates.io-index" 720 | checksum = "e91f70896d6720bc714a4a57d22fc91f1db634680e65c8efe13323f1fa38d53f" 721 | dependencies = [ 722 | "serde_derive", 723 | ] 724 | 725 | [[package]] 726 | name = "serde-wasm-bindgen" 727 | version = "0.5.0" 728 | source = "registry+https://github.com/rust-lang/crates.io-index" 729 | checksum = "f3b143e2833c57ab9ad3ea280d21fd34e285a42837aeb0ee301f4f41890fa00e" 730 | dependencies = [ 731 | "js-sys", 732 | "serde", 733 | "wasm-bindgen", 734 | ] 735 | 736 | [[package]] 737 | name = "serde_derive" 738 | version = "1.0.173" 739 | source = "registry+https://github.com/rust-lang/crates.io-index" 740 | checksum = "a6250dde8342e0232232be9ca3db7aa40aceb5a3e5dd9bddbc00d99a007cde49" 741 | dependencies = [ 742 | "proc-macro2", 743 | "quote", 744 | "syn 2.0.26", 745 | ] 746 | 747 | [[package]] 748 | name = "serde_json" 749 | version = "1.0.103" 750 | source = "registry+https://github.com/rust-lang/crates.io-index" 751 | checksum = "d03b412469450d4404fe8499a268edd7f8b79fecb074b0d812ad64ca21f4031b" 752 | dependencies = [ 753 | "itoa", 754 | "ryu", 755 | "serde", 756 | ] 757 | 758 | [[package]] 759 | name = "siphasher" 760 | version = "0.3.10" 761 | source = "registry+https://github.com/rust-lang/crates.io-index" 762 | checksum = "7bd3e3206899af3f8b12af284fafc038cc1dc2b41d1b89dd17297221c5d225de" 763 | 764 | [[package]] 765 | name = "slab" 766 | version = "0.4.8" 767 | source = "registry+https://github.com/rust-lang/crates.io-index" 768 | checksum = "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d" 769 | dependencies = [ 770 | "autocfg", 771 | ] 772 | 773 | [[package]] 774 | name = "stable_deref_trait" 775 | version = "1.2.0" 776 | source = "registry+https://github.com/rust-lang/crates.io-index" 777 | checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" 778 | 779 | [[package]] 780 | name = "syn" 781 | version = "1.0.109" 782 | source = "registry+https://github.com/rust-lang/crates.io-index" 783 | checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" 784 | dependencies = [ 785 | "proc-macro2", 786 | "quote", 787 | "unicode-ident", 788 | ] 789 | 790 | [[package]] 791 | name = "syn" 792 | version = "2.0.26" 793 | source = "registry+https://github.com/rust-lang/crates.io-index" 794 | checksum = "45c3457aacde3c65315de5031ec191ce46604304d2446e803d71ade03308d970" 795 | dependencies = [ 796 | "proc-macro2", 797 | "quote", 798 | "unicode-ident", 799 | ] 800 | 801 | [[package]] 802 | name = "termcolor" 803 | version = "1.2.0" 804 | source = "registry+https://github.com/rust-lang/crates.io-index" 805 | checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" 806 | dependencies = [ 807 | "winapi-util", 808 | ] 809 | 810 | [[package]] 811 | name = "thiserror" 812 | version = "1.0.43" 813 | source = "registry+https://github.com/rust-lang/crates.io-index" 814 | checksum = "a35fc5b8971143ca348fa6df4f024d4d55264f3468c71ad1c2f365b0a4d58c42" 815 | dependencies = [ 816 | "thiserror-impl", 817 | ] 818 | 819 | [[package]] 820 | name = "thiserror-impl" 821 | version = "1.0.43" 822 | source = "registry+https://github.com/rust-lang/crates.io-index" 823 | checksum = "463fe12d7993d3b327787537ce8dd4dfa058de32fc2b195ef3cde03dc4771e8f" 824 | dependencies = [ 825 | "proc-macro2", 826 | "quote", 827 | "syn 2.0.26", 828 | ] 829 | 830 | [[package]] 831 | name = "threadpool" 832 | version = "1.8.1" 833 | source = "registry+https://github.com/rust-lang/crates.io-index" 834 | checksum = "d050e60b33d41c19108b32cea32164033a9013fe3b46cbd4457559bfbf77afaa" 835 | dependencies = [ 836 | "num_cpus", 837 | ] 838 | 839 | [[package]] 840 | name = "tinyvec" 841 | version = "1.6.0" 842 | source = "registry+https://github.com/rust-lang/crates.io-index" 843 | checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" 844 | dependencies = [ 845 | "tinyvec_macros", 846 | ] 847 | 848 | [[package]] 849 | name = "tinyvec_macros" 850 | version = "0.1.1" 851 | source = "registry+https://github.com/rust-lang/crates.io-index" 852 | checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" 853 | 854 | [[package]] 855 | name = "uncased" 856 | version = "0.9.9" 857 | source = "registry+https://github.com/rust-lang/crates.io-index" 858 | checksum = "9b9bc53168a4be7402ab86c3aad243a84dd7381d09be0eddc81280c1da95ca68" 859 | dependencies = [ 860 | "version_check", 861 | ] 862 | 863 | [[package]] 864 | name = "unicode-bidi" 865 | version = "0.3.13" 866 | source = "registry+https://github.com/rust-lang/crates.io-index" 867 | checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" 868 | 869 | [[package]] 870 | name = "unicode-ident" 871 | version = "1.0.11" 872 | source = "registry+https://github.com/rust-lang/crates.io-index" 873 | checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" 874 | 875 | [[package]] 876 | name = "unicode-normalization" 877 | version = "0.1.22" 878 | source = "registry+https://github.com/rust-lang/crates.io-index" 879 | checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" 880 | dependencies = [ 881 | "tinyvec", 882 | ] 883 | 884 | [[package]] 885 | name = "url" 886 | version = "2.4.0" 887 | source = "registry+https://github.com/rust-lang/crates.io-index" 888 | checksum = "50bff7831e19200a85b17131d085c25d7811bc4e186efdaf54bbd132994a88cb" 889 | dependencies = [ 890 | "form_urlencoded", 891 | "idna", 892 | "percent-encoding", 893 | ] 894 | 895 | [[package]] 896 | name = "uuid" 897 | version = "1.4.1" 898 | source = "registry+https://github.com/rust-lang/crates.io-index" 899 | checksum = "79daa5ed5740825c40b389c5e50312b9c86df53fccd33f281df655642b43869d" 900 | dependencies = [ 901 | "getrandom", 902 | ] 903 | 904 | [[package]] 905 | name = "version_check" 906 | version = "0.9.4" 907 | source = "registry+https://github.com/rust-lang/crates.io-index" 908 | checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" 909 | 910 | [[package]] 911 | name = "wasi" 912 | version = "0.11.0+wasi-snapshot-preview1" 913 | source = "registry+https://github.com/rust-lang/crates.io-index" 914 | checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" 915 | 916 | [[package]] 917 | name = "wasm-bindgen" 918 | version = "0.2.84" 919 | source = "registry+https://github.com/rust-lang/crates.io-index" 920 | checksum = "31f8dcbc21f30d9b8f2ea926ecb58f6b91192c17e9d33594b3df58b2007ca53b" 921 | dependencies = [ 922 | "cfg-if", 923 | "wasm-bindgen-macro", 924 | ] 925 | 926 | [[package]] 927 | name = "wasm-bindgen-backend" 928 | version = "0.2.84" 929 | source = "registry+https://github.com/rust-lang/crates.io-index" 930 | checksum = "95ce90fd5bcc06af55a641a86428ee4229e44e07033963a2290a8e241607ccb9" 931 | dependencies = [ 932 | "bumpalo", 933 | "log", 934 | "once_cell", 935 | "proc-macro2", 936 | "quote", 937 | "syn 1.0.109", 938 | "wasm-bindgen-shared", 939 | ] 940 | 941 | [[package]] 942 | name = "wasm-bindgen-futures" 943 | version = "0.4.34" 944 | source = "registry+https://github.com/rust-lang/crates.io-index" 945 | checksum = "f219e0d211ba40266969f6dbdd90636da12f75bee4fc9d6c23d1260dadb51454" 946 | dependencies = [ 947 | "cfg-if", 948 | "js-sys", 949 | "wasm-bindgen", 950 | "web-sys", 951 | ] 952 | 953 | [[package]] 954 | name = "wasm-bindgen-macro" 955 | version = "0.2.84" 956 | source = "registry+https://github.com/rust-lang/crates.io-index" 957 | checksum = "4c21f77c0bedc37fd5dc21f897894a5ca01e7bb159884559461862ae90c0b4c5" 958 | dependencies = [ 959 | "quote", 960 | "wasm-bindgen-macro-support", 961 | ] 962 | 963 | [[package]] 964 | name = "wasm-bindgen-macro-support" 965 | version = "0.2.84" 966 | source = "registry+https://github.com/rust-lang/crates.io-index" 967 | checksum = "2aff81306fcac3c7515ad4e177f521b5c9a15f2b08f4e32d823066102f35a5f6" 968 | dependencies = [ 969 | "proc-macro2", 970 | "quote", 971 | "syn 1.0.109", 972 | "wasm-bindgen-backend", 973 | "wasm-bindgen-shared", 974 | ] 975 | 976 | [[package]] 977 | name = "wasm-bindgen-shared" 978 | version = "0.2.84" 979 | source = "registry+https://github.com/rust-lang/crates.io-index" 980 | checksum = "0046fef7e28c3804e5e38bfa31ea2a0f73905319b677e57ebe37e49358989b5d" 981 | 982 | [[package]] 983 | name = "wasm-coredump-encoder" 984 | version = "0.1.22" 985 | source = "registry+https://github.com/rust-lang/crates.io-index" 986 | checksum = "f6f36ccfe604720ce093fce7d7b0d609c086c646ec4bb9bba58cb9f4dc2c5623" 987 | dependencies = [ 988 | "leb128", 989 | "wasm-coredump-types", 990 | ] 991 | 992 | [[package]] 993 | name = "wasm-coredump-types" 994 | version = "0.1.22" 995 | source = "registry+https://github.com/rust-lang/crates.io-index" 996 | checksum = "d2763d9807903c461b41275a13489396d04695d7bc365743b8ea430cfd72f336" 997 | 998 | [[package]] 999 | name = "wasm-parser" 1000 | version = "0.1.22" 1001 | source = "registry+https://github.com/rust-lang/crates.io-index" 1002 | checksum = "921ac42ebf0378548ecf47f79fd6caa81fcbfd5e02829ec1b8d6b057a71fb172" 1003 | dependencies = [ 1004 | "core-wasm-ast", 1005 | "env_logger", 1006 | "leb128", 1007 | "log", 1008 | "nom", 1009 | "wasm-coredump-types", 1010 | ] 1011 | 1012 | [[package]] 1013 | name = "wasm-printer" 1014 | version = "0.1.22" 1015 | source = "registry+https://github.com/rust-lang/crates.io-index" 1016 | checksum = "ac19c27c22d30776540b5c6d0a642917af66e13a442e345d92747429c546591c" 1017 | dependencies = [ 1018 | "byteorder", 1019 | "colored", 1020 | "core-wasm-ast", 1021 | "leb128", 1022 | "log", 1023 | "wasm-coredump-encoder", 1024 | "wasm-coredump-types", 1025 | ] 1026 | 1027 | [[package]] 1028 | name = "wasm-streams" 1029 | version = "0.2.3" 1030 | source = "registry+https://github.com/rust-lang/crates.io-index" 1031 | checksum = "6bbae3363c08332cadccd13b67db371814cd214c2524020932f0804b8cf7c078" 1032 | dependencies = [ 1033 | "futures-util", 1034 | "js-sys", 1035 | "wasm-bindgen", 1036 | "wasm-bindgen-futures", 1037 | "web-sys", 1038 | ] 1039 | 1040 | [[package]] 1041 | name = "wasmgdb_ddbug_parser" 1042 | version = "0.3.2" 1043 | source = "registry+https://github.com/rust-lang/crates.io-index" 1044 | checksum = "06bc378bdeaf4024ac8b4a964d44c3c16493012374e562809510307fa00fb885" 1045 | dependencies = [ 1046 | "fnv", 1047 | "gimli", 1048 | "log", 1049 | "memmap", 1050 | "object", 1051 | ] 1052 | 1053 | [[package]] 1054 | name = "wasmparser" 1055 | version = "0.57.0" 1056 | source = "registry+https://github.com/rust-lang/crates.io-index" 1057 | checksum = "32fddd575d477c6e9702484139cf9f23dcd554b06d185ed0f56c857dd3a47aa6" 1058 | 1059 | [[package]] 1060 | name = "web-sys" 1061 | version = "0.3.61" 1062 | source = "registry+https://github.com/rust-lang/crates.io-index" 1063 | checksum = "e33b99f4b23ba3eec1a53ac264e35a755f00e966e0065077d6027c0f575b0b97" 1064 | dependencies = [ 1065 | "js-sys", 1066 | "wasm-bindgen", 1067 | ] 1068 | 1069 | [[package]] 1070 | name = "winapi" 1071 | version = "0.3.9" 1072 | source = "registry+https://github.com/rust-lang/crates.io-index" 1073 | checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" 1074 | dependencies = [ 1075 | "winapi-i686-pc-windows-gnu", 1076 | "winapi-x86_64-pc-windows-gnu", 1077 | ] 1078 | 1079 | [[package]] 1080 | name = "winapi-i686-pc-windows-gnu" 1081 | version = "0.4.0" 1082 | source = "registry+https://github.com/rust-lang/crates.io-index" 1083 | checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" 1084 | 1085 | [[package]] 1086 | name = "winapi-util" 1087 | version = "0.1.5" 1088 | source = "registry+https://github.com/rust-lang/crates.io-index" 1089 | checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" 1090 | dependencies = [ 1091 | "winapi", 1092 | ] 1093 | 1094 | [[package]] 1095 | name = "winapi-x86_64-pc-windows-gnu" 1096 | version = "0.4.0" 1097 | source = "registry+https://github.com/rust-lang/crates.io-index" 1098 | checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 1099 | 1100 | [[package]] 1101 | name = "windows-sys" 1102 | version = "0.48.0" 1103 | source = "registry+https://github.com/rust-lang/crates.io-index" 1104 | checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" 1105 | dependencies = [ 1106 | "windows-targets", 1107 | ] 1108 | 1109 | [[package]] 1110 | name = "windows-targets" 1111 | version = "0.48.1" 1112 | source = "registry+https://github.com/rust-lang/crates.io-index" 1113 | checksum = "05d4b17490f70499f20b9e791dcf6a299785ce8af4d709018206dc5b4953e95f" 1114 | dependencies = [ 1115 | "windows_aarch64_gnullvm", 1116 | "windows_aarch64_msvc", 1117 | "windows_i686_gnu", 1118 | "windows_i686_msvc", 1119 | "windows_x86_64_gnu", 1120 | "windows_x86_64_gnullvm", 1121 | "windows_x86_64_msvc", 1122 | ] 1123 | 1124 | [[package]] 1125 | name = "windows_aarch64_gnullvm" 1126 | version = "0.48.0" 1127 | source = "registry+https://github.com/rust-lang/crates.io-index" 1128 | checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" 1129 | 1130 | [[package]] 1131 | name = "windows_aarch64_msvc" 1132 | version = "0.48.0" 1133 | source = "registry+https://github.com/rust-lang/crates.io-index" 1134 | checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" 1135 | 1136 | [[package]] 1137 | name = "windows_i686_gnu" 1138 | version = "0.48.0" 1139 | source = "registry+https://github.com/rust-lang/crates.io-index" 1140 | checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" 1141 | 1142 | [[package]] 1143 | name = "windows_i686_msvc" 1144 | version = "0.48.0" 1145 | source = "registry+https://github.com/rust-lang/crates.io-index" 1146 | checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" 1147 | 1148 | [[package]] 1149 | name = "windows_x86_64_gnu" 1150 | version = "0.48.0" 1151 | source = "registry+https://github.com/rust-lang/crates.io-index" 1152 | checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" 1153 | 1154 | [[package]] 1155 | name = "windows_x86_64_gnullvm" 1156 | version = "0.48.0" 1157 | source = "registry+https://github.com/rust-lang/crates.io-index" 1158 | checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" 1159 | 1160 | [[package]] 1161 | name = "windows_x86_64_msvc" 1162 | version = "0.48.0" 1163 | source = "registry+https://github.com/rust-lang/crates.io-index" 1164 | checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" 1165 | 1166 | [[package]] 1167 | name = "worker" 1168 | version = "0.0.17" 1169 | source = "registry+https://github.com/rust-lang/crates.io-index" 1170 | checksum = "c64a08abf27a129f60be182b26635bbd281fe1c4e4d4b4375383cb1a4ef9e2c2" 1171 | dependencies = [ 1172 | "async-trait", 1173 | "chrono", 1174 | "chrono-tz", 1175 | "futures-channel", 1176 | "futures-util", 1177 | "http", 1178 | "js-sys", 1179 | "matchit", 1180 | "pin-project", 1181 | "serde", 1182 | "serde-wasm-bindgen", 1183 | "serde_json", 1184 | "url", 1185 | "wasm-bindgen", 1186 | "wasm-bindgen-futures", 1187 | "wasm-streams", 1188 | "web-sys", 1189 | "worker-kv", 1190 | "worker-macros", 1191 | "worker-sys", 1192 | ] 1193 | 1194 | [[package]] 1195 | name = "worker-kv" 1196 | version = "0.6.0" 1197 | source = "registry+https://github.com/rust-lang/crates.io-index" 1198 | checksum = "3d4b9fe1a87b7aef252fceb4f30bf6303036a5de329c81ccad9be9c35d1fdbc7" 1199 | dependencies = [ 1200 | "js-sys", 1201 | "serde", 1202 | "serde-wasm-bindgen", 1203 | "serde_json", 1204 | "thiserror", 1205 | "wasm-bindgen", 1206 | "wasm-bindgen-futures", 1207 | ] 1208 | 1209 | [[package]] 1210 | name = "worker-macros" 1211 | version = "0.0.9" 1212 | source = "registry+https://github.com/rust-lang/crates.io-index" 1213 | checksum = "6e052efe546b1571f03abaafac252a8103a4a698c2bfa8d5c48ca634f1817323" 1214 | dependencies = [ 1215 | "async-trait", 1216 | "proc-macro2", 1217 | "quote", 1218 | "syn 1.0.109", 1219 | "wasm-bindgen", 1220 | "wasm-bindgen-futures", 1221 | "wasm-bindgen-macro-support", 1222 | "worker-sys", 1223 | ] 1224 | 1225 | [[package]] 1226 | name = "worker-sys" 1227 | version = "0.0.9" 1228 | source = "registry+https://github.com/rust-lang/crates.io-index" 1229 | checksum = "2ad510995e943256afb8b7524366014bd4a2f6a4ffef00b8121db97a8056b4c3" 1230 | dependencies = [ 1231 | "cfg-if", 1232 | "js-sys", 1233 | "wasm-bindgen", 1234 | "web-sys", 1235 | ] 1236 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "coredump-service" 3 | version = "0.1.0" 4 | edition = "2021" 5 | authors = ["Sven Sauleau "] 6 | license = "Apache-2.0" 7 | description = "Wasm Coredump Service" 8 | publish = false 9 | 10 | # https://github.com/rustwasm/wasm-pack/issues/1247 11 | [package.metadata.wasm-pack.profile.release] 12 | wasm-opt = false 13 | 14 | [lib] 15 | crate-type = ["cdylib"] 16 | 17 | [dependencies] 18 | worker = "0.0.17" 19 | coredump-to-stack = { version = "0.1.22" } 20 | wasm-parser = { version = "0.1.21" } 21 | core-wasm-ast = { version = "0.1.21" } 22 | serde_json = "1.0.103" 23 | serde-wasm-bindgen = "0.5.0" 24 | serde = "1.0.173" 25 | console_error_panic_hook = "0.1.7" 26 | uuid = { version = "1.4.1", features = ["v4"] } 27 | getrandom = { version = "0.2", features = ["js"] } 28 | 29 | [profile.release] 30 | lto = true 31 | strip = true 32 | codegen-units = 1 33 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2023 Cloudflare, Inc. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Wasm Coredump Service 2 | 3 | Read about [Wasm core dumps and debugging Rust in Cloudflare Workers](https://blog.cloudflare.com/wasm-coredumps/) in our blog to know more. 4 | 5 | ## Usage 6 | 7 | The JS library `@cloudflare/wasm-coredump` is used to send Coredump to the Wasm 8 | Coredump Service. 9 | Install the library: 10 | 11 | ``` 12 | yarn add `@cloudflare/wasm-coredump` 13 | ``` 14 | 15 | Change your Worker's entrypoint to catch crashes and extract a coredump (if any): 16 | 17 | `./src/entry.mjs`: 18 | ```js 19 | import shim, { getMemory, wasmModule } from "../build/worker/shim.mjs" 20 | 21 | async function fetch(request, env, ctx) { 22 | try { 23 | return shim.fetch(request, env, ctx); 24 | } catch (err) { 25 | const memory = getMemory(); 26 | const coredumpService = env.COREDUMP_SERVICE; 27 | await recordCoredump({ memory, wasmModule, request, coredumpService }); 28 | throw err; 29 | } 30 | } 31 | 32 | export default { fetch }; 33 | ``` 34 | 35 | Point wrangler to the new Worker entrypoint: 36 | 37 | `wrangler.toml`: 38 | ``` 39 | ... 40 | main = "src/entry.mjs" 41 | ... 42 | ``` 43 | 44 | Make sure wasm-coredump-rewriter is installed 45 | 46 | ``` 47 | cargo install wasm-coredump-rewriter 48 | ``` 49 | 50 | Modify the wrangler.toml build command to add core dump support: 51 | ```toml 52 | [build] 53 | command = "cargo install worker-build && COREDUMP=1 worker-build --dev" 54 | ``` 55 | 56 | Now, when a Worker (using the Wasm Coredump Service) crashes you should see in the 57 | logs: 58 | 59 | ``` 60 | ... 61 | POST https://example.com/make-a-crash - Ok @ 7/24/2023, 12:15:01 PM 62 | ... 63 | (log) retrieve debugging information debug-4dbd0d41-63aa-4a4f-be75-296f2f10b53f.wasm 64 | (log) core dumped: coredump.1691398686241 65 | (log) Error: Wasm trapped. 66 | (log) at panic_abort::__rust_start_panic (library/panic_abort/src/lib.rs:32) 67 | (log) at panicking::rust_panic (library/std/src/panicking.rs:740) 68 | (log) at panicking::rust_panic_with_hook (library/std/src/panicking.rs:652) 69 | (log) at begin_panic_handler::{closure#0} (library/std/src/panicking.rs:578) 70 | (log) at backtrace::__rust_end_short_backtrace (library/std/src/sys_common/backtrace.rs:146) 71 | (log) at panicking::begin_panic_handler (library/std/src/panicking.rs:526) 72 | (log) at panicking::panic_fmt (library/core/src/panicking.rs:52) 73 | (log) at test_coredump_worker::calculate (src/lib.rs:30) 74 | (log) at test_coredump_worker::process_thing (src/lib.rs:24) 75 | (log) at {closure#0}::{async_block#0} (/home/sven/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wasm-bindgen-futures-0.4.34/src/lib.rs:218) 76 | (log) at Task::run (src/task/singlethread.rs:84) 77 | (log) at new::{closure#0} (src/queue.rs:81) 78 | (log) at describe::invoke (/home/sven/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wasm-bindgen-0.2.84/src/closure.rs:620) 79 | (log) at memcpy::memcpy (src/macros.rs:305) 80 | (log) at wasm_bindgen_futures::future_to_promise (/home/sven/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wasm-bindgen-futures-0.4.34/src/lib.rs:209) 81 | (log) at _::__wasm_bindgen_generated_fetch (src/lib.rs:8) 82 | (log) reported to Sentry: "75e52055-9d4a-4bfc-9490-b4b66468e06c" 83 | ... 84 | ``` 85 | 86 | Additionally you can configure the Wasm Coredump Service to report the exception 87 | in Sentry and/or store the coredump file in R2. 88 | 89 | 90 | ## Sending errors to Sentry 91 | 92 | Add to the `wrangler.toml`: 93 | 94 | ``` 95 | ... 96 | [vars] 97 | SENTRY_HOST = "..." 98 | SENTRY_PROJECT_ID = "..." 99 | SENTRY_API_KEY = "..." 100 | SENTRY_CF_ACCESS_CLIENT_ID = "..." 101 | SENTRY_CF_ACCESS_CLIENT_SECRET = "..." 102 | ``` 103 | 104 | ## Store coredumps in R2 105 | 106 | Add to the `wrangler.toml`: 107 | 108 | ``` 109 | [[r2_buckets]] 110 | binding = 'STORAGE' 111 | bucket_name = '...' 112 | ``` 113 | 114 | Note that the binding name has to be set to `STORAGE`. 115 | 116 | [Wasm Coredump]: https://github.com/WebAssembly/tool-conventions/blob/main/Coredump.md 117 | -------------------------------------------------------------------------------- /example/.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | /Cargo.lock 3 | -------------------------------------------------------------------------------- /example/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "test-coredump-worker" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [lib] 7 | crate-type = ["cdylib"] 8 | 9 | [dependencies] 10 | serde = "1.0.171" 11 | worker = "0.0.17" 12 | 13 | [profile.dev] 14 | opt-level = "s" 15 | strip = false 16 | debug = true 17 | 18 | [package.metadata.wasm-pack.profile.dev.wasm-bindgen] 19 | # emit the DWARF debug info custom sections 20 | dwarf-debug-info = true 21 | 22 | [package.metadata.wasm-pack.dev.release] 23 | wasm-opt = ["-Os", "--debuginfo"] 24 | -------------------------------------------------------------------------------- /example/README.md: -------------------------------------------------------------------------------- 1 | # Wasm Coredump example 2 | 3 | ## Deploy 4 | 5 | ``` 6 | wrangler deploy 7 | ``` 8 | 9 | ## Test 10 | 11 | ``` 12 | curl https://test-coredump-worker.sven.workers.dev -d '{"value":3}' 13 | ``` 14 | 15 | See the Worker logs for the crash output. 16 | -------------------------------------------------------------------------------- /example/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "@cloudflare/wasm-coredump": "1.0.3" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /example/src/entry.mjs: -------------------------------------------------------------------------------- 1 | import shim, { getMemory, wasmModule } from "../build/worker/shim.mjs" 2 | import { recordCoredump } from "@cloudflare/wasm-coredump" 3 | 4 | async function fetch(request, env, ctx) { 5 | try { 6 | return await shim.fetch(request, env, ctx); 7 | } catch (err) { 8 | const memory = getMemory(); 9 | const coredumpService = env.COREDUMP_SERVICE; 10 | await recordCoredump({ memory, wasmModule, request, coredumpService }); 11 | throw err; 12 | } 13 | } 14 | 15 | export default { fetch }; 16 | -------------------------------------------------------------------------------- /example/src/lib.rs: -------------------------------------------------------------------------------- 1 | use worker::{event, Env, Request, Response, Result}; 2 | 3 | #[derive(serde::Deserialize)] 4 | struct Payload { 5 | value: usize, 6 | } 7 | 8 | #[event(fetch, respond_with_errors)] 9 | pub async fn fetch(mut req: Request, _env: Env, _ctx: worker::Context) -> Result { 10 | let payload = req.json::().await?; 11 | 12 | let thing = MyThing { 13 | value: payload.value, 14 | }; 15 | process_thing(&thing); 16 | Response::ok("ok") 17 | } 18 | 19 | struct MyThing { 20 | value: usize, 21 | } 22 | 23 | #[inline(never)] 24 | fn process_thing(thing: &MyThing) { 25 | let result = calculate(thing.value); 26 | worker::console_log!("result is {}", result); 27 | } 28 | 29 | #[inline(never)] 30 | fn calculate(_value: usize) -> usize { 31 | panic!("oops") 32 | } 33 | -------------------------------------------------------------------------------- /example/wrangler.toml: -------------------------------------------------------------------------------- 1 | name = "test-coredump-worker" 2 | main = "src/entry.mjs" 3 | compatibility_date = "2023-03-22" 4 | 5 | [[services]] 6 | binding = "COREDUMP_SERVICE" 7 | service = "coredump-service" 8 | 9 | [build] 10 | command = "cargo install worker-build && COREDUMP=1 worker-build --dev" 11 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "toucan-js": "^3.1.0" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Cloudflare, Inc. 2 | // Licensed under the Apache 2.0 license found in the LICENSE file or at: 3 | // https://opensource.org/licenses/Apache-2.0 4 | 5 | use coredump_to_stack::CoredumpToStack; 6 | use std::collections::HashMap; 7 | use worker::*; 8 | 9 | mod sentry; 10 | 11 | fn files(form: &worker::FormData, name: &str) -> Result> { 12 | let res = form.get_all(name).ok_or(Error::JsError(format!( 13 | "`{name}` files is missing, please specify a {name}." 14 | )))?; 15 | 16 | let mut files = vec![]; 17 | 18 | for res in res { 19 | if let worker::FormEntry::File(v) = res { 20 | files.push(v) 21 | } else { 22 | return Err(Error::JsError(format!("expected `{name}` to be a file"))); 23 | } 24 | } 25 | 26 | Ok(files) 27 | } 28 | 29 | fn file(form: &worker::FormData, name: &str) -> Result { 30 | let res = form.get(name).ok_or(Error::JsError(format!( 31 | "`{name}` file is missing, please specify a {name}." 32 | )))?; 33 | if let worker::FormEntry::File(v) = res { 34 | Ok(v) 35 | } else { 36 | Err(Error::JsError(format!("expected `{name}` to be a file"))) 37 | } 38 | } 39 | 40 | fn field(form: &worker::FormData, name: &str) -> Result { 41 | let res = form.get(name).ok_or(Error::JsError(format!( 42 | "`{name}` file is missing, please specify a {name}." 43 | )))?; 44 | if let worker::FormEntry::Field(v) = res { 45 | Ok(v) 46 | } else { 47 | Err(Error::JsError(format!("expected `{name}` to be a file"))) 48 | } 49 | } 50 | 51 | #[event(start)] 52 | fn start() { 53 | std::panic::set_hook(Box::new(console_error_panic_hook::hook)); 54 | } 55 | 56 | #[event(fetch)] 57 | async fn main(mut req: Request, env: Env, _ctx: Context) -> Result { 58 | let bucket = if let Ok(b) = env.bucket("STORAGE") { 59 | Some(b) 60 | } else { 61 | None 62 | }; 63 | 64 | let sentry = if let Ok(_) = env.var("SENTRY_HOST") { 65 | let sentry = sentry::Sentry::from_env(&env)?; 66 | Some(sentry) 67 | } else { 68 | None 69 | }; 70 | 71 | let data = req.form_data().await?; 72 | 73 | let eyeball_request = field(&data, "request")?; 74 | let eyeball_request = serde_json::from_str(&eyeball_request) 75 | .map_err(|err| Error::JsError(format!("failed to parse eyeball request: {err}")))?; 76 | 77 | let coredump = file(&data, "coredump")?; 78 | let coredump = coredump.bytes().await?; 79 | 80 | let mut sentry_tags = HashMap::new(); 81 | 82 | // The debug_module is a Wasm Module that contains the debugging information 83 | // as custom sections. Either it's sent by the wasm-coredump-js client or 84 | // sections have been splitted out locally and stored in R2. 85 | let coredump_to_stack = { 86 | if let Some(build_id) = files(&data, "build_id-section")?.first() { 87 | // A build_id section indicates that the module has been splitted 88 | // off and we need to fetch the debug_module from R2. 89 | let build_id_section = build_id.bytes().await?; 90 | 91 | let build_id = 92 | wasm_parser::parse_custom_section_build_id(&build_id_section).map_err(|err| { 93 | Error::JsError(format!("failed to parse build_id section: {err}")) 94 | })?; 95 | let build_id = uuid::Uuid::from_slice(&build_id) 96 | .map_err(|err| Error::JsError(format!("failed to parse build_id value: {err}")))?; 97 | 98 | let bucket = bucket 99 | .as_ref() 100 | .ok_or(Error::BindingError("missing R2 bucket".to_owned()))?; 101 | 102 | let key = format!("debug-{}.wasm", build_id); 103 | worker::console_log!("retrieve debugging information {}", key); 104 | 105 | sentry_tags.insert("debuginfo", key.clone()); 106 | 107 | let debug_module = bucket 108 | .get(key.clone()) 109 | .execute() 110 | .await? 111 | .expect("R2 is missing debugging information"); 112 | let debug_module = debug_module.body().unwrap().bytes().await?; 113 | 114 | CoredumpToStack::new(&coredump) 115 | .map_err(|err| Error::JsError(format!("coredump_to_stack failed: {err}")))? 116 | .with_debug_module(&debug_module) 117 | .map_err(|err| Error::JsError(format!("with_debug_module failed: {err}")))? 118 | } else { 119 | let sections_sent_by_js_client = [ 120 | "name", 121 | ".debug_info", 122 | ".debug_pubtypes", 123 | ".debug_loc", 124 | ".debug_ranges", 125 | ".debug_abbrev", 126 | ".debug_line", 127 | ".debug_str", 128 | ".debug_pubnames", 129 | ]; 130 | 131 | let mut sections = HashMap::new(); 132 | 133 | for section_name in sections_sent_by_js_client { 134 | let bytes = file(&data, &format!("{}-section", section_name))? 135 | .bytes() 136 | .await?; 137 | sections.insert(section_name, bytes); 138 | } 139 | 140 | CoredumpToStack::new(&coredump) 141 | .map_err(|err| Error::JsError(format!("coredump_to_stack failed: {err}")))? 142 | .with_debug_sections(sections) 143 | .map_err(|err| Error::JsError(format!("with_debug_module failed: {err}")))? 144 | } 145 | }; 146 | 147 | let stack_frames = coredump_to_stack 148 | .stack() 149 | .map_err(|err| Error::JsError(format!("coredump_to_stack failed: {err}")))?; 150 | 151 | let now = Date::now(); 152 | let key = format!("coredump.{}", now.as_millis()); 153 | 154 | if let Some(bucket) = &bucket { 155 | bucket.put(key.clone(), coredump).execute().await?; 156 | } 157 | 158 | worker::console_log!("core dumped: {}", key); 159 | sentry_tags.insert("file", key.clone()); 160 | 161 | // Print stack trace to console 162 | { 163 | worker::console_log!("Error: Wasm trapped."); 164 | 165 | for i in (0..stack_frames.len()).rev() { 166 | let frame = &stack_frames[i]; 167 | worker::console_log!( 168 | " at {} ({}:{})", 169 | frame.name, 170 | frame.location.file, 171 | frame.location.line 172 | ); 173 | } 174 | } 175 | 176 | if let Some(sentry) = &sentry { 177 | let mut sentry_frames = vec![]; 178 | 179 | for frame in stack_frames { 180 | sentry_frames.push(sentry::SentryFrame { 181 | function: frame.name, 182 | in_app: is_in_app(&frame.location.file), 183 | filename: frame.location.file, 184 | lineno: frame.location.line, 185 | }); 186 | } 187 | 188 | sentry 189 | .report_exception(sentry_tags, sentry_frames, eyeball_request) 190 | .await?; 191 | } 192 | 193 | Response::ok(format!("{{\"key\": \"{}\"}}", key)) 194 | } 195 | 196 | fn is_in_app(path: &str) -> bool { 197 | !path.starts_with("/") && !path.starts_with("library/") 198 | } 199 | -------------------------------------------------------------------------------- /src/sentry.rs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Cloudflare, Inc. 2 | // Licensed under the Apache 2.0 license found in the LICENSE file or at: 3 | // https://opensource.org/licenses/Apache-2.0 4 | 5 | use serde_json::json; 6 | use std::collections::HashMap; 7 | use uuid::Uuid; 8 | use worker::Result; 9 | 10 | #[derive(serde::Serialize)] 11 | pub(crate) struct SentryFrame { 12 | pub(crate) filename: String, 13 | pub(crate) function: String, 14 | pub(crate) lineno: u32, 15 | pub(crate) in_app: bool, 16 | } 17 | 18 | pub(crate) struct Sentry { 19 | url: String, 20 | cf_access_client_id: String, 21 | cf_access_client_secret: String, 22 | } 23 | 24 | impl Sentry { 25 | pub(crate) fn from_env(env: &worker::Env) -> Result { 26 | let sentry_host = env.var("SENTRY_HOST")?.to_string(); 27 | let sentry_project_id = env.var("SENTRY_PROJECT_ID")?.to_string(); 28 | let sentry_api_key = env.var("SENTRY_API_KEY")?.to_string(); 29 | let cf_access_client_id = env.var("SENTRY_CF_ACCESS_CLIENT_ID")?.to_string(); 30 | let cf_access_client_secret = env.secret("SENTRY_CF_ACCESS_CLIENT_SECRET")?.to_string(); 31 | 32 | Ok(Self { 33 | url: format!("https://{}/api/{}/store/?sentry_version=7&sentry_client=coredump-service&sentry_key={}", sentry_host, sentry_project_id, sentry_api_key), 34 | cf_access_client_id, 35 | cf_access_client_secret, 36 | }) 37 | } 38 | 39 | pub(crate) async fn report_exception( 40 | &self, 41 | tags: HashMap<&'static str, String>, 42 | frames: Vec, 43 | eyeball_request: serde_json::Value, 44 | ) -> Result<()> { 45 | let event_id = Uuid::new_v4().to_string(); 46 | let now_in_seconds = worker::Date::now().as_millis() / 1000; 47 | let event = json!({ 48 | "event_id": event_id, 49 | "timestamp": now_in_seconds, 50 | "platform": "rust", 51 | "logger": "coredump-service", 52 | "exception": { 53 | "values": [ 54 | { 55 | "type": "Error", 56 | "value": "Wasm crashed", 57 | "stacktrace": { 58 | "frames": frames 59 | } 60 | } 61 | ], 62 | }, 63 | "request": eyeball_request, 64 | "level": "fatal", 65 | "tags": tags 66 | }); 67 | 68 | self.post(event).await 69 | } 70 | 71 | async fn post(&self, data: serde_json::Value) -> Result<()> { 72 | let body = serde_json::to_string(&data).unwrap(); 73 | 74 | let mut headers = worker::Headers::new(); 75 | headers.set("Cf-Access-Client-Id", &self.cf_access_client_id)?; 76 | headers.set("Cf-Access-Client-Secret", &self.cf_access_client_secret)?; 77 | 78 | let mut init = worker::RequestInit::new(); 79 | 80 | let req = worker::Request::new_with_init( 81 | &self.url, 82 | init.with_method(worker::Method::Post) 83 | .with_headers(headers) 84 | .with_body(Some(body.into())), 85 | )?; 86 | 87 | let mut res = worker::Fetch::Request(req).send().await?; 88 | if res.status_code() != 200 { 89 | let text = res.text().await?; 90 | return Err(worker::Error::RustError(format!( 91 | "Unexpected Sentry response {}: {}", 92 | res.status_code(), 93 | text 94 | ))); 95 | } 96 | 97 | worker::console_log!("reported to Sentry: {}", data.get("event_id").unwrap()); 98 | Ok(()) 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /wasm-coredump-js/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | -------------------------------------------------------------------------------- /wasm-coredump-js/index.mjs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 Cloudflare, Inc. 2 | // Licensed under the Apache 2.0 license found in the LICENSE file or at: 3 | // https://opensource.org/licenses/Apache-2.0 4 | 5 | // Call this function on Wasm exception to record the Wasm coredump, if any. 6 | export async function recordCoredump({ 7 | memory, 8 | wasmModule, 9 | request, 10 | coredumpService, 11 | }) { 12 | try { 13 | const image = memory.buffer; 14 | 15 | // Check for the presence of the wasm\0 header, meaning a coredump 16 | // has been written. 17 | const u32 = new Uint32Array(image); 18 | if (u32[0] !== 0x6d736100) { 19 | return null; 20 | } 21 | 22 | const body = new FormData(); 23 | body.set("coredump", new Blob([image])); 24 | 25 | // There are two possible case for providing the coredump service the 26 | // debugging information: 27 | // 1. the debugging information are inside the user Wasm module, in which 28 | // case we sent the sections and the coredump sercice construct a debug 29 | // module. 30 | // 2. the debugging information were too big and were splitted out of the 31 | // user module locally. In which case we just send a build_id to the 32 | // coredump section. It should be able to fetch the debugging information 33 | // from R2. 34 | // 35 | // The presence of the build_id section indicates that it's case 2. 36 | // Otherwise safe to assume it's 1. 37 | const buildIdSections = WebAssembly.Module.customSections( 38 | wasmModule, 39 | "build_id", 40 | ); 41 | if (buildIdSections.length > 0) { 42 | buildIdSections.forEach((section) => { 43 | body.append("build_id-section", new Blob([section])); 44 | }); 45 | } else { 46 | const sectionsToExtract = [ 47 | "name", 48 | ".debug_info", 49 | ".debug_pubtypes", 50 | ".debug_loc", 51 | ".debug_ranges", 52 | ".debug_abbrev", 53 | ".debug_line", 54 | ".debug_str", 55 | ".debug_pubnames", 56 | ]; 57 | 58 | for (let i = 0, len = sectionsToExtract.length; i < len; i++) { 59 | const name = sectionsToExtract[i]; 60 | const sections = WebAssembly.Module.customSections(wasmModule, name); 61 | sections.forEach((section) => { 62 | body.append(name + "-section", new Blob([section])); 63 | }); 64 | } 65 | } 66 | 67 | // Add eyeball request 68 | { 69 | const headers = {}; 70 | for (const [key, value] of request.headers.entries()) { 71 | headers[key] = value; 72 | } 73 | 74 | const eyeballRequest = { 75 | method: request.method, 76 | url: request.url, 77 | headers, 78 | }; 79 | 80 | body.set("request", JSON.stringify(eyeballRequest)); 81 | } 82 | 83 | const res = await coredumpService.fetch("http://coredump-service", { 84 | method: "POST", 85 | body, 86 | }); 87 | if (!res.ok) { 88 | const text = await res.text(); 89 | throw new Error(`failed to report coredump: ${res.status}, ${text}`); 90 | } 91 | } catch (err) { 92 | console.error("failed to get coredump: " + err); 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /wasm-coredump-js/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@cloudflare/wasm-coredump", 3 | "version": "1.0.3", 4 | "main": "index.mjs", 5 | "type": "module", 6 | "author": "Sven Sauleau ", 7 | "license": "Apache-2.0", 8 | "devDependencies": { 9 | "prettier": "^3.0.0" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /wasm-coredump-js/yarn.lock: -------------------------------------------------------------------------------- 1 | # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. 2 | # yarn lockfile v1 3 | 4 | 5 | prettier@^3.0.0: 6 | version "3.0.0" 7 | resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.0.0.tgz#e7b19f691245a21d618c68bc54dc06122f6105ae" 8 | integrity sha512-zBf5eHpwHOGPC47h0zrPyNn+eAEIdEzfywMoYn2XPi0P44Zp0tSq64rq0xAREh4auw2cJZHo9QUob+NqCQky4g== 9 | -------------------------------------------------------------------------------- /wrangler.toml: -------------------------------------------------------------------------------- 1 | name = "coredump-service" 2 | main = "build/worker/shim.mjs" 3 | compatibility_date = "2023-07-20" 4 | workers_dev = false 5 | usage_model = "unbound" 6 | 7 | [build] 8 | command = "cargo install -q worker-build && worker-build --release" 9 | -------------------------------------------------------------------------------- /yarn.lock: -------------------------------------------------------------------------------- 1 | # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. 2 | # yarn lockfile v1 3 | 4 | 5 | "@sentry/core@7.28.1": 6 | version "7.28.1" 7 | resolved "https://registry.yarnpkg.com/@sentry/core/-/core-7.28.1.tgz#c712ce17469b18b01606108817be24a99ed2116e" 8 | integrity sha512-7wvnuvn/mrAfcugWoCG/3pqDIrUgH5t+HisMJMGw0h9Tc33KqrmqMDCQVvjlrr2pWrw/vuUCFdm8CbUHJ832oQ== 9 | dependencies: 10 | "@sentry/types" "7.28.1" 11 | "@sentry/utils" "7.28.1" 12 | tslib "^1.9.3" 13 | 14 | "@sentry/types@7.28.1": 15 | version "7.28.1" 16 | resolved "https://registry.yarnpkg.com/@sentry/types/-/types-7.28.1.tgz#9018b4c152b475de9bedd267237393d3c9b1253d" 17 | integrity sha512-DvSplMVrVEmOzR2M161V5+B8Up3vR71xMqJOpWTzE9TqtFJRGPtqT/5OBsNJJw1+/j2ssMcnKwbEo9Q2EGeS6g== 18 | 19 | "@sentry/utils@7.28.1": 20 | version "7.28.1" 21 | resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-7.28.1.tgz#0a7b6aa4b09e91e4d1aded2a8c8dbaf818cee96e" 22 | integrity sha512-75/jzLUO9HH09iC9TslNimGbxOP3jgn89P+q7uR+rp2fJfRExHVeKJZQdK0Ij4/SmE7TJ3Uh2r154N0INZEx1g== 23 | dependencies: 24 | "@sentry/types" "7.28.1" 25 | tslib "^1.9.3" 26 | 27 | toucan-js@^3.1.0: 28 | version "3.1.0" 29 | resolved "https://registry.yarnpkg.com/toucan-js/-/toucan-js-3.1.0.tgz#412cf43c259e702f46427e465adb2f588b7eea85" 30 | integrity sha512-bRbq/HB+aSfwbsSoCNI6qyPXx2bhsscxSYxnAY63xXv9lIeOLUYfvYdOIBWfAVj9QHNST+X83GQ0lj/llvHpVg== 31 | dependencies: 32 | "@sentry/core" "7.28.1" 33 | "@sentry/types" "7.28.1" 34 | "@sentry/utils" "7.28.1" 35 | 36 | tslib@^1.9.3: 37 | version "1.14.1" 38 | resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" 39 | integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== 40 | --------------------------------------------------------------------------------