├── .github ├── CODEOWNERS └── workflows │ ├── danger.yml │ ├── enforce-license-compliance.yml │ ├── weekly.yml │ └── release.yml ├── .semgrepignore ├── symbolic-testutils ├── fixtures │ ├── macos │ │ ├── other.dSYM │ │ │ └── Contents │ │ │ │ └── Resources │ │ │ │ └── DWARF │ │ │ │ └── invalid │ │ ├── crash.app.dSYM │ │ │ └── Contents │ │ │ │ └── Resources │ │ │ │ └── DWARF │ │ │ │ └── crash │ │ ├── other.dmp.dSYM │ │ │ └── Contents │ │ │ │ └── Resources │ │ │ │ └── DWARF │ │ │ │ └── invalid │ │ ├── crash │ │ ├── crash.dSYM │ │ │ └── Contents │ │ │ │ ├── Resources │ │ │ │ └── DWARF │ │ │ │ │ ├── invalid │ │ │ │ │ └── crash │ │ │ │ └── Info.plist │ │ ├── Example.framework.dSYM │ │ │ └── Contents │ │ │ │ ├── Resources │ │ │ │ └── DWARF │ │ │ │ │ └── Example │ │ │ │ └── Info.plist │ │ └── overlapping_funcs.dSYM │ │ │ └── Contents │ │ │ └── Resources │ │ │ └── DWARF │ │ │ └── overlapping_funcs │ ├── linux │ │ ├── elf_debuglink │ │ │ ├── gen │ │ │ │ ├── debug_info.txt.crc │ │ │ │ ├── elf_with12_debuglink │ │ │ │ ├── elf_with1_debuglink │ │ │ │ ├── elf_with_debuglink │ │ │ │ ├── elf_with123_debuglink │ │ │ │ ├── elf_without_debuglink │ │ │ │ └── elf_with_compressed_debuglink │ │ │ └── generate_elf_debug_link.sh │ │ ├── crash │ │ ├── crash.debug │ │ ├── dynsyms_only │ │ ├── crash.debug-zlib │ │ ├── crash.debug-zstd │ │ └── README.md │ ├── sourcemapcache │ │ ├── simple │ │ │ ├── minified.js │ │ │ ├── original.js │ │ │ └── minified.js.map │ │ ├── trace │ │ │ ├── trace.html │ │ │ ├── shared.mjs │ │ │ ├── trace.mjs │ │ │ ├── async.mjs │ │ │ └── sync.mjs │ │ ├── inlining │ │ │ ├── module.js │ │ │ └── module.js.map │ │ ├── README.md │ │ ├── webpack │ │ │ ├── bundle.js │ │ │ └── bundle.js.map │ │ ├── nofiles.js │ │ ├── nofiles.js.map │ │ └── old-logs │ │ │ ├── simple.chrome.log │ │ │ ├── simple.firefox.log │ │ │ └── simple.safari.log │ ├── wasm │ │ └── simple.wasm │ ├── unreal │ │ ├── unreal_crash │ │ └── unreal_crash_apple │ ├── windows │ │ ├── crash.exe │ │ ├── crash.pdb │ │ ├── portable.pdb │ │ ├── hello-dwarf.exe │ │ ├── integration.dll │ │ ├── crash_with_srcsrv.pdb │ │ ├── source-links-only.pdb │ │ ├── CrashWithException.exe │ │ ├── CrashWithException.pdb │ │ ├── Sentry.Samples.Console.Basic.dll │ │ ├── Sentry.Samples.Console.Basic.pdb │ │ ├── Sentry.Samples.Console.Basic-embedded-ppdb.dll │ │ └── Sentry.Samples.Console.Basic-embedded-ppdb-with-sources.dll │ ├── symcache │ │ ├── compat │ │ │ └── v1.symc │ │ └── current │ │ │ ├── linux.symc │ │ │ └── macos.symc │ ├── android │ │ └── Sentry.Samples.Maui.pdb │ ├── ppdb-sourcelink-sample │ │ ├── build.sh │ │ ├── ppdb-sourcelink-sample.dll │ │ ├── ppdb-sourcelink-sample.pdb │ │ └── src │ │ │ ├── Class1.cs │ │ │ └── ppdb-sourcelink-sample.csproj │ ├── libgallium_dri.sym │ ├── xul.sym │ └── xul2.sym ├── overlapping_funcs │ ├── testachio.h │ ├── testaroni.h │ ├── main.c │ ├── testaroni.c │ ├── testachio.c │ └── build.sh ├── Cargo.toml └── src │ └── lib.rs ├── symbolic-ppdb ├── tests │ ├── fixtures │ │ ├── Async.pdbx │ │ ├── Scopes.pdbx │ │ ├── Documents.pdbx │ │ ├── SourceLink.pdbx │ │ ├── EmbeddedSource.pdbx │ │ ├── MethodBoundaries.pdbx │ │ └── contents │ │ │ ├── Program.cs │ │ │ ├── .NETCoreApp,Version=v6.0.AssemblyAttributes.cs │ │ │ ├── Sentry.Samples.Console.Basic.GlobalUsings.g.cs │ │ │ ├── Sentry.Attributes.cs │ │ │ └── Sentry.Samples.Console.Basic.AssemblyInfo.cs │ └── test_caches.rs ├── fuzz │ ├── Cargo.toml │ └── fuzz_targets │ │ └── fuzz_ppdb.rs ├── Cargo.toml └── src │ ├── cache │ ├── lookup.rs │ └── raw.rs │ └── lib.rs ├── symbolic-debuginfo ├── tests │ ├── fixtures │ │ ├── helloworld │ │ ├── invalid-symbols.fuzzed │ │ ├── 2d10c42f-591d-3265-b147-78ba0868073f.dwarf-hidden │ │ └── 2d10c42f-591d-3265-b147-78ba0868073f.plist │ ├── snapshots │ │ ├── test_objects__pe_dwarf_symbols.snap │ │ ├── test_objects__wasm_symbols.snap │ │ ├── test_objects__ppdb_files.snap │ │ ├── test_objects__elf_files.snap │ │ ├── test_objects__mach_files.snap │ │ ├── test_objects__pe_dwarf_files.snap │ │ ├── test_objects__pdb_files.snap │ │ ├── test_objects__breakpad_files.snap │ │ └── test_objects__breakpad_symbols.snap │ └── test_pdb_srcsrv.rs ├── fuzz │ ├── Cargo.toml │ └── fuzz_targets │ │ └── fuzz_objects.rs ├── src │ ├── macho │ │ └── mono_archive.rs │ ├── function_stack.rs │ └── lib.rs └── benches │ └── breakpad_parser.rs ├── .codecov.yml ├── .clang-format ├── symbolic-unreal ├── src │ ├── lib.rs │ └── error.rs └── Cargo.toml ├── .editorconfig ├── symbolic-sourcemapcache ├── src │ └── lib.rs └── Cargo.toml ├── symbolic-symcache ├── tests │ ├── snapshots │ │ ├── test_writer__overlapping_funcs.snap │ │ └── test_cache__lookup.snap │ ├── test_transformers.rs │ └── test_cache.rs ├── src │ └── transform │ │ ├── bcsymbolmap.rs │ │ ├── il2cpp.rs │ │ └── mod.rs ├── Cargo.toml └── benches │ └── bench_writer.rs ├── symbolic-il2cpp ├── src │ └── lib.rs └── Cargo.toml ├── examples ├── dump_sources │ ├── Cargo.toml │ └── src │ │ └── main.rs ├── object_debug │ ├── Cargo.toml │ └── src │ │ └── main.rs ├── dump_cfi │ ├── Cargo.toml │ └── src │ │ └── main.rs ├── addr2line │ └── Cargo.toml ├── unreal_engine_crash │ └── Cargo.toml ├── sourcemapcache_debug │ └── Cargo.toml ├── debuginfo_debug │ └── Cargo.toml ├── symcache_debug │ └── Cargo.toml └── minidump_stackwalk │ └── Cargo.toml ├── symbolic-cabi ├── cbindgen.toml ├── src │ ├── lib.rs │ ├── common.rs │ └── cfi.rs ├── Makefile ├── Cargo.toml └── c-tests │ ├── object.c │ └── common.c ├── run ├── scripts └── bump-version ├── .vscode ├── extensions.json ├── launch.json ├── settings.json └── tasks.json ├── .craft.yml ├── symbolic-cfi ├── Cargo.toml └── tests │ └── snapshots │ └── test_cfi__cfi_pe_windows.snap ├── symbolic-demangle ├── vendor │ └── swift │ │ ├── include │ │ ├── llvm │ │ │ ├── Support │ │ │ │ ├── DataTypes.h │ │ │ │ └── SwapByteOrder.h │ │ │ ├── Config │ │ │ │ └── abi-breaking.h │ │ │ └── ADT │ │ │ │ ├── STLForwardCompat.h │ │ │ │ └── STLFunctionalExtras.h │ │ ├── swift │ │ │ ├── ABI │ │ │ │ └── InvertibleProtocols.def │ │ │ └── Demangling │ │ │ │ ├── NamespaceMacros.h │ │ │ │ ├── ValueWitnessMangling.def │ │ │ │ ├── Errors.h │ │ │ │ └── Punycode.h │ │ └── llvm-c │ │ │ └── DataTypes.h │ │ ├── lib │ │ └── Demangling │ │ │ ├── CMakeLists.txt │ │ │ ├── CrashReporter.cpp │ │ │ ├── CrashReporter.h │ │ │ ├── NodeDumper.cpp │ │ │ ├── ManglingUtils.cpp │ │ │ └── DemanglerAssert.h │ │ ├── README.md │ │ └── 1-arguments.patch ├── tests │ ├── utils │ │ └── mod.rs │ ├── test_msvc.rs │ ├── test_objcpp.rs │ └── test_detection.rs ├── README.md ├── Cargo.toml ├── build.rs └── src │ └── swiftdemangle.cpp ├── LICENSE ├── symbolic-common ├── Cargo.toml ├── README.md └── src │ └── lib.rs ├── symbolic ├── Cargo.toml └── README.md ├── Cargo.toml └── Makefile /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | * @getsentry/owners-stacktrace 2 | -------------------------------------------------------------------------------- /.semgrepignore: -------------------------------------------------------------------------------- 1 | :include .gitignore 2 | 3 | examples/ 4 | **/tests/ 5 | -------------------------------------------------------------------------------- /symbolic-testutils/fixtures/macos/other.dSYM/Contents/Resources/DWARF/invalid: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /symbolic-testutils/fixtures/linux/elf_debuglink/gen/debug_info.txt.crc: -------------------------------------------------------------------------------- 1 | abf39bdc 2 | -------------------------------------------------------------------------------- /symbolic-testutils/fixtures/macos/crash.app.dSYM/Contents/Resources/DWARF/crash: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /symbolic-testutils/fixtures/macos/other.dmp.dSYM/Contents/Resources/DWARF/invalid: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /symbolic-testutils/fixtures/sourcemapcache/simple/minified.js: -------------------------------------------------------------------------------- 1 | function t(){}export default t; -------------------------------------------------------------------------------- /symbolic-testutils/overlapping_funcs/testachio.h: -------------------------------------------------------------------------------- 1 | void shell(void); 2 | static void unique_i_swear(void); 3 | -------------------------------------------------------------------------------- /symbolic-testutils/overlapping_funcs/testaroni.h: -------------------------------------------------------------------------------- 1 | void spin(void); 2 | static void unique_i_swear(void); 3 | -------------------------------------------------------------------------------- /symbolic-ppdb/tests/fixtures/Async.pdbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getsentry/symbolic/HEAD/symbolic-ppdb/tests/fixtures/Async.pdbx -------------------------------------------------------------------------------- /symbolic-testutils/fixtures/linux/crash: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getsentry/symbolic/HEAD/symbolic-testutils/fixtures/linux/crash -------------------------------------------------------------------------------- /symbolic-testutils/fixtures/macos/crash: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getsentry/symbolic/HEAD/symbolic-testutils/fixtures/macos/crash -------------------------------------------------------------------------------- /symbolic-testutils/fixtures/sourcemapcache/trace/trace.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /symbolic-ppdb/tests/fixtures/Scopes.pdbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getsentry/symbolic/HEAD/symbolic-ppdb/tests/fixtures/Scopes.pdbx -------------------------------------------------------------------------------- /symbolic-testutils/fixtures/macos/crash.dSYM/Contents/Resources/DWARF/invalid: -------------------------------------------------------------------------------- 1 | This file is used to test symbolic::common::DSymPathExt. 2 | -------------------------------------------------------------------------------- /symbolic-debuginfo/tests/fixtures/helloworld: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getsentry/symbolic/HEAD/symbolic-debuginfo/tests/fixtures/helloworld -------------------------------------------------------------------------------- /symbolic-ppdb/tests/fixtures/Documents.pdbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getsentry/symbolic/HEAD/symbolic-ppdb/tests/fixtures/Documents.pdbx -------------------------------------------------------------------------------- /symbolic-ppdb/tests/fixtures/SourceLink.pdbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getsentry/symbolic/HEAD/symbolic-ppdb/tests/fixtures/SourceLink.pdbx -------------------------------------------------------------------------------- /symbolic-testutils/fixtures/wasm/simple.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getsentry/symbolic/HEAD/symbolic-testutils/fixtures/wasm/simple.wasm -------------------------------------------------------------------------------- /symbolic-testutils/fixtures/linux/crash.debug: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getsentry/symbolic/HEAD/symbolic-testutils/fixtures/linux/crash.debug -------------------------------------------------------------------------------- /symbolic-testutils/fixtures/linux/dynsyms_only: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getsentry/symbolic/HEAD/symbolic-testutils/fixtures/linux/dynsyms_only -------------------------------------------------------------------------------- /symbolic-testutils/fixtures/unreal/unreal_crash: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getsentry/symbolic/HEAD/symbolic-testutils/fixtures/unreal/unreal_crash -------------------------------------------------------------------------------- /symbolic-testutils/fixtures/windows/crash.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getsentry/symbolic/HEAD/symbolic-testutils/fixtures/windows/crash.exe -------------------------------------------------------------------------------- /symbolic-testutils/fixtures/windows/crash.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getsentry/symbolic/HEAD/symbolic-testutils/fixtures/windows/crash.pdb -------------------------------------------------------------------------------- /symbolic-ppdb/tests/fixtures/EmbeddedSource.pdbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getsentry/symbolic/HEAD/symbolic-ppdb/tests/fixtures/EmbeddedSource.pdbx -------------------------------------------------------------------------------- /symbolic-testutils/fixtures/windows/portable.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getsentry/symbolic/HEAD/symbolic-testutils/fixtures/windows/portable.pdb -------------------------------------------------------------------------------- /symbolic-ppdb/tests/fixtures/MethodBoundaries.pdbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getsentry/symbolic/HEAD/symbolic-ppdb/tests/fixtures/MethodBoundaries.pdbx -------------------------------------------------------------------------------- /symbolic-testutils/fixtures/linux/crash.debug-zlib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getsentry/symbolic/HEAD/symbolic-testutils/fixtures/linux/crash.debug-zlib -------------------------------------------------------------------------------- /symbolic-testutils/fixtures/linux/crash.debug-zstd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getsentry/symbolic/HEAD/symbolic-testutils/fixtures/linux/crash.debug-zstd -------------------------------------------------------------------------------- /symbolic-testutils/fixtures/symcache/compat/v1.symc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getsentry/symbolic/HEAD/symbolic-testutils/fixtures/symcache/compat/v1.symc -------------------------------------------------------------------------------- /symbolic-testutils/fixtures/windows/hello-dwarf.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getsentry/symbolic/HEAD/symbolic-testutils/fixtures/windows/hello-dwarf.exe -------------------------------------------------------------------------------- /symbolic-testutils/fixtures/windows/integration.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getsentry/symbolic/HEAD/symbolic-testutils/fixtures/windows/integration.dll -------------------------------------------------------------------------------- /symbolic-testutils/fixtures/unreal/unreal_crash_apple: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getsentry/symbolic/HEAD/symbolic-testutils/fixtures/unreal/unreal_crash_apple -------------------------------------------------------------------------------- /symbolic-debuginfo/tests/fixtures/invalid-symbols.fuzzed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getsentry/symbolic/HEAD/symbolic-debuginfo/tests/fixtures/invalid-symbols.fuzzed -------------------------------------------------------------------------------- /symbolic-testutils/fixtures/symcache/current/linux.symc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getsentry/symbolic/HEAD/symbolic-testutils/fixtures/symcache/current/linux.symc -------------------------------------------------------------------------------- /symbolic-testutils/fixtures/symcache/current/macos.symc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getsentry/symbolic/HEAD/symbolic-testutils/fixtures/symcache/current/macos.symc -------------------------------------------------------------------------------- /symbolic-testutils/fixtures/windows/crash_with_srcsrv.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getsentry/symbolic/HEAD/symbolic-testutils/fixtures/windows/crash_with_srcsrv.pdb -------------------------------------------------------------------------------- /symbolic-testutils/fixtures/windows/source-links-only.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getsentry/symbolic/HEAD/symbolic-testutils/fixtures/windows/source-links-only.pdb -------------------------------------------------------------------------------- /symbolic-testutils/fixtures/android/Sentry.Samples.Maui.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getsentry/symbolic/HEAD/symbolic-testutils/fixtures/android/Sentry.Samples.Maui.pdb -------------------------------------------------------------------------------- /symbolic-testutils/fixtures/windows/CrashWithException.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getsentry/symbolic/HEAD/symbolic-testutils/fixtures/windows/CrashWithException.exe -------------------------------------------------------------------------------- /symbolic-testutils/fixtures/windows/CrashWithException.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getsentry/symbolic/HEAD/symbolic-testutils/fixtures/windows/CrashWithException.pdb -------------------------------------------------------------------------------- /symbolic-testutils/fixtures/ppdb-sourcelink-sample/build.sh: -------------------------------------------------------------------------------- 1 | dotnet build src -c Release --no-incremental 2 | cp src/bin/Release/*/*.dll . 3 | cp src/bin/Release/*/*.pdb . 4 | -------------------------------------------------------------------------------- /symbolic-debuginfo/tests/snapshots/test_objects__pe_dwarf_symbols.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: symbolic-debuginfo/tests/test_objects.rs 3 | expression: SymbolsDebug(&symbols) 4 | --- 5 | 6 | -------------------------------------------------------------------------------- /symbolic-testutils/fixtures/windows/Sentry.Samples.Console.Basic.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getsentry/symbolic/HEAD/symbolic-testutils/fixtures/windows/Sentry.Samples.Console.Basic.dll -------------------------------------------------------------------------------- /symbolic-testutils/fixtures/windows/Sentry.Samples.Console.Basic.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getsentry/symbolic/HEAD/symbolic-testutils/fixtures/windows/Sentry.Samples.Console.Basic.pdb -------------------------------------------------------------------------------- /symbolic-testutils/overlapping_funcs/main.c: -------------------------------------------------------------------------------- 1 | #include "testachio.h" 2 | #include "testaroni.h" 3 | 4 | int main() 5 | { 6 | spin(); 7 | shell(); 8 | return 0; 9 | } 10 | -------------------------------------------------------------------------------- /symbolic-testutils/fixtures/linux/elf_debuglink/gen/elf_with12_debuglink: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getsentry/symbolic/HEAD/symbolic-testutils/fixtures/linux/elf_debuglink/gen/elf_with12_debuglink -------------------------------------------------------------------------------- /symbolic-testutils/fixtures/linux/elf_debuglink/gen/elf_with1_debuglink: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getsentry/symbolic/HEAD/symbolic-testutils/fixtures/linux/elf_debuglink/gen/elf_with1_debuglink -------------------------------------------------------------------------------- /symbolic-testutils/fixtures/linux/elf_debuglink/gen/elf_with_debuglink: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getsentry/symbolic/HEAD/symbolic-testutils/fixtures/linux/elf_debuglink/gen/elf_with_debuglink -------------------------------------------------------------------------------- /symbolic-testutils/fixtures/linux/elf_debuglink/gen/elf_with123_debuglink: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getsentry/symbolic/HEAD/symbolic-testutils/fixtures/linux/elf_debuglink/gen/elf_with123_debuglink -------------------------------------------------------------------------------- /symbolic-testutils/fixtures/linux/elf_debuglink/gen/elf_without_debuglink: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getsentry/symbolic/HEAD/symbolic-testutils/fixtures/linux/elf_debuglink/gen/elf_without_debuglink -------------------------------------------------------------------------------- /symbolic-testutils/fixtures/sourcemapcache/trace/shared.mjs: -------------------------------------------------------------------------------- 1 | export function callsSyncCallback(cb) { 2 | cb(); 3 | } 4 | 5 | export async function callsAsyncCallback(cb) { 6 | await cb(); 7 | } 8 | -------------------------------------------------------------------------------- /symbolic-testutils/overlapping_funcs/testaroni.c: -------------------------------------------------------------------------------- 1 | #include "testaroni.h" 2 | 3 | void spin(void) 4 | { 5 | unique_i_swear(); 6 | } 7 | 8 | static void unique_i_swear(void) 9 | { 10 | } 11 | -------------------------------------------------------------------------------- /.codecov.yml: -------------------------------------------------------------------------------- 1 | coverage: 2 | status: 3 | project: 4 | default: 5 | informational: true 6 | patch: false 7 | 8 | comment: 9 | layout: "diff" 10 | require_changes: true 11 | -------------------------------------------------------------------------------- /symbolic-testutils/fixtures/macos/crash.dSYM/Contents/Resources/DWARF/crash: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getsentry/symbolic/HEAD/symbolic-testutils/fixtures/macos/crash.dSYM/Contents/Resources/DWARF/crash -------------------------------------------------------------------------------- /symbolic-testutils/fixtures/ppdb-sourcelink-sample/ppdb-sourcelink-sample.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getsentry/symbolic/HEAD/symbolic-testutils/fixtures/ppdb-sourcelink-sample/ppdb-sourcelink-sample.dll -------------------------------------------------------------------------------- /symbolic-testutils/fixtures/ppdb-sourcelink-sample/ppdb-sourcelink-sample.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getsentry/symbolic/HEAD/symbolic-testutils/fixtures/ppdb-sourcelink-sample/ppdb-sourcelink-sample.pdb -------------------------------------------------------------------------------- /symbolic-testutils/overlapping_funcs/testachio.c: -------------------------------------------------------------------------------- 1 | #include "testachio.h" 2 | 3 | void shell(void) 4 | { 5 | unique_i_swear(); 6 | } 7 | 8 | static void unique_i_swear(void) 9 | { 10 | } 11 | -------------------------------------------------------------------------------- /symbolic-debuginfo/tests/snapshots/test_objects__wasm_symbols.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: symbolic-debuginfo/tests/test_objects.rs 3 | expression: SymbolsDebug(&symbols) 4 | --- 5 | 8b internal_func 6 | -------------------------------------------------------------------------------- /symbolic-testutils/fixtures/linux/elf_debuglink/gen/elf_with_compressed_debuglink: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getsentry/symbolic/HEAD/symbolic-testutils/fixtures/linux/elf_debuglink/gen/elf_with_compressed_debuglink -------------------------------------------------------------------------------- /symbolic-testutils/fixtures/windows/Sentry.Samples.Console.Basic-embedded-ppdb.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getsentry/symbolic/HEAD/symbolic-testutils/fixtures/windows/Sentry.Samples.Console.Basic-embedded-ppdb.dll -------------------------------------------------------------------------------- /symbolic-debuginfo/tests/fixtures/2d10c42f-591d-3265-b147-78ba0868073f.dwarf-hidden: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getsentry/symbolic/HEAD/symbolic-debuginfo/tests/fixtures/2d10c42f-591d-3265-b147-78ba0868073f.dwarf-hidden -------------------------------------------------------------------------------- /symbolic-testutils/fixtures/libgallium_dri.sym: -------------------------------------------------------------------------------- 1 | MODULE Linux x86_64 5A5F32914295A4FA22B591670A49FBEF0 libgallium_dri.so 2 | INFO CODE_ID 91325F5A9542FAA422B591670A49FBEF719A143E 3 | PUBLIC 88e650 0 nouveau_drm_screen_create 4 | -------------------------------------------------------------------------------- /symbolic-testutils/fixtures/macos/Example.framework.dSYM/Contents/Resources/DWARF/Example: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getsentry/symbolic/HEAD/symbolic-testutils/fixtures/macos/Example.framework.dSYM/Contents/Resources/DWARF/Example -------------------------------------------------------------------------------- /.clang-format: -------------------------------------------------------------------------------- 1 | BasedOnStyle: Google 2 | --- 3 | Language: Cpp 4 | IndentWidth: 4 5 | DerivePointerAlignment: false 6 | PointerAlignment: Right 7 | AllowShortFunctionsOnASingleLine: None 8 | BinPackParameters: false 9 | --- 10 | -------------------------------------------------------------------------------- /symbolic-testutils/fixtures/windows/Sentry.Samples.Console.Basic-embedded-ppdb-with-sources.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getsentry/symbolic/HEAD/symbolic-testutils/fixtures/windows/Sentry.Samples.Console.Basic-embedded-ppdb-with-sources.dll -------------------------------------------------------------------------------- /symbolic-testutils/fixtures/macos/overlapping_funcs.dSYM/Contents/Resources/DWARF/overlapping_funcs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/getsentry/symbolic/HEAD/symbolic-testutils/fixtures/macos/overlapping_funcs.dSYM/Contents/Resources/DWARF/overlapping_funcs -------------------------------------------------------------------------------- /symbolic-testutils/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "symbolic-testutils" 3 | version = "12.17.0" 4 | license = "MIT" 5 | edition = "2021" 6 | publish = false 7 | 8 | [package.metadata.docs.rs] 9 | all-features = true 10 | 11 | [dependencies] 12 | -------------------------------------------------------------------------------- /symbolic-testutils/fixtures/sourcemapcache/simple/original.js: -------------------------------------------------------------------------------- 1 | // ./node_modules/.bin/terser -c -m --module tests/fixtures/simple/original.js --source-map includeSources -o tests/fixtures/simple/minified.js 2 | function abcd() {} 3 | export default abcd; 4 | -------------------------------------------------------------------------------- /symbolic-testutils/fixtures/sourcemapcache/inlining/module.js: -------------------------------------------------------------------------------- 1 | function n(n){!function(n){throw new Error(n)}(n)}const t=()=>n("wat");window.addEventListener("load",(()=>{document.querySelector("button").addEventListener("click",t)})); 2 | //# sourceMappingURL=module.js.map 3 | -------------------------------------------------------------------------------- /symbolic-ppdb/tests/fixtures/contents/Program.cs: -------------------------------------------------------------------------------- 1 | using Sentry; 2 | 3 | using (SentrySdk.Init("https://eb18e953812b41c3aeb042e666fd3b5c@o447951.ingest.sentry.io/5428537")) 4 | { 5 | // The following exception is captured and sent to Sentry 6 | throw null; 7 | } 8 | -------------------------------------------------------------------------------- /symbolic-unreal/src/lib.rs: -------------------------------------------------------------------------------- 1 | //! API to process Unreal Engine 4 crashes. 2 | #![warn(missing_docs)] 3 | 4 | mod container; 5 | mod context; 6 | mod error; 7 | mod logs; 8 | 9 | pub use container::*; 10 | pub use context::*; 11 | pub use error::*; 12 | pub use logs::*; 13 | -------------------------------------------------------------------------------- /symbolic-ppdb/tests/fixtures/contents/.NETCoreApp,Version=v6.0.AssemblyAttributes.cs: -------------------------------------------------------------------------------- 1 | // 2 | using System; 3 | using System.Reflection; 4 | [assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] 5 | -------------------------------------------------------------------------------- /symbolic-testutils/fixtures/xul.sym: -------------------------------------------------------------------------------- 1 | MODULE windows x86_64 09F9D7ECF31F60E34C4C44205044422E1 xul.pdb 2 | INFO CODE_ID 5E8F310E69D0000 xul.dll 3 | FUNC c6db70 23e 0 std::_Func_impl_no_alloc<`lambda at /builds/worker/checkouts/gecko/netwerk/protocol/http/HttpChannelChild.cpp:411:7',void>::_Do_call() 4 | -------------------------------------------------------------------------------- /symbolic-testutils/fixtures/ppdb-sourcelink-sample/src/Class1.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Sample 4 | { 5 | public class Class1 6 | { 7 | // Just a test 8 | 9 | public void SayHello() 10 | { 11 | Console.WriteLine("Hello!"); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /.github/workflows/danger.yml: -------------------------------------------------------------------------------- 1 | name: Danger 2 | 3 | on: 4 | pull_request: 5 | types: [opened, synchronize, reopened, edited, ready_for_review, labeled, unlabeled] 6 | 7 | jobs: 8 | danger: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - uses: getsentry/github-workflows/danger@v3 12 | -------------------------------------------------------------------------------- /symbolic-testutils/fixtures/sourcemapcache/README.md: -------------------------------------------------------------------------------- 1 | # trace 2 | 3 | A sync and async stack trace through various constructs, with named and anonymous 4 | functions and arrow functions. 5 | 6 | # perf 7 | 8 | - https://unpkg.com/typescript@4.6.4/lib/typescript.js 9 | - https://unpkg.com/preact@10.7.2/dist/preact.module.js 10 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | end_of_line = lf 5 | insert_final_newline = true 6 | trim_trailing_whitespace = true 7 | charset = utf-8 8 | 9 | [*.{c,cc,cpp,h,rs,json}] 10 | indent_style = space 11 | indent_size = 4 12 | 13 | [.travis.yml] 14 | indent_style = space 15 | indent_size = 2 16 | 17 | [Makefile] 18 | indent_style = tab 19 | -------------------------------------------------------------------------------- /symbolic-testutils/fixtures/sourcemapcache/webpack/bundle.js: -------------------------------------------------------------------------------- 1 | (()=>{var r={562:r=>{r.exports=function(r){r()}},298:r=>{r.exports=function(){throw new Error("wat")}}},t={};function o(n){var e=t[n];if(void 0!==e)return e.exports;var s=t[n]={exports:{}};return r[n](s,s.exports,o),s.exports}(()=>{const r=o(298);o(562)(r)})()})(); 2 | //# sourceMappingURL=bundle.js.map -------------------------------------------------------------------------------- /symbolic-debuginfo/tests/fixtures/2d10c42f-591d-3265-b147-78ba0868073f.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | DBGOriginalUUID 5 | C8374B6D-6E96-34D8-AE38-EFAA5FEC424F 6 | 7 | -------------------------------------------------------------------------------- /symbolic-sourcemapcache/src/lib.rs: -------------------------------------------------------------------------------- 1 | //! A fast lookup cache for SourceMaps. 2 | 3 | #![warn(missing_docs)] 4 | #![allow(clippy::derive_partial_eq_without_eq)] 5 | 6 | mod lookup; 7 | mod raw; 8 | mod writer; 9 | 10 | pub use js_source_scopes::{ScopeLookupResult, SourcePosition}; 11 | pub use lookup::{Error as SourceMapCacheError, *}; 12 | pub use writer::*; 13 | -------------------------------------------------------------------------------- /symbolic-symcache/tests/snapshots/test_writer__overlapping_funcs.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: symbolic-symcache/tests/test_writer.rs 3 | expression: FunctionsDebug(&symcache) 4 | --- 5 | 0 _mh_execute_header 6 | 3f50 main 7 | 3f80 shell 8 | 3f90 unique_i_swear 9 | 3fa0 spin 10 | 3fb0 unique_i_swear 11 | -------------------------------------------------------------------------------- /symbolic-testutils/fixtures/sourcemapcache/simple/minified.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"names":["abcd"],"sources":["tests/fixtures/simple/original.js"],"sourcesContent":["// ./node_modules/.bin/terser -c -m --module tests/fixtures/simple/original.js --source-map includeSources -o tests/fixtures/simple/minified.js\nfunction abcd() {}\nexport default abcd;\n"],"mappings":"AACA,SAASA,oBACMA"} -------------------------------------------------------------------------------- /symbolic-il2cpp/src/lib.rs: -------------------------------------------------------------------------------- 1 | //! Experimental IL2CPP code. 2 | //! 3 | //! This crate **is not supported**, it may break its API, it may completely disappear 4 | //! again. Do not consider this part of symbolic releases. It is experimental code to 5 | //! explore Unity IL2CPP debugging. 6 | 7 | mod line_mapping; 8 | 9 | pub use line_mapping::{LineMapping, ObjectLineMapping}; 10 | -------------------------------------------------------------------------------- /symbolic-ppdb/tests/fixtures/contents/Sentry.Samples.Console.Basic.GlobalUsings.g.cs: -------------------------------------------------------------------------------- 1 | // 2 | global using global::System; 3 | global using global::System.Collections.Generic; 4 | global using global::System.IO; 5 | global using global::System.Linq; 6 | global using global::System.Net.Http; 7 | global using global::System.Threading; 8 | global using global::System.Threading.Tasks; 9 | -------------------------------------------------------------------------------- /examples/dump_sources/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "dump_sources" 3 | version = "12.17.0" 4 | authors = ["Jan Michael Auer "] 5 | edition = "2021" 6 | publish = false 7 | 8 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 9 | 10 | [dependencies] 11 | clap = { workspace = true } 12 | symbolic = { version = "12.17.0", path = "../../symbolic" } 13 | -------------------------------------------------------------------------------- /examples/object_debug/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "object_debug" 3 | version = "12.17.0" 4 | authors = ["Jan Michael Auer "] 5 | edition = "2021" 6 | publish = false 7 | 8 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 9 | 10 | [dependencies] 11 | clap = { workspace = true } 12 | symbolic = { version = "12.17.0", path = "../../symbolic" } 13 | -------------------------------------------------------------------------------- /symbolic-testutils/fixtures/sourcemapcache/nofiles.js: -------------------------------------------------------------------------------- 1 | function add(a, b) { 2 | 'use strict'; 3 | return a + b; 4 | } 5 | function multiply(a, b) { 6 | 'use strict'; 7 | return a * b; 8 | } 9 | function divide(a, b) { 10 | 'use strict'; 11 | try { 12 | return multiply(add(a, b), a, b) / c; 13 | } catch (e) { 14 | Raven.captureException(e); 15 | } 16 | } 17 | //# sourceMappingURL=nofiles.js.map 18 | -------------------------------------------------------------------------------- /symbolic-testutils/overlapping_funcs/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Replace clang with gcc if needed. Produces overlapping_funcs.dSYM which should be placed in 3 | # symbolic-testutils/fixtures/macos for test_write_functions_overlapping_funcs. Also produces an 4 | # executable which can be ignored. Or run it for a surprise! (It doesn't do anything.) 5 | clang -Weverything main.c -v -g -o overlapping_funcs testachio.c testaroni.c 6 | -------------------------------------------------------------------------------- /symbolic-cabi/cbindgen.toml: -------------------------------------------------------------------------------- 1 | header = "/* C bindings to the symbolic library */" 2 | include_guard = "SYMBOLIC_H_INCLUDED" 3 | autogen_warning = "/* Warning, this file is autogenerated. Do not modify this manually. */" 4 | include_version = true 5 | line_length = 80 6 | tab_width = 2 7 | language = "C" 8 | 9 | [parse] 10 | expand = ["symbolic-cabi"] 11 | 12 | [enum] 13 | rename_variants = "QualifiedScreamingSnakeCase" 14 | -------------------------------------------------------------------------------- /symbolic-testutils/fixtures/ppdb-sourcelink-sample/src/ppdb-sourcelink-sample.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | true 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /examples/dump_cfi/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "dump_cfi" 3 | version = "12.17.0" 4 | authors = ["Jan Michael Auer "] 5 | edition = "2021" 6 | publish = false 7 | 8 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 9 | 10 | [dependencies] 11 | anyhow = { workspace = true } 12 | clap = { workspace = true } 13 | symbolic = { version = "12.17.0", path = "../../symbolic", features = ["cfi"] } 14 | -------------------------------------------------------------------------------- /examples/addr2line/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "addr2line" 3 | version = "12.17.0" 4 | authors = ["Jan Michael Auer "] 5 | edition = "2021" 6 | publish = false 7 | 8 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 9 | 10 | [dependencies] 11 | anyhow = { workspace = true } 12 | clap = { workspace = true } 13 | symbolic = { version = "12.17.0", path = "../../symbolic", features = ["demangle"] } 14 | -------------------------------------------------------------------------------- /examples/unreal_engine_crash/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "unreal_engine_crash" 3 | version = "12.17.0" 4 | authors = ["Jan Michael Auer "] 5 | edition = "2021" 6 | publish = false 7 | 8 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 9 | 10 | [dependencies] 11 | clap = { workspace = true } 12 | symbolic = { version = "12.17.0", path = "../../symbolic", features = [ 13 | "unreal", 14 | ] } 15 | -------------------------------------------------------------------------------- /examples/sourcemapcache_debug/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "sourcemapcache_debug" 3 | version = "12.17.0" 4 | authors = ["Sentry "] 5 | edition = "2021" 6 | publish = false 7 | 8 | [dependencies] 9 | anyhow = { workspace = true } 10 | clap = { workspace = true } 11 | symbolic = { version = "12.17.0", path = "../../symbolic", features = [ 12 | "sourcemapcache", 13 | ] } 14 | tracing-subscriber = { workspace = true, features = ["env-filter"] } 15 | -------------------------------------------------------------------------------- /.github/workflows/enforce-license-compliance.yml: -------------------------------------------------------------------------------- 1 | name: Enforce License Compliance 2 | 3 | on: 4 | push: 5 | branches: [master, release/*] 6 | pull_request: 7 | branches: [master] 8 | 9 | jobs: 10 | enforce-license-compliance: 11 | runs-on: ubuntu-latest 12 | steps: 13 | - name: 'Enforce License Compliance' 14 | uses: getsentry/action-enforce-license-compliance@main 15 | with: 16 | fossa_api_key: ${{ secrets.FOSSA_API_KEY }} 17 | -------------------------------------------------------------------------------- /examples/debuginfo_debug/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "debuginfo_debug" 3 | version = "12.17.0" 4 | authors = ["Markus Stange "] 5 | edition = "2021" 6 | publish = false 7 | 8 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 9 | 10 | [dependencies] 11 | anyhow = { workspace = true } 12 | clap = { workspace = true } 13 | symbolic = { version = "12.17.0", path = "../../symbolic", features = [ 14 | "demangle", 15 | ] } 16 | -------------------------------------------------------------------------------- /symbolic-testutils/fixtures/xul2.sym: -------------------------------------------------------------------------------- 1 | MODULE windows x86_64 88FD491257B2E0F54C4C44205044422E1 xul.pdb 2 | INFO CODE_ID 5ED439916EB4000 xul.dll 3 | FILE 16693 hg:hg.mozilla.org/mozilla-central:js/src/vm/Interpreter.cpp:e4b11f027efc1f8c2710ae3f52487a8f10a8fb39 4 | FUNC 3c01d20 1f6e8 0 Interpret(JSContext*, js::RunState&) 5 | 3c104e1 c 3021 16693 6 | 3c104ed 10 3070 16693 7 | 3c104fd e2 3071 16693 8 | 3c105df 10 3076 16693 9 | 3c105ef 9 3077 16693 10 | 3c105f8 c 3078 16693 11 | 3c10604 20 3079 16693 12 | -------------------------------------------------------------------------------- /symbolic-debuginfo/tests/snapshots/test_objects__ppdb_files.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: symbolic-debuginfo/tests/test_objects.rs 3 | expression: FilesDebug(&files) 4 | --- 5 | /Users/swatinem/Coding/sentry-dotnet/samples/foo/Program.cs 6 | /Users/swatinem/Coding/sentry-dotnet/samples/foo/obj/Debug/net6.0/foo.GlobalUsings.g.cs 7 | /Users/swatinem/Coding/sentry-dotnet/samples/foo/obj/Debug/net6.0/.NETCoreApp,Version=v6.0.AssemblyAttributes.cs 8 | /Users/swatinem/Coding/sentry-dotnet/samples/foo/obj/Debug/net6.0/foo.AssemblyInfo.cs 9 | -------------------------------------------------------------------------------- /symbolic-testutils/fixtures/linux/README.md: -------------------------------------------------------------------------------- 1 | The `crash.debug-z{lib,std}` files contain the exact same debug information as the `crash.debug` file they were derived from. 2 | 3 | The files were derived using `llvm-objcopy --compress-debug-sections=z{lib,std} crash.debug crash.debug-z{lib,std}` respectively. 4 | 5 | `dynsyms_only` is an ELF file that only contains a dynamic symbol table obtained using `llvm-objcopy --only-keep-debug --set-section-type .dynstr=3 --set-section-type .dynsym=11 linux-vdso.1.so dynsyms_only`. 6 | -------------------------------------------------------------------------------- /run: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | FLAGS="" 4 | 5 | while : ; do 6 | case "$1" in 7 | "--release") 8 | FLAGS="$FLAGS --release" 9 | ;; 10 | "--trace") 11 | export RUST_BACKTRACE=1 12 | ;; 13 | *) 14 | break 15 | ;; 16 | esac 17 | shift 18 | done 19 | 20 | if [ $# -lt 1 ]; then 21 | echo "usage: $0 [--release] [args...]" 22 | exit 23 | fi 24 | 25 | EXAMPLE="$1"; 26 | shift 27 | 28 | set -x 29 | cargo run --quiet --package $EXAMPLE $FLAGS -- "$@" 30 | -------------------------------------------------------------------------------- /examples/symcache_debug/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "symcache_debug" 3 | version = "12.17.0" 4 | authors = ["Jan Michael Auer "] 5 | edition = "2021" 6 | publish = false 7 | 8 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 9 | 10 | [dependencies] 11 | anyhow = { workspace = true } 12 | clap = { workspace = true } 13 | symbolic = { version = "12.17.0", path = "../../symbolic", features = [ 14 | "symcache", 15 | "demangle", 16 | "il2cpp", 17 | ] } 18 | -------------------------------------------------------------------------------- /symbolic-ppdb/fuzz/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "symbolic-ppdb-fuzz" 3 | version = "12.17.0" 4 | authors = ["Automatically generated"] 5 | publish = false 6 | edition = "2021" 7 | 8 | [package.metadata] 9 | cargo-fuzz = true 10 | 11 | [dependencies] 12 | libfuzzer-sys = "0.4" 13 | 14 | [dependencies.symbolic-ppdb] 15 | path = ".." 16 | 17 | # Prevent this from interfering with workspaces 18 | [workspace] 19 | members = ["."] 20 | 21 | [[bin]] 22 | name = "fuzz_ppdb" 23 | path = "fuzz_targets/fuzz_ppdb.rs" 24 | test = false 25 | doc = false 26 | -------------------------------------------------------------------------------- /symbolic-cabi/src/lib.rs: -------------------------------------------------------------------------------- 1 | //! Exposes a C-ABI for symbolic. 2 | 3 | #![allow(clippy::missing_safety_doc)] 4 | 5 | #[macro_use] 6 | mod utils; 7 | 8 | mod cfi; 9 | mod common; 10 | mod core; 11 | mod debuginfo; 12 | mod proguard; 13 | mod sourcemap; 14 | mod sourcemapcache; 15 | mod symcache; 16 | 17 | pub use crate::cfi::*; 18 | pub use crate::common::*; 19 | pub use crate::core::*; 20 | pub use crate::debuginfo::*; 21 | pub use crate::proguard::*; 22 | pub use crate::sourcemap::*; 23 | pub use crate::sourcemapcache::*; 24 | pub use crate::symcache::*; 25 | -------------------------------------------------------------------------------- /symbolic-debuginfo/fuzz/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "symbolic-debuginfo-fuzz" 3 | version = "12.17.0" 4 | authors = ["Automatically generated"] 5 | publish = false 6 | edition = "2021" 7 | 8 | [package.metadata] 9 | cargo-fuzz = true 10 | 11 | [dependencies] 12 | libfuzzer-sys = "0.4" 13 | 14 | [dependencies.symbolic-debuginfo] 15 | path = ".." 16 | 17 | # Prevent this from interfering with workspaces 18 | [workspace] 19 | members = ["."] 20 | 21 | [[bin]] 22 | name = "fuzz_objects" 23 | path = "fuzz_targets/fuzz_objects.rs" 24 | test = false 25 | doc = false 26 | -------------------------------------------------------------------------------- /symbolic-testutils/fixtures/sourcemapcache/trace/trace.mjs: -------------------------------------------------------------------------------- 1 | import { namedFn } from "./sync.mjs"; 2 | import { asyncNamedFn } from "./async.mjs"; 3 | 4 | // node has a default limit of 10 5 | Error.stackTraceLimit = Infinity; 6 | 7 | let output = "# sync stack trace\n"; 8 | 9 | try { 10 | namedFn(); 11 | } catch (e) { 12 | output += e.stack; 13 | } 14 | 15 | output += "\n\n"; 16 | 17 | output += "# async stack trace\n"; 18 | 19 | try { 20 | await asyncNamedFn(); 21 | } catch (e) { 22 | output += e.stack; 23 | } 24 | 25 | output += "\n"; 26 | 27 | console.log(output); 28 | -------------------------------------------------------------------------------- /symbolic-debuginfo/tests/snapshots/test_objects__elf_files.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: symbolic-debuginfo/tests/test_objects.rs 3 | expression: "FilesDebug(&files[..10])" 4 | --- 5 | /work/linux/main.cpp 6 | /usr/include/x86_64-linux-gnu/bits/stdio2.h 7 | /work/deps/breakpad/src/client/linux/handler/minidump_descriptor.h 8 | /usr/include/c++/5/bits/basic_string.h 9 | /usr/include/c++/5/ext/new_allocator.h 10 | /usr/include/c++/5/bits/char_traits.h 11 | /work/deps/breakpad/src/client/linux/handler/microdump_extra_info.h 12 | /usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h 13 | /usr/include/x86_64-linux-gnu/bits/types.h 14 | /usr/include/stdio.h 15 | -------------------------------------------------------------------------------- /scripts/bump-version: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -euo pipefail 3 | 4 | if [ "$(uname -s)" != "Linux" ]; then 5 | echo "Please use the GitHub Action." 6 | exit 1 7 | fi 8 | 9 | SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 10 | cd $SCRIPT_DIR/.. 11 | 12 | OLD_VERSION="${1}" 13 | NEW_VERSION="${2}" 14 | 15 | echo "Bumping version: ${NEW_VERSION}" 16 | 17 | TOML_FILES="$(git ls-files '*Cargo.toml')" 18 | perl -pi -e "s/^version = .*\$/version = \"$NEW_VERSION\"/" $TOML_FILES 19 | perl -pi -e "s/^(symbolic.*version = )\"[^\"]*\"/\\1\"$NEW_VERSION\"/" $TOML_FILES 20 | cargo metadata --format-version 1 > /dev/null # update `Cargo.lock` 21 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | // See http://go.microsoft.com/fwlink/?LinkId=827846 3 | // for the documentation about the extensions.json format 4 | "recommendations": [ 5 | // C++ language support 6 | "ms-vscode.cpptools", 7 | // TOML language support 8 | "tamasfe.even-better-toml", 9 | // Rust language server 10 | "rust-lang.rust-analyzer", 11 | // Crates.io dependency versions 12 | "fill-labs.dependi", 13 | // Debugger support for Rust and native 14 | "vadimcn.vscode-lldb", 15 | // PEST syntax support 16 | "xoronic.pestfile" 17 | 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /symbolic-debuginfo/tests/snapshots/test_objects__mach_files.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: symbolic-debuginfo/tests/test_objects.rs 3 | expression: "FilesDebug(&files[..10])" 4 | --- 5 | /Users/travis/build/getsentry/breakpad-tools/deps/breakpad/src/client/minidump_file_writer.h 6 | /usr/include/_types/_uint32_t.h 7 | /Users/travis/build/getsentry/breakpad-tools/deps/breakpad/src/google_breakpad/common/minidump_format.h 8 | /usr/include/i386/_types.h 9 | /usr/include/sys/_types/_size_t.h 10 | /usr/include/_types/_uint64_t.h 11 | /usr/include/sys/_types/_ssize_t.h 12 | /usr/include/_types/_uint16_t.h 13 | /usr/include/sys/_types.h 14 | /usr/include/sys/_types/_off_t.h 15 | -------------------------------------------------------------------------------- /symbolic-testutils/fixtures/sourcemapcache/nofiles.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":[null,null],"names":["add","a","b","multiply","divide","c","e","Raven","captureException"],"mappings":"AAAA,QAASA,KAAIC,EAAGC,GACf,YACA,OAAOD,GAAIC,ECFZ,QAASC,UAASF,EAAGC,GACpB,YACA,OAAOD,GAAIC,EAEZ,QAASE,QAAOH,EAAGC,GAClB,YACA,KACC,MAAOC,UAASH,IAAIC,EAAGC,GAAID,EAAGC,GAAKG,EAClC,MAAOC,GACRC,MAAMC,iBAAiBF","sourcesContent":["function add(a, b) {\n\t\"use strict\";\n\treturn a + b; // fôo\n}\n","function multiply(a, b) {\n\t\"use strict\";\n\treturn a * b;\n}\nfunction divide(a, b) {\n\t\"use strict\";\n\ttry {\n\t\treturn multiply(add(a, b), a, b) / c;\n\t} catch (e) {\n\t\tRaven.captureException(e);\n\t}\n}\n"]} 2 | -------------------------------------------------------------------------------- /.craft.yml: -------------------------------------------------------------------------------- 1 | minVersion: "0.34.1" 2 | github: 3 | owner: getsentry 4 | repo: symbolic 5 | changelogPolicy: auto 6 | 7 | statusProvider: 8 | name: github 9 | artifactProvider: 10 | name: github 11 | 12 | preReleaseCommand: bash scripts/bump-version 13 | targets: 14 | - name: crates 15 | - name: pypi 16 | - name: github 17 | - name: sentry-pypi 18 | internalPypiRepo: getsentry/pypi 19 | requireNames: 20 | - /^symbolic-.*-py2.py3-none-macosx_10_15_x86_64.whl$/ 21 | - /^symbolic-.*-py2.py3-none-macosx_11_0_arm64.whl$/ 22 | - /^symbolic-.*-py2.py3-none-manylinux_2_28_aarch64.whl$/ 23 | - /^symbolic-.*-py2.py3-none-manylinux_2_28_x86_64.whl$/ 24 | - /^symbolic-.*.tar.gz$/ 25 | -------------------------------------------------------------------------------- /symbolic-il2cpp/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "symbolic-il2cpp" 3 | version = "12.17.0" 4 | license = "MIT" 5 | authors = ["Sentry "] 6 | documentation = "https://docs.rs/symbolic-il2cpp" 7 | homepage = "https://github.com/getsentry/symbolic" 8 | repository = "https://github.com/getsentry/symbolic" 9 | description = """ 10 | A library for parsing il2cpp line mappings. 11 | """ 12 | edition.workspace = true 13 | rust-version.workspace = true 14 | 15 | [dependencies] 16 | indexmap = { workspace = true } 17 | serde_json = { workspace = true } 18 | symbolic-common = { version = "12.17.0", path = "../symbolic-common" } 19 | symbolic-debuginfo = { version = "12.17.0", path = "../symbolic-debuginfo" } 20 | -------------------------------------------------------------------------------- /symbolic-ppdb/tests/fixtures/contents/Sentry.Attributes.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | //------------------------------------------------------------------------------ 9 | 10 | using System; 11 | using System.Reflection; 12 | 13 | [assembly: System.Reflection.AssemblyMetadata("Sentry.ProjectDirectory", "C:\\dev\\sentry-dotnet\\samples\\Sentry.Samples.Console.Basic\\")] 14 | 15 | // Generated by the MSBuild WriteCodeFragment class. 16 | 17 | -------------------------------------------------------------------------------- /symbolic-testutils/fixtures/macos/crash.dSYM/Contents/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleIdentifier 8 | com.apple.xcode.dsym.crash 9 | CFBundleInfoDictionaryVersion 10 | 6.0 11 | CFBundlePackageType 12 | dSYM 13 | CFBundleSignature 14 | ???? 15 | CFBundleShortVersionString 16 | 1.0 17 | CFBundleVersion 18 | 1 19 | 20 | 21 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [{ 7 | "type": "lldb", 8 | "request": "launch", 9 | "name": "Unreal Engine crash", 10 | "program": "${workspaceFolder}/target/debug/examples/unreal_engine_crash", 11 | "args": [ 12 | "${workspaceFolder}/testutils/fixtures/unreal/unreal_crash" 13 | ], 14 | "env": { 15 | "RUST_BACKTRACE": "1" 16 | }, 17 | "cwd": "${workspaceFolder}", 18 | "preLaunchTask": "cargo build unreal_engine_crash" 19 | }] 20 | } 21 | -------------------------------------------------------------------------------- /symbolic-testutils/fixtures/macos/Example.framework.dSYM/Contents/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleIdentifier 8 | com.apple.xcode.dsym.com.example.Example 9 | CFBundleInfoDictionaryVersion 10 | 6.0 11 | CFBundlePackageType 12 | dSYM 13 | CFBundleSignature 14 | ???? 15 | CFBundleShortVersionString 16 | 1.0 17 | CFBundleVersion 18 | 1 19 | 20 | 21 | -------------------------------------------------------------------------------- /symbolic-sourcemapcache/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "symbolic-sourcemapcache" 3 | version = "12.17.0" 4 | license = "MIT" 5 | authors = ["Sentry "] 6 | documentation = "https://docs.rs/symbolic-sourcemapcache" 7 | homepage = "https://github.com/getsentry/symbolic" 8 | repository = "https://github.com/getsentry/symbolic" 9 | description = """ 10 | A fast lookup cache for JavaScript Source Maps. 11 | """ 12 | edition = "2021" 13 | 14 | [dependencies] 15 | itertools = { workspace = true } 16 | js-source-scopes = { workspace = true } 17 | sourcemap = { workspace = true } 18 | symbolic-common = { version = "12.17.0", path = "../symbolic-common" } 19 | thiserror = { workspace = true } 20 | tracing = { workspace = true } 21 | watto = { workspace = true } 22 | 23 | [dev-dependencies] 24 | symbolic-testutils = { path = "../symbolic-testutils" } 25 | -------------------------------------------------------------------------------- /symbolic-debuginfo/tests/snapshots/test_objects__pe_dwarf_files.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: symbolic-debuginfo/tests/test_objects.rs 3 | expression: "FilesDebug(&files[..10])" 4 | --- 5 | /mxe/tmp-gcc-x86_64-w64-mingw32.static/gcc-11.3.0.build_/mingw-w64-v10.0.0/mingw-w64-crt/crt/crtexe.c 6 | /mxe/tmp-gcc-x86_64-w64-mingw32.static/gcc-11.3.0.build_/mingw-w64-v10.0.0/mingw-w64-crt/crt/crtexe.c 7 | /mxe/usr/x86_64-w64-mingw32.static/include/winnt.h 8 | /mxe/usr/x86_64-w64-mingw32.static/include/psdk_inc/intrin-impl.h 9 | /mxe/usr/x86_64-w64-mingw32.static/include/corecrt.h 10 | /mxe/usr/x86_64-w64-mingw32.static/include/minwindef.h 11 | /mxe/usr/x86_64-w64-mingw32.static/include/basetsd.h 12 | /mxe/usr/x86_64-w64-mingw32.static/include/stdlib.h 13 | /mxe/usr/x86_64-w64-mingw32.static/include/errhandlingapi.h 14 | /mxe/usr/x86_64-w64-mingw32.static/include/processthreadsapi.h 15 | -------------------------------------------------------------------------------- /examples/minidump_stackwalk/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "minidump_stackwalk" 3 | version = "12.17.0" 4 | authors = ["Jan Michael Auer "] 5 | edition = "2021" 6 | publish = false 7 | 8 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 9 | 10 | [dependencies] 11 | async-trait = { workspace = true } 12 | clap = { workspace = true } 13 | minidump = { workspace = true } 14 | minidump-processor = { workspace = true } 15 | minidump-unwind = { workspace = true } 16 | symbolic = { version = "12.17.0", path = "../../symbolic", features = [ 17 | "symcache", 18 | "demangle", 19 | "cfi", 20 | ] } 21 | thiserror = { workspace = true } 22 | tokio = { workspace = true, features = ["macros", "rt"] } 23 | tracing = { workspace = true } 24 | tracing-subscriber = { workspace = true } 25 | walkdir = { workspace = true } 26 | -------------------------------------------------------------------------------- /symbolic-cabi/Makefile: -------------------------------------------------------------------------------- 1 | all: header test release 2 | .PHONY: all 3 | 4 | header: include/symbolic.h 5 | .PHONY: header 6 | 7 | TESTS = $(patsubst c-tests/%.c, %, $(wildcard c-tests/*.c)) 8 | 9 | test: build header $(TESTS:%=test-%) 10 | .PHONY: test 11 | 12 | test-%: target/debug/c-tests/% 13 | LD_LIBRARY_PATH=../target/debug ./$< 14 | 15 | build: 16 | cargo build 17 | .PHONY: build 18 | 19 | release: 20 | cargo build --release 21 | .PHONY: release 22 | 23 | clean: 24 | cargo clean 25 | .PHONY: clean 26 | 27 | include/symbolic.h: *.toml src/*.rs 28 | @touch src/common.rs # Ensure that rustc outputs something 29 | RUSTUP_TOOLCHAIN=nightly cbindgen -c cbindgen.toml . -o $@ 30 | @touch include/symbolic.h # Ensure that we don't build again 31 | 32 | target/debug/c-tests/%: c-tests/%.c include/symbolic.h 33 | @mkdir -p target/debug/c-tests 34 | $(CC) -Iinclude -L../target/debug -lsymbolic_cabi $< -o $@ 35 | -------------------------------------------------------------------------------- /symbolic-cfi/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "symbolic-cfi" 3 | version = "12.17.0" 4 | license = "MIT" 5 | authors = [ 6 | "Armin Ronacher ", 7 | "Jan Michael Auer ", 8 | ] 9 | documentation = "https://docs.rs/symbolic-cfi" 10 | homepage = "https://github.com/getsentry/symbolic" 11 | repository = "https://github.com/getsentry/symbolic" 12 | description = """ 13 | A library to process call frame information 14 | """ 15 | edition.workspace = true 16 | rust-version.workspace = true 17 | 18 | [dependencies] 19 | symbolic-common = { version = "12.17.0", path = "../symbolic-common" } 20 | symbolic-debuginfo = { version = "12.17.0", path = "../symbolic-debuginfo" } 21 | thiserror = { workspace = true } 22 | 23 | [dev-dependencies] 24 | insta = { workspace = true } 25 | similar-asserts = { workspace = true } 26 | symbolic-testutils = { path = "../symbolic-testutils" } 27 | -------------------------------------------------------------------------------- /symbolic-testutils/src/lib.rs: -------------------------------------------------------------------------------- 1 | //! Test helpers for `symbolic`. 2 | #![warn(missing_docs)] 3 | 4 | use std::path::{Path, PathBuf}; 5 | 6 | /// Returns the full path to the specified fixture. 7 | /// 8 | /// Fixtures are stored in the `testutils/fixtures` directory and paths should be given relative to 9 | /// that location. 10 | /// 11 | /// # Example 12 | /// 13 | /// ``` 14 | /// use symbolic_testutils::fixture; 15 | /// 16 | /// let path = fixture("macos/crash"); 17 | /// assert!(path.ends_with("macos/crash")); 18 | /// ``` 19 | pub fn fixture>(path: P) -> PathBuf { 20 | let mut full_path = PathBuf::from(env!("CARGO_MANIFEST_DIR")); 21 | full_path.push("fixtures"); 22 | 23 | let path = path.as_ref(); 24 | full_path.push(path); 25 | 26 | assert!( 27 | full_path.exists(), 28 | "Fixture does not exist: {}", 29 | full_path.display() 30 | ); 31 | 32 | full_path 33 | } 34 | -------------------------------------------------------------------------------- /symbolic-symcache/tests/snapshots/test_cache__lookup.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: symbolic-symcache/tests/test_cache.rs 3 | expression: result 4 | --- 5 | [ 6 | ( 7 | "/Users/travis/build/getsentry/breakpad-tools/macos/main.cpp", 8 | 21, 9 | Function { 10 | name: "_ZN12_GLOBAL__N_15crashEv", 11 | entry_pc: 4294967295, 12 | language: Cpp, 13 | }, 14 | ), 15 | ( 16 | "/Users/travis/build/getsentry/breakpad-tools/macos/main.cpp", 17 | 25, 18 | Function { 19 | name: "_ZN12_GLOBAL__N_15startEv", 20 | entry_pc: 4294967295, 21 | language: Cpp, 22 | }, 23 | ), 24 | ( 25 | "/Users/travis/build/getsentry/breakpad-tools/macos/main.cpp", 26 | 32, 27 | Function { 28 | name: "main", 29 | entry_pc: 56224, 30 | language: Cpp, 31 | }, 32 | ), 33 | ] 34 | -------------------------------------------------------------------------------- /symbolic-testutils/fixtures/sourcemapcache/trace/async.mjs: -------------------------------------------------------------------------------- 1 | import { callsAsyncCallback } from "./shared.mjs"; 2 | 3 | export async function asyncNamedFn() { 4 | await asyncArrowFn(); 5 | } 6 | const asyncArrowFn = async () => { 7 | await AsyncKlass.asyncStaticMethod(); 8 | }; 9 | 10 | class AsyncKlass { 11 | static async asyncStaticMethod() { 12 | let k = new AsyncKlass(); 13 | await k.asyncClassMethod(); 14 | } 15 | async asyncClassMethod() { 16 | await this.#privateAsyncMethod(); 17 | } 18 | async #privateAsyncMethod() { 19 | await this.asyncProtoMethod(); 20 | } 21 | } 22 | 23 | AsyncKlass.prototype.asyncProtoMethod = async function () { 24 | await asyncObj.asyncObjectLiteralMethod(); 25 | }; 26 | 27 | let asyncObj = { 28 | async asyncObjectLiteralMethod() { 29 | await asyncObj.asyncObjectLiteralAnon(); 30 | }, 31 | asyncObjectLiteralAnon: async () => { 32 | throw new Error(); 33 | }, 34 | }; 35 | -------------------------------------------------------------------------------- /symbolic-cabi/src/common.rs: -------------------------------------------------------------------------------- 1 | use symbolic::common::{Arch, UnknownArchError}; 2 | 3 | use crate::core::SymbolicStr; 4 | 5 | ffi_fn! { 6 | /// Checks if an architecture is known. 7 | unsafe fn symbolic_arch_is_known(arch: *const SymbolicStr) -> Result { 8 | Ok((*arch).as_str().parse::().is_ok()) 9 | } 10 | } 11 | 12 | ffi_fn! { 13 | /// Normalizes an architecture name. 14 | unsafe fn symbolic_normalize_arch(arch: *const SymbolicStr) -> Result { 15 | let arch = (*arch).as_str().parse::()?; 16 | Ok(arch.to_string().into()) 17 | } 18 | } 19 | 20 | ffi_fn! { 21 | /// Returns the name of the instruction pointer if known. 22 | unsafe fn symbolic_arch_ip_reg_name(arch: *const SymbolicStr) -> Result { 23 | let arch = (*arch).as_str().parse::()?; 24 | Ok(arch.cpu_family().ip_register_name().ok_or(UnknownArchError)?.into()) 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /symbolic-debuginfo/tests/test_pdb_srcsrv.rs: -------------------------------------------------------------------------------- 1 | use symbolic_common::ByteView; 2 | use symbolic_debuginfo::pdb::PdbObject; 3 | use symbolic_testutils::fixture; 4 | 5 | type Error = Box; 6 | 7 | #[test] 8 | fn test_pdb_srcsrv_vcs_name() -> Result<(), Error> { 9 | let view = ByteView::open(fixture("windows/crash_with_srcsrv.pdb"))?; 10 | let pdb = PdbObject::parse(&view)?; 11 | 12 | // This PDB file contains Perforce SRCSRV information 13 | let vcs_name = pdb.srcsrv_vcs_name(); 14 | assert_eq!(vcs_name, Some("Perforce".to_string())); 15 | 16 | Ok(()) 17 | } 18 | 19 | #[test] 20 | fn test_pdb_without_srcsrv() -> Result<(), Error> { 21 | let view = ByteView::open(fixture("windows/crash.pdb"))?; 22 | let pdb = PdbObject::parse(&view)?; 23 | 24 | // This PDB file does not contain SRCSRV information 25 | let vcs_name = pdb.srcsrv_vcs_name(); 26 | assert_eq!(vcs_name, None); 27 | 28 | Ok(()) 29 | } 30 | -------------------------------------------------------------------------------- /symbolic-cabi/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "symbolic-cabi" 3 | version = "12.17.0" 4 | license = "MIT" 5 | authors = [ 6 | "Armin Ronacher ", 7 | "Jan Michael Auer ", 8 | ] 9 | homepage = "https://github.com/getsentry/symbolic" 10 | repository = "https://github.com/getsentry/symbolic" 11 | description = """ 12 | C interface wrapper for symbolic, a library to symbolicate and process stack 13 | traces from native applications, minidumps, minified JavaScript or ProGuard 14 | optimized Android apps. 15 | """ 16 | edition = "2021" 17 | publish = false 18 | 19 | [lib] 20 | crate-type = ["cdylib"] 21 | 22 | [dependencies] 23 | proguard = { workspace = true, features = ["uuid"] } 24 | sourcemap = { workspace = true } 25 | symbolic = { version = "12.17.0", path = "../symbolic", features = [ 26 | "cfi", 27 | "debuginfo", 28 | "sourcemapcache", 29 | "symcache", 30 | ] } 31 | tempfile = { workspace = true } 32 | -------------------------------------------------------------------------------- /symbolic-demangle/vendor/swift/include/llvm/Support/DataTypes.h: -------------------------------------------------------------------------------- 1 | //===-- llvm/Support/DataTypes.h - Define fixed size types ------*- C++ -*-===// 2 | // 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 | // See https://llvm.org/LICENSE.txt for license information. 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 | // 7 | //===----------------------------------------------------------------------===// 8 | // 9 | // Due to layering constraints (Support depends on llvm-c) this is a thin 10 | // wrapper around the implementation that lives in llvm-c, though most clients 11 | // can/should think of this as being provided by Support for simplicity (not 12 | // many clients are aware of their dependency on llvm-c). 13 | // 14 | //===----------------------------------------------------------------------===// 15 | 16 | #ifndef LLVM_SUPPORT_DATATYPES_H 17 | #define LLVM_SUPPORT_DATATYPES_H 18 | 19 | #include "llvm-c/DataTypes.h" 20 | 21 | #endif // LLVM_SUPPORT_DATATYPES_H 22 | -------------------------------------------------------------------------------- /symbolic-testutils/fixtures/sourcemapcache/inlining/module.js.map: -------------------------------------------------------------------------------- 1 | { 2 | "version": 3, 3 | "file": "module.js", 4 | "sources": [ 5 | "../src/bar.js", 6 | "../src/foo.js", 7 | "../src/app.js" 8 | ], 9 | "sourcesContent": [ 10 | "import foo from './foo';\n\nexport default function bar(msg) {\n foo(msg);\n}\n\n", 11 | "export default function foo(msg) {\n throw new Error(msg);\n}\n", 12 | "import bar from \"./bar\";\n\nconst buttonCallback = () => bar(\"wat\");\n\nwindow.addEventListener(\"load\", () => {\n document.querySelector(\"button\").addEventListener(\"click\", buttonCallback);\n});\n" 13 | ], 14 | "names": [ 15 | "bar", 16 | "msg", 17 | "Error", 18 | "foo", 19 | "buttonCallback", 20 | "window", 21 | "addEventListener", 22 | "document", 23 | "querySelector" 24 | ], 25 | "mappings": "AAEe,SAASA,EAAIC,ICFb,SAAaA,GAC1B,MAAM,IAAIC,MAAMD,EAClB,CDCEE,CAAIF,EACN,CEFA,MAAMG,EAAiB,IAAMJ,EAAI,OAEjCK,OAAOC,iBAAiB,QAAQ,KAC9BC,SAASC,cAAc,UAAUF,iBAAiB,QAASF,EAAe" 26 | } 27 | -------------------------------------------------------------------------------- /symbolic-ppdb/fuzz/fuzz_targets/fuzz_ppdb.rs: -------------------------------------------------------------------------------- 1 | #![no_main] 2 | 3 | // cargo +nightly fuzz run fuzz_ppdb -j 12 -- -max_len=16777216 # 16M 4 | libfuzzer_sys::fuzz_target!(|data| { 5 | if let Ok(ppdb) = symbolic_ppdb::PortablePdb::parse(data) { 6 | let mut writer = symbolic_ppdb::PortablePdbCacheConverter::new(); 7 | if writer.process_portable_pdb(&ppdb).is_ok() { 8 | let mut buf = Vec::new(); 9 | writer.serialize(&mut buf).unwrap(); 10 | 11 | symbolic_ppdb::PortablePdbCache::parse(&buf).unwrap(); 12 | } 13 | } 14 | }); 15 | 16 | // This mutator makes sure we always have a valid file magic. 17 | libfuzzer_sys::fuzz_mutator!( 18 | |data: &mut [u8], size: usize, max_size: usize, _seed: u32| { 19 | let new_size = libfuzzer_sys::fuzzer_mutate(data, size, max_size); 20 | 21 | let magic = 0x424A_5342u32.to_le_bytes(); 22 | let len = magic.len().min(data.len()); 23 | data[..len].copy_from_slice(&magic[..len]); 24 | 25 | new_size 26 | } 27 | ); 28 | -------------------------------------------------------------------------------- /symbolic-demangle/tests/utils/mod.rs: -------------------------------------------------------------------------------- 1 | #[macro_export] 2 | macro_rules! assert_demangle { 3 | ($l:expr, $o:expr, { $($m:expr => $d:expr),* }) => {{ 4 | let mut __failures: Vec = Vec::new(); 5 | 6 | $({ 7 | use symbolic_demangle::Demangle; 8 | 9 | let __mangled = $m; 10 | let __demangled = ::symbolic_common::Name::new(__mangled, ::symbolic_common::NameMangling::Unknown, $l).demangle($o); 11 | let __demangled = __demangled.as_ref().map(String::as_str).unwrap_or(""); 12 | 13 | if __demangled != $d { 14 | __failures.push(format!( 15 | "{}\n expected: {}\n actual: {}", 16 | __mangled, 17 | $d, 18 | __demangled 19 | )); 20 | } 21 | })* 22 | 23 | assert!(__failures.is_empty(), "demangling failed: \n\n{}\n", __failures.join("\n\n")); 24 | }}; 25 | ($l:expr, $o:expr, { $($m:expr => $d:expr,)* }) => { 26 | assert_demangle!($l, $o, { $($m => $d),* }) 27 | }; 28 | } 29 | -------------------------------------------------------------------------------- /symbolic-debuginfo/tests/snapshots/test_objects__pdb_files.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: symbolic-debuginfo/tests/test_objects.rs 3 | expression: "FilesDebug(&files[..10])" 4 | --- 5 | c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.13.26128\include\system_error 6 | c:\program files (x86)\windows kits\10\include\10.0.16299.0\um\processthreadsapi.h 7 | c:\projects\breakpad-tools\deps\breakpad\src\common\scoped_ptr.h 8 | c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.13.26128\include\xcall_once.h 9 | c:\projects\breakpad-tools\deps\breakpad\src\common\windows\string_utils-inl.h 10 | c:\program files (x86)\windows kits\10\include\10.0.16299.0\shared\stralign.h 11 | c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.13.26128\include\cmath 12 | c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.13.26128\include\xstring 13 | c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.13.26128\include\cstdlib 14 | c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.13.26128\include\xmemory0 15 | -------------------------------------------------------------------------------- /symbolic-debuginfo/tests/snapshots/test_objects__breakpad_files.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: symbolic-debuginfo/tests/test_objects.rs 3 | expression: "FilesDebug(&files[..10])" 4 | --- 5 | c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.13.26128\include\system_error 6 | c:\program files (x86)\windows kits\10\include\10.0.16299.0\um\processthreadsapi.h 7 | c:\projects\breakpad-tools\deps\breakpad\src\common\scoped_ptr.h 8 | c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.13.26128\include\xcall_once.h 9 | c:\projects\breakpad-tools\deps\breakpad\src\common\windows\string_utils-inl.h 10 | c:\program files (x86)\windows kits\10\include\10.0.16299.0\shared\stralign.h 11 | c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.13.26128\include\cmath 12 | c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.13.26128\include\xstring 13 | c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.13.26128\include\cstdlib 14 | c:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.13.26128\include\xmemory0 15 | -------------------------------------------------------------------------------- /symbolic-ppdb/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "symbolic-ppdb" 3 | version = "12.17.0" 4 | license = "MIT" 5 | authors = [ 6 | "Sebastian Zivota ", 7 | "Arpad Borsos ", 8 | ] 9 | documentation = "https://docs.rs/symbolic-ppdb" 10 | homepage = "https://github.com/getsentry/symbolic" 11 | repository = "https://github.com/getsentry/symbolic" 12 | description = """ 13 | A library for parsing and performing lookups on Portable PDB files. 14 | """ 15 | edition.workspace = true 16 | rust-version.workspace = true 17 | 18 | exclude = ["tests/**/*"] 19 | 20 | [package.metadata.docs.rs] 21 | all-features = true 22 | 23 | [dependencies] 24 | flate2 = { workspace = true } 25 | indexmap = { workspace = true } 26 | serde = { workspace = true } 27 | serde_json = { workspace = true } 28 | symbolic-common = { version = "12.17.0", path = "../symbolic-common" } 29 | thiserror = { workspace = true } 30 | uuid = { workspace = true } 31 | watto = { workspace = true } 32 | 33 | [dev-dependencies] 34 | symbolic-debuginfo = { path = "../symbolic-debuginfo" } 35 | symbolic-testutils = { path = "../symbolic-testutils" } 36 | -------------------------------------------------------------------------------- /symbolic-demangle/README.md: -------------------------------------------------------------------------------- 1 | [![Build Status](https://travis-ci.org/getsentry/symbolic.svg?branch=master)](https://travis-ci.org/getsentry/symbolic) 2 | 3 | # symbolic-demangle 4 | 5 | Demangling support for various languages and compilers. 6 | 7 | Currently supported languages are: 8 | 9 | - C++ (GCC-style compilers and MSVC) 10 | - Rust (both `legacy` and `v0`) 11 | - Swift (up to Swift 5.2) 12 | - ObjC (only symbol detection) 13 | 14 | As the demangling schemes for the languages are different, the supported demangling features are 15 | inconsistent. For example, argument types were not encoded in legacy Rust mangling and thus not 16 | available in demangled names. 17 | 18 | This module is part of the `symbolic` crate and can be enabled via the `demangle` feature. 19 | 20 | ## Examples 21 | 22 | ```rust 23 | use symbolic::common::{Language, Name}; 24 | use symbolic::demangle::{Demangle, DemangleOptions}; 25 | 26 | let name = Name::new("__ZN3std2io4Read11read_to_end17hb85a0f6802e14499E"); 27 | assert_eq!(name.detect_language(), Language::Rust); 28 | assert_eq!(name.try_demangle(DemangleOptions::default()), "std::io::Read::read_to_end"); 29 | ``` 30 | 31 | License: MIT 32 | -------------------------------------------------------------------------------- /symbolic-ppdb/tests/fixtures/contents/Sentry.Samples.Console.Basic.AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // 5 | // Changes to this file may cause incorrect behavior and will be lost if 6 | // the code is regenerated. 7 | // 8 | //------------------------------------------------------------------------------ 9 | 10 | using System; 11 | using System.Reflection; 12 | 13 | [assembly: System.Reflection.AssemblyCompanyAttribute("Sentry.Samples.Console.Basic")] 14 | [assembly: System.Reflection.AssemblyConfigurationAttribute("release")] 15 | [assembly: System.Reflection.AssemblyFileVersionAttribute("9.8.7.0")] 16 | [assembly: System.Reflection.AssemblyInformationalVersionAttribute("9.8.7")] 17 | [assembly: System.Reflection.AssemblyProductAttribute("Sentry.Samples.Console.Basic")] 18 | [assembly: System.Reflection.AssemblyTitleAttribute("Sentry.Samples.Console.Basic")] 19 | [assembly: System.Reflection.AssemblyVersionAttribute("9.8.7.0")] 20 | 21 | // Generated by the MSBuild WriteCodeFragment class. 22 | 23 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2017 Sentry (https://sentry.io) and individual contributors. 2 | All rights reserved. 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy of 5 | this software and associated documentation files (the "Software"), to deal in 6 | the Software without restriction, including without limitation the rights to 7 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 8 | of the Software, and to permit persons to whom the Software is furnished to do 9 | so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in all 12 | copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | SOFTWARE. 21 | -------------------------------------------------------------------------------- /symbolic-common/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "symbolic-common" 3 | version = "12.17.0" 4 | license = "MIT" 5 | authors = [ 6 | "Armin Ronacher ", 7 | "Jan Michael Auer ", 8 | ] 9 | documentation = "https://docs.rs/symbolic-common" 10 | homepage = "https://github.com/getsentry/symbolic" 11 | repository = "https://github.com/getsentry/symbolic" 12 | readme = "README.md" 13 | description = """ 14 | Common types and utilities for symbolic, a library to symbolicate and process 15 | stack traces from native applications, minidumps or minified JavaScript. 16 | """ 17 | edition.workspace = true 18 | rust-version.workspace = true 19 | 20 | [package.metadata.docs.rs] 21 | all-features = true 22 | 23 | [features] 24 | serde = ["dep:serde", "debugid/serde"] 25 | 26 | [dependencies] 27 | debugid = { workspace = true } 28 | memmap2 = { workspace = true } 29 | stable_deref_trait = { workspace = true } 30 | serde = { workspace = true, optional = true } 31 | uuid = { workspace = true } 32 | 33 | [dev-dependencies] 34 | symbolic-testutils = { path = "../symbolic-testutils" } 35 | tempfile = { workspace = true } 36 | similar-asserts = { workspace = true } 37 | -------------------------------------------------------------------------------- /symbolic-testutils/fixtures/sourcemapcache/old-logs/simple.chrome.log: -------------------------------------------------------------------------------- 1 | # sync stack trace 2 | Error 3 | at Object.objectLiteralAnon (simple.js:28:37) 4 | at Object.objectLiteralMethod (simple.js:27:32) 5 | at globalAssign (simple.js:24:27) 6 | at Klass.prototypeMethod (simple.js:22:28) 7 | at Klass.#privateMethod (simple.js:18:28) 8 | at Klass.classMethod (simple.js:16:39) 9 | at new Klass (simple.js:14:25) 10 | at Function.staticMethod (simple.js:12:28) 11 | at arrowFn (simple.js:9:31) 12 | at anonFn (simple.js:7:29) 13 | at namedFnExpr (simple.js:5:42) 14 | at namedFn (simple.js:3:21) 15 | at simple.js:60:5 16 | 17 | # async stack trace 18 | Error 19 | at Object.asyncObjectLiteralAnon (simple.js:50:48) 20 | at Object.asyncObjectLiteralMethod (simple.js:49:54) 21 | at AsyncKlass.asyncProtoMethod (simple.js:45:74) 22 | at AsyncKlass.#privateAsyncMethod (simple.js:42:45) 23 | at AsyncKlass.asyncClassMethod (simple.js:41:61) 24 | at Function.asyncStaticMethod (simple.js:39:17) 25 | at asyncArrowFn (simple.js:34:52) 26 | at asyncNamedFn (simple.js:33:38) 27 | at asyncMain (simple.js:69:15) 28 | at simple.js:75:1 29 | -------------------------------------------------------------------------------- /.github/workflows/weekly.yml: -------------------------------------------------------------------------------- 1 | name: Weekly CI 2 | 3 | on: 4 | schedule: 5 | - cron: "0 0 * * 1" # every monday at 00:00 6 | workflow_dispatch: 7 | 8 | env: 9 | RUSTFLAGS: -Dwarnings 10 | 11 | jobs: 12 | weekly-ci: 13 | strategy: 14 | fail-fast: false 15 | matrix: 16 | rust: [nightly, beta] 17 | 18 | runs-on: ubuntu-latest 19 | 20 | steps: 21 | - uses: actions/checkout@v3 22 | 23 | - name: Install rust stable toolchain 24 | run: | 25 | rustup toolchain install ${{ matrix.rust }} --profile minimal --component clippy --no-self-update 26 | rustup default ${{ matrix.rust }} 27 | 28 | - run: cargo clippy --all-features --workspace --tests --examples -- -D clippy::all 29 | 30 | - run: cargo test --workspace --all-features --all-targets 31 | - run: cargo test --workspace --all-features --doc 32 | 33 | weekly-audit: 34 | name: Audit 35 | runs-on: ubuntu-latest 36 | 37 | steps: 38 | - uses: actions/checkout@v3 39 | 40 | # FIXME: find a maintained alternative to audit-check 41 | - uses: actions-rs/audit-check@v1 42 | with: 43 | token: ${{ secrets.GITHUB_TOKEN }} 44 | -------------------------------------------------------------------------------- /symbolic-common/README.md: -------------------------------------------------------------------------------- 1 | [![Build Status](https://travis-ci.org/getsentry/symbolic.svg?branch=master)](https://travis-ci.org/getsentry/symbolic) 2 | 3 | # symbolic-common 4 | 5 | Common functionality for `symbolic`. 6 | 7 | This crate exposes a set of key types: 8 | 9 | - [`ByteView`]: Gives access to binary data in-memory or on the file system. 10 | - [`SelfCell`]: Allows to create self-referential types. 11 | - [`Name`]: A symbol name that can be demangled with the `demangle` feature. 12 | - [`InstructionInfo`]: A utility type for instruction pointer heuristics. 13 | - Functions and utilities to deal with paths from different platforms. 14 | 15 | ## Features 16 | 17 | - `serde` (optional): Implements `serde::Deserialize` and `serde::Serialize` for all data types. 18 | In the `symbolic` crate, this feature is exposed via `common-serde`. 19 | 20 | This module is part of the `symbolic` crate. 21 | 22 | [`Name`]: https://docs.rs/symbolic/7/symbolic/common/struct.Name.html 23 | [`ByteView`]: https://docs.rs/symbolic/7/symbolic/common/struct.ByteView.html 24 | [`InstructionInfo`]: https://docs.rs/symbolic/7/symbolic/common/struct.InstructionInfo.html 25 | [`SelfCell`]: https://docs.rs/symbolic/7/symbolic/common/struct.SelfCell.html 26 | 27 | License: MIT 28 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: Release 2 | 3 | on: 4 | workflow_dispatch: 5 | inputs: 6 | version: 7 | description: Version to release 8 | required: true 9 | force: 10 | description: Force a release even when there are release-blockers (optional) 11 | required: false 12 | 13 | jobs: 14 | release: 15 | runs-on: ubuntu-latest 16 | name: "Release a new version" 17 | steps: 18 | - name: Get auth token 19 | id: token 20 | uses: actions/create-github-app-token@5d869da34e18e7287c1daad50e0b8ea0f506ce69 # v1.11.0 21 | with: 22 | app-id: ${{ vars.SENTRY_RELEASE_BOT_CLIENT_ID }} 23 | private-key: ${{ secrets.SENTRY_RELEASE_BOT_PRIVATE_KEY }} 24 | 25 | - uses: actions/checkout@v3 26 | with: 27 | token: ${{ steps.token.outputs.token }} 28 | fetch-depth: 0 29 | 30 | - run: rustup toolchain install stable --profile minimal --no-self-update 31 | 32 | - name: Prepare release 33 | uses: getsentry/action-prepare-release@v1 34 | env: 35 | GITHUB_TOKEN: ${{ steps.token.outputs.token }} 36 | with: 37 | version: ${{ github.event.inputs.version }} 38 | force: ${{ github.event.inputs.force }} 39 | -------------------------------------------------------------------------------- /symbolic-demangle/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "symbolic-demangle" 3 | version = "12.17.0" 4 | license = "MIT" 5 | authors = [ 6 | "Armin Ronacher ", 7 | "Jan Michael Auer ", 8 | ] 9 | documentation = "https://docs.rs/symbolic-demangle" 10 | homepage = "https://github.com/getsentry/symbolic" 11 | repository = "https://github.com/getsentry/symbolic" 12 | readme = "README.md" 13 | description = """ 14 | A library to demangle symbols from various languages and compilers. 15 | """ 16 | build = "build.rs" 17 | edition.workspace = true 18 | rust-version.workspace = true 19 | 20 | exclude = ["tests/**/*"] 21 | 22 | [package.metadata.docs.rs] 23 | all-features = true 24 | 25 | [features] 26 | default = ["cpp", "msvc", "rust", "swift"] 27 | cpp = ["cpp_demangle"] 28 | msvc = ["msvc-demangler"] 29 | rust = ["rustc-demangle"] 30 | swift = ["cc"] 31 | 32 | [dependencies] 33 | cpp_demangle = { workspace = true, optional = true } 34 | msvc-demangler = { workspace = true, optional = true } 35 | rustc-demangle = { workspace = true, optional = true } 36 | symbolic-common = { version = "12.17.0", path = "../symbolic-common" } 37 | 38 | [build-dependencies] 39 | cc = { workspace = true, optional = true } 40 | 41 | [dev-dependencies] 42 | similar-asserts = { workspace = true } 43 | -------------------------------------------------------------------------------- /symbolic-symcache/src/transform/bcsymbolmap.rs: -------------------------------------------------------------------------------- 1 | //! Resolves obfuscated symbols against a BCSymbolMap before writing them to a SymCache. 2 | 3 | use std::borrow::Cow; 4 | 5 | use symbolic_debuginfo::macho::BcSymbolMap; 6 | 7 | use super::{File, Function, SourceLocation, Transformer}; 8 | 9 | fn resolve_cow<'f>(map: &'f BcSymbolMap<'_>, s: Cow<'f, str>) -> Cow<'f, str> { 10 | match s { 11 | Cow::Borrowed(inner) => Cow::Borrowed(map.resolve(inner)), 12 | Cow::Owned(inner) => Cow::Owned(map.resolve(&inner).to_owned()), 13 | } 14 | } 15 | 16 | impl Transformer for BcSymbolMap<'_> { 17 | fn transform_function<'f>(&'f mut self, f: Function<'f>) -> Function<'f> { 18 | Function { 19 | name: resolve_cow(self, f.name), 20 | comp_dir: f.comp_dir.map(|dir| resolve_cow(self, dir)), 21 | } 22 | } 23 | 24 | fn transform_source_location<'f>(&'f mut self, sl: SourceLocation<'f>) -> SourceLocation<'f> { 25 | SourceLocation { 26 | file: File { 27 | name: resolve_cow(self, sl.file.name), 28 | directory: sl.file.directory.map(|dir| resolve_cow(self, dir)), 29 | comp_dir: sl.file.comp_dir.map(|dir| resolve_cow(self, dir)), 30 | }, 31 | line: sl.line, 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /symbolic-cabi/c-tests/object.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "symbolic.h" 6 | 7 | void test_object_open(void) { 8 | printf("[TEST] open archive from path:\n"); 9 | 10 | SymbolicArchive *archive = 11 | symbolic_archive_open("../symbolic-testutils/fixtures/windows/crash.exe"); 12 | assert(archive != 0); 13 | 14 | SymbolicObject *object = symbolic_archive_get_object(archive, 0); 15 | assert(object != 0); 16 | 17 | SymbolicStr code_id = symbolic_object_get_code_id(object); 18 | printf(" code_id: %.*s\n", (int)code_id.len, code_id.data); 19 | 20 | SymbolicStr debug_id = symbolic_object_get_debug_id(object); 21 | printf(" debug_id: %.*s\n", (int)debug_id.len, debug_id.data); 22 | 23 | assert(code_id.len > 0); 24 | assert(strncmp("5ab380779000", code_id.data, code_id.len) == 0); 25 | assert(debug_id.len > 0); 26 | assert(strncmp("3249d99d-0c40-4931-8610-f4e4fb0b6936-1", debug_id.data, 27 | debug_id.len) == 0); 28 | 29 | symbolic_str_free(&code_id); 30 | symbolic_str_free(&debug_id); 31 | symbolic_object_free(object); 32 | symbolic_archive_free(archive); 33 | symbolic_err_clear(); 34 | 35 | printf(" PASS\n\n"); 36 | } 37 | 38 | int main() { 39 | test_object_open(); 40 | 41 | return 0; 42 | } 43 | -------------------------------------------------------------------------------- /symbolic-demangle/build.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | #[cfg(feature = "swift")] 3 | { 4 | cc::Build::new() 5 | .cpp(true) 6 | .std("c++17") 7 | .files(&[ 8 | "src/swiftdemangle.cpp", 9 | "vendor/swift/lib/Demangling/Context.cpp", 10 | "vendor/swift/lib/Demangling/CrashReporter.cpp", 11 | "vendor/swift/lib/Demangling/Demangler.cpp", 12 | "vendor/swift/lib/Demangling/Errors.cpp", 13 | "vendor/swift/lib/Demangling/ManglingUtils.cpp", 14 | "vendor/swift/lib/Demangling/NodeDumper.cpp", 15 | "vendor/swift/lib/Demangling/NodePrinter.cpp", 16 | // "vendor/swift/lib/Demangling/OldDemangler.cpp", 17 | // "vendor/swift/lib/Demangling/OldRemangler.cpp", 18 | "vendor/swift/lib/Demangling/Punycode.cpp", 19 | "vendor/swift/lib/Demangling/Remangler.cpp", 20 | ]) 21 | .flag_if_supported("-fpermissive") 22 | .flag_if_supported("-Wno-changes-meaning") 23 | .flag("-DLLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING=1") 24 | .flag("-DSWIFT_STDLIB_HAS_TYPE_PRINTING=1") 25 | .warnings(false) 26 | .include("vendor/swift/include") 27 | .compile("swiftdemangle"); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /symbolic-unreal/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "symbolic-unreal" 3 | version = "12.17.0" 4 | license = "MIT" 5 | authors = [ 6 | "Armin Ronacher ", 7 | "Jan Michael Auer ", 8 | "Bruno Garcia ", 9 | ] 10 | documentation = "https://docs.rs/symbolic-unreal" 11 | homepage = "https://github.com/getsentry/symbolic" 12 | repository = "https://github.com/getsentry/symbolic" 13 | description = """ 14 | Parsing and processing utilities for Unreal Engine 4 crash files. 15 | """ 16 | edition.workspace = true 17 | rust-version.workspace = true 18 | 19 | exclude = ["tests/**/*"] 20 | 21 | [package.metadata.docs.rs] 22 | all-features = true 23 | 24 | [features] 25 | serde = ["dep:serde", "chrono/serde"] 26 | 27 | [dependencies] 28 | anylog = { workspace = true } 29 | bytes = { workspace = true } 30 | chrono = { workspace = true } 31 | elementtree = { workspace = true } 32 | flate2 = { workspace = true } 33 | lazy_static = { workspace = true } 34 | regex = { workspace = true } 35 | scroll = { workspace = true, features = ["derive"] } 36 | serde = { workspace = true, optional = true } 37 | thiserror = { workspace = true } 38 | time = { workspace = true } 39 | 40 | [dev-dependencies] 41 | insta = { workspace = true } 42 | similar-asserts = { workspace = true } 43 | symbolic-testutils = { path = "../symbolic-testutils" } 44 | -------------------------------------------------------------------------------- /symbolic-common/src/lib.rs: -------------------------------------------------------------------------------- 1 | //! Common functionality for `symbolic`. 2 | //! 3 | //! This crate exposes a set of key types: 4 | //! 5 | //! - [`ByteView`]: Gives access to binary data in-memory or on the file system. 6 | //! - [`SelfCell`]: Allows to create self-referential types. 7 | //! - [`Name`]: A symbol name that can be demangled with the `demangle` feature. 8 | //! - [`InstructionInfo`]: A utility type for instruction pointer heuristics. 9 | //! - Functions and utilities to deal with paths from different platforms. 10 | //! 11 | //! # Features 12 | //! 13 | //! - `serde` (optional): Implements `serde::Deserialize` and `serde::Serialize` for all data types. 14 | //! In the `symbolic` crate, this feature is exposed via `common-serde`. 15 | //! 16 | //! This module is part of the `symbolic` crate. 17 | //! 18 | //! [`Name`]: struct.Name.html 19 | //! [`ByteView`]: struct.ByteView.html 20 | //! [`InstructionInfo`]: struct.InstructionInfo.html 21 | //! [`SelfCell`]: struct.SelfCell.html 22 | 23 | #![warn(missing_docs)] 24 | 25 | mod byteview; 26 | mod cell; 27 | mod heuristics; 28 | mod path; 29 | mod sourcelinks; 30 | mod types; 31 | 32 | pub use crate::byteview::*; 33 | pub use crate::cell::*; 34 | pub use crate::heuristics::*; 35 | pub use crate::path::*; 36 | pub use crate::sourcelinks::*; 37 | pub use crate::types::*; 38 | 39 | pub use debugid::*; 40 | pub use uuid::Uuid; 41 | -------------------------------------------------------------------------------- /symbolic-demangle/vendor/swift/include/swift/ABI/InvertibleProtocols.def: -------------------------------------------------------------------------------- 1 | //===--- InvertibleProtocols.def - invertible protocol meta -*- C++ -*-===// 2 | // 3 | // This source file is part of the Swift.org open source project 4 | // 5 | // Copyright (c) 2014 - 2024 Apple Inc. and the Swift project authors 6 | // Licensed under Apache License v2.0 with Runtime Library Exception 7 | // 8 | // See https://swift.org/LICENSE.txt for license information 9 | // See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors 10 | // 11 | //===----------------------------------------------------------------------===// 12 | // 13 | // This file defines macros used for macro-metaprogramming with ABI-defined 14 | // invertible protocols. 15 | // 16 | // The INVERTIBLE_PROTOCOL(Name, Bit) macro is used to specify each 17 | // each invertible protocol that's conceptually part of the ABI. The 18 | // arguments are: 19 | // Name: The name of the protocol, e.g., Copyable 20 | // Bit: The bit in the set bitset of invertible protocols that is used 21 | // to indicate this. 22 | //===----------------------------------------------------------------------===// 23 | 24 | #ifndef INVERTIBLE_PROTOCOL 25 | # error Must define INVERTIBLE_PROTOCOL macro before including this file 26 | #endif 27 | 28 | INVERTIBLE_PROTOCOL(Copyable, 0) 29 | INVERTIBLE_PROTOCOL(Escapable, 1) 30 | 31 | #undef INVERTIBLE_PROTOCOL 32 | -------------------------------------------------------------------------------- /symbolic-demangle/vendor/swift/lib/Demangling/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(swift_demangling_compile_flags 2 | LLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING=1 3 | SWIFT_SUPPORT_OLD_MANGLING=1 4 | SWIFT_STDLIB_HAS_TYPE_PRINTING=1) 5 | 6 | if(SWIFT_RUNTIME_CRASH_REPORTER_CLIENT) 7 | list(APPEND swift_demangling_compile_flags 8 | "-DSWIFT_HAVE_CRASHREPORTERCLIENT=1") 9 | endif() 10 | 11 | add_swift_host_library(swiftDemangling STATIC 12 | Demangler.cpp 13 | Context.cpp 14 | ManglingUtils.cpp 15 | NodeDumper.cpp 16 | NodePrinter.cpp 17 | OldDemangler.cpp 18 | OldRemangler.cpp 19 | Punycode.cpp 20 | Remangler.cpp 21 | Errors.cpp 22 | CrashReporter.cpp) 23 | target_compile_definitions(swiftDemangling PRIVATE 24 | ${swift_demangling_compile_flags}) 25 | 26 | # NOTE: Runtime libraries that depend on swiftDemangling should define 27 | # SWIFT_INLINE_NAMESPACE to specify the identifier that will be used for an 28 | # inline namespace that will be added around the symbols defined by this 29 | # library. This keeps the demangling symbols in those libraries distinct 30 | # from those in the compiler, which prevents ODR violations in certain 31 | # contexts; for example, on platforms that support statically linking the 32 | # Swift standard library, it allows this to happen safely when the binary 33 | # also links in compiler libraries that may not match exactly with the 34 | # runtime version. 35 | -------------------------------------------------------------------------------- /symbolic-symcache/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "symbolic-symcache" 3 | version = "12.17.0" 4 | license = "MIT" 5 | authors = [ 6 | "Armin Ronacher ", 7 | "Jan Michael Auer ", 8 | ] 9 | documentation = "https://docs.rs/symbolic-symcache" 10 | homepage = "https://github.com/getsentry/symbolic" 11 | repository = "https://github.com/getsentry/symbolic" 12 | description = """ 13 | An optimized cache file for fast and memory efficient lookup of symbols and 14 | stack frames in debugging information. 15 | """ 16 | edition.workspace = true 17 | rust-version.workspace = true 18 | 19 | exclude = ["tests/**/*"] 20 | 21 | [package.metadata.docs.rs] 22 | all-features = true 23 | 24 | [dependencies] 25 | indexmap = { workspace = true } 26 | symbolic-common = { version = "12.17.0", path = "../symbolic-common" } 27 | symbolic-debuginfo = { version = "12.17.0", path = "../symbolic-debuginfo" } 28 | symbolic-il2cpp = { version = "12.17.0", path = "../symbolic-il2cpp", optional = true } 29 | thiserror = { workspace = true } 30 | tracing = { workspace = true } 31 | watto = { workspace = true } 32 | 33 | [dev-dependencies] 34 | criterion = { workspace = true } 35 | insta = { workspace = true } 36 | symbolic-testutils = { path = "../symbolic-testutils" } 37 | 38 | [features] 39 | bench = [] 40 | il2cpp = ["symbolic-il2cpp"] 41 | 42 | [[bench]] 43 | name = "bench_writer" 44 | harness = false 45 | -------------------------------------------------------------------------------- /symbolic-symcache/tests/test_transformers.rs: -------------------------------------------------------------------------------- 1 | use std::io::Cursor; 2 | 3 | use symbolic_common::ByteView; 4 | use symbolic_debuginfo::macho::BcSymbolMap; 5 | use symbolic_debuginfo::Object; 6 | use symbolic_symcache::{SymCache, SymCacheConverter}; 7 | 8 | type Error = Box; 9 | 10 | #[test] 11 | fn test_transformer_symbolmap() -> Result<(), Error> { 12 | let buffer = ByteView::open( 13 | "../symbolic-debuginfo/tests/fixtures/2d10c42f-591d-3265-b147-78ba0868073f.dwarf-hidden", 14 | )?; 15 | let object = Object::parse(&buffer)?; 16 | 17 | let map_buffer = ByteView::open( 18 | "../symbolic-debuginfo/tests/fixtures/c8374b6d-6e96-34d8-ae38-efaa5fec424f.bcsymbolmap", 19 | )?; 20 | let bc_symbol_map = BcSymbolMap::parse(&map_buffer)?; 21 | 22 | let mut converter = SymCacheConverter::new(); 23 | converter.add_transformer(bc_symbol_map); 24 | converter.process_object(&object)?; 25 | let mut buffer = Vec::new(); 26 | converter.serialize(&mut Cursor::new(&mut buffer))?; 27 | 28 | let cache = SymCache::parse(&buffer)?; 29 | 30 | let sl = cache.lookup(0x5a74).next().unwrap(); 31 | 32 | assert_eq!(sl.function().name(), "-[SentryMessage initWithFormatted:]"); 33 | assert_eq!( 34 | sl.file().unwrap().full_path(), 35 | "/Users/philipphofmann/git-repos/sentry-cocoa/Sources/Sentry/SentryMessage.m" 36 | ); 37 | 38 | Ok(()) 39 | } 40 | -------------------------------------------------------------------------------- /symbolic-demangle/src/swiftdemangle.cpp: -------------------------------------------------------------------------------- 1 | #include "swift/Demangling/Demangle.h" 2 | 3 | #define SYMBOLIC_SWIFT_FEATURE_RETURN_TYPE 0x1 4 | #define SYMBOLIC_SWIFT_FEATURE_PARAMETERS 0x2 5 | #define SYMBOLIC_SWIFT_FEATURE_ALL 0x3 6 | 7 | extern "C" int symbolic_demangle_swift(const char *symbol, 8 | char *buffer, 9 | size_t buffer_length, 10 | int features) { 11 | swift::Demangle::DemangleOptions opts; 12 | 13 | if (features < SYMBOLIC_SWIFT_FEATURE_ALL) { 14 | opts = swift::Demangle::DemangleOptions::SimplifiedUIDemangleOptions(); 15 | bool return_type = features & SYMBOLIC_SWIFT_FEATURE_RETURN_TYPE; 16 | bool argument_types = features & SYMBOLIC_SWIFT_FEATURE_PARAMETERS; 17 | 18 | opts.ShowFunctionReturnType = return_type; 19 | opts.ShowFunctionArgumentTypes = argument_types; 20 | } 21 | 22 | std::string demangled = 23 | swift::Demangle::demangleSymbolAsString(llvm::StringRef(symbol), opts); 24 | 25 | if (demangled.size() == 0 || demangled.size() >= buffer_length) { 26 | return false; 27 | } 28 | 29 | memcpy(buffer, demangled.c_str(), demangled.size()); 30 | buffer[demangled.size()] = '\0'; 31 | return true; 32 | } 33 | 34 | extern "C" int symbolic_demangle_is_swift_symbol(const char *symbol) { 35 | return swift::Demangle::isSwiftSymbol(symbol); 36 | } 37 | -------------------------------------------------------------------------------- /symbolic-debuginfo/tests/snapshots/test_objects__breakpad_symbols.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: symbolic-debuginfo/tests/test_objects.rs 3 | expression: SymbolsDebug(&symbols) 4 | --- 5 | 3726 __CxxFrameHandler3 6 | 372c __std_exception_copy 7 | 3732 __std_exception_destroy 8 | 3738 _CxxThrowException 9 | 373e memset 10 | 3744 _except_handler4_common 11 | 374a exit 12 | 3750 _callnewh 13 | 3756 malloc 14 | 375c _seh_filter_exe 15 | 3762 _set_app_type 16 | 3768 __setusermatherr 17 | 376e _configure_narrow_argv 18 | 3774 _initialize_narrow_environment 19 | 377a _get_initial_narrow_environment 20 | 3780 _initterm 21 | 3786 _initterm_e 22 | 378c _exit 23 | 3792 _set_fmode 24 | 3798 __p___argc 25 | 379e __p___argv 26 | 37a4 _cexit 27 | 37aa _c_exit 28 | 37b0 _register_thread_local_exe_atexit_callback 29 | 37b6 _configthreadlocale 30 | 37bc _set_new_mode 31 | 37c2 __p__commode 32 | 37c8 free 33 | 37ce _initialize_onexit_table 34 | 37d4 _register_onexit_function 35 | 37da _crt_atexit 36 | 37e0 _controlfp_s 37 | 37e6 terminate 38 | 37ec IsProcessorFeaturePresent 39 | 37f2 memcpy 40 | -------------------------------------------------------------------------------- /symbolic-demangle/vendor/swift/include/swift/Demangling/NamespaceMacros.h: -------------------------------------------------------------------------------- 1 | //===--- NamespaceMacros.h - Macros for inline namespaces -------*- C++ -*-===// 2 | // 3 | // This source file is part of the Swift.org open source project 4 | // 5 | // Copyright (c) 2014 - 2020 Apple Inc. and the Swift project authors 6 | // Licensed under Apache License v2.0 with Runtime Library Exception 7 | // 8 | // See https://swift.org/LICENSE.txt for license information 9 | // See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors 10 | // 11 | //===----------------------------------------------------------------------===// 12 | // 13 | // Macros that conditionally define an inline namespace so that symbols used in 14 | // multiple places (such as in the compiler and in the runtime library) can be 15 | // given distinct mangled names in different contexts without affecting client 16 | // usage in source. 17 | // 18 | //===----------------------------------------------------------------------===// 19 | 20 | #ifndef SWIFT_DEMANGLING_NAMESPACE_MACROS_H 21 | #define SWIFT_DEMANGLING_NAMESPACE_MACROS_H 22 | 23 | #if defined(__cplusplus) 24 | 25 | #if defined(SWIFT_INLINE_NAMESPACE) 26 | #define SWIFT_BEGIN_INLINE_NAMESPACE inline namespace SWIFT_INLINE_NAMESPACE { 27 | #define SWIFT_END_INLINE_NAMESPACE } 28 | #else 29 | #define SWIFT_BEGIN_INLINE_NAMESPACE 30 | #define SWIFT_END_INLINE_NAMESPACE 31 | #endif 32 | 33 | #endif 34 | 35 | #endif // SWIFT_DEMANGLING_NAMESPACE_MACROS_H 36 | -------------------------------------------------------------------------------- /symbolic-demangle/vendor/swift/lib/Demangling/CrashReporter.cpp: -------------------------------------------------------------------------------- 1 | //===--- CrashReporter.cpp - Crash Reporter integration ---------*- C++ -*-===// 2 | // 3 | // This source file is part of the Swift.org open source project 4 | // 5 | // Copyright (c) 2022 Apple Inc. and the Swift project authors 6 | // Licensed under Apache License v2.0 with Runtime Library Exception 7 | // 8 | // See https://swift.org/LICENSE.txt for license information 9 | // See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors 10 | // 11 | //===----------------------------------------------------------------------===// 12 | // 13 | // Declares gCRAnnotations. This lets us link with other static libraries 14 | // that also declare gCRAnnotations, because we'll pull in their copy 15 | // (assuming they're linked first). 16 | // 17 | //===----------------------------------------------------------------------===// 18 | 19 | #include "CrashReporter.h" 20 | 21 | #if SWIFT_HAVE_CRASHREPORTERCLIENT 22 | 23 | // Instead of linking to CrashReporterClient.a (because it complicates the 24 | // build system), define the only symbol from that static archive ourselves. 25 | // 26 | // The layout of this struct is CrashReporter ABI, so there are no ABI concerns 27 | // here. 28 | extern "C" { 29 | SWIFT_LIBRARY_VISIBILITY 30 | struct crashreporter_annotations_t gCRAnnotations __attribute__(( 31 | __section__("__DATA," CRASHREPORTER_ANNOTATIONS_SECTION))) = { 32 | CRASHREPORTER_ANNOTATIONS_VERSION, 0, 0, 0, 0, 0, 0, 0}; 33 | } 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /symbolic-symcache/src/transform/il2cpp.rs: -------------------------------------------------------------------------------- 1 | //! Resolves IL2CPP-compiled native symbols into their managed equivalents using a mapping file 2 | //! before writing them to a SymCache. 3 | 4 | use symbolic_il2cpp::LineMapping; 5 | 6 | use super::{File, Function, SourceLocation, Transformer}; 7 | 8 | fn full_path(file: &File<'_>) -> String { 9 | let comp_dir = file.comp_dir.as_deref().unwrap_or_default(); 10 | let directory = file.directory.as_deref().unwrap_or_default(); 11 | let path_name = &file.name; 12 | 13 | let prefix = symbolic_common::join_path(comp_dir, directory); 14 | let full_path = symbolic_common::join_path(&prefix, path_name); 15 | symbolic_common::clean_path(&full_path).into_owned() 16 | } 17 | 18 | impl Transformer for LineMapping { 19 | fn transform_function<'f>(&'f mut self, f: Function<'f>) -> Function<'f> { 20 | f 21 | } 22 | 23 | fn transform_source_location<'f>( 24 | &'f mut self, 25 | mut sl: SourceLocation<'f>, 26 | ) -> SourceLocation<'f> { 27 | // TODO: this allocates, which is especially expensive since we run this transformer for 28 | // every single source location (without dedupe-ing files). It might be worth caching this 29 | let full_path = full_path(&sl.file); 30 | if let Some((mapped_file, mapped_line)) = self.lookup(&full_path, sl.line) { 31 | sl.file.name = mapped_file.into(); 32 | sl.file.comp_dir = None; 33 | sl.file.directory = None; 34 | sl.line = mapped_line; 35 | } 36 | 37 | sl 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /examples/dump_cfi/src/main.rs: -------------------------------------------------------------------------------- 1 | use std::path::{Path, PathBuf}; 2 | 3 | use anyhow::Result; 4 | use clap::{value_parser, Arg, ArgMatches, Command}; 5 | 6 | use symbolic::cfi::AsciiCfiWriter; 7 | use symbolic::common::{ByteView, DSymPathExt}; 8 | use symbolic::debuginfo::Object; 9 | 10 | fn dump_cfi>(path: P) -> Result<()> { 11 | let path = path.as_ref(); 12 | 13 | let dsym_path = path.resolve_dsym(); 14 | let buffer = ByteView::open(dsym_path.as_deref().unwrap_or(path))?; 15 | let object = Object::parse(&buffer)?; 16 | 17 | println!( 18 | "MODULE unknown {} {} {}", 19 | object.arch(), 20 | object.debug_id().breakpad(), 21 | path.file_name() 22 | .map(|s| s.to_string_lossy()) 23 | .unwrap_or_default(), 24 | ); 25 | 26 | AsciiCfiWriter::new(std::io::stdout()).process(&object)?; 27 | 28 | Ok(()) 29 | } 30 | 31 | fn execute(matches: &ArgMatches) -> Result<()> { 32 | let path = matches.get_one::("path").unwrap(); 33 | dump_cfi(path) 34 | } 35 | 36 | fn main() { 37 | let matches = Command::new("dump_cfi") 38 | .about("Prints CFI in Breakpad format") 39 | .arg( 40 | Arg::new("path") 41 | .required(true) 42 | .value_name("PATH") 43 | .help("Path to the debug file") 44 | .number_of_values(1) 45 | .value_parser(value_parser!(PathBuf)) 46 | .index(1), 47 | ) 48 | .get_matches(); 49 | 50 | match execute(&matches) { 51 | Ok(()) => (), 52 | Err(e) => eprintln!("{e:?}"), 53 | }; 54 | } 55 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | // Formatting 3 | "editor.formatOnPaste": true, 4 | "editor.formatOnSave": true, 5 | "editor.formatOnType": true, 6 | "editor.tabSize": 4, 7 | "editor.rulers": [100], 8 | "files.autoSave": "afterDelay", 9 | "files.trimTrailingWhitespace": true, 10 | "files.insertFinalNewline": true, 11 | 12 | // Rust configuration 13 | "rust-client.channel": "stable", 14 | "rust.clippy_preference": "on", 15 | "rust.cfg_test": true, 16 | "rust.rustfmt_path": "rustfmt", 17 | "rust-client.rlsPath": "rls", 18 | 19 | // Python configuration 20 | "python.pythonPath": ".venv/bin/python", 21 | "python.linting.enabled": false, 22 | "python.formatting.provider": "black", 23 | 24 | // Created by CPP Extension 25 | "files.associations": { 26 | "stack": "cpp", 27 | "memory": "cpp", 28 | "list": "cpp", 29 | "__locale": "cpp", 30 | "__bit_reference": "cpp", 31 | "__functional_base": "cpp", 32 | "atomic": "cpp", 33 | "bitset": "cpp", 34 | "chrono": "cpp", 35 | "deque": "cpp", 36 | "functional": "cpp", 37 | "iterator": "cpp", 38 | "limits": "cpp", 39 | "locale": "cpp", 40 | "ratio": "cpp", 41 | "system_error": "cpp", 42 | "tuple": "cpp", 43 | "type_traits": "cpp", 44 | "vector": "cpp", 45 | "utility": "cpp", 46 | "string": "cpp", 47 | "__config": "cpp", 48 | "__nullptr": "cpp", 49 | "cstddef": "cpp", 50 | "exception": "cpp", 51 | "initializer_list": "cpp", 52 | "stdexcept": "cpp", 53 | "typeinfo": "cpp", 54 | "algorithm": "cpp" 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /symbolic-demangle/vendor/swift/include/swift/Demangling/ValueWitnessMangling.def: -------------------------------------------------------------------------------- 1 | //===-- ValueWitnessMangling.def - VW Mangling Metaprogramming --*- C++ -*-===// 2 | // 3 | // This source file is part of the Swift.org open source project 4 | // 5 | // Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors 6 | // Licensed under Apache License v2.0 with Runtime Library Exception 7 | // 8 | // See https://swift.org/LICENSE.txt for license information 9 | // See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors 10 | // 11 | //===----------------------------------------------------------------------===// 12 | 13 | /// VALUE_WITNESS(MANGLING, NAME) 14 | /// The 2-character MANGLING for a value witness NAME. 15 | 16 | VALUE_WITNESS(al, AllocateBuffer) 17 | VALUE_WITNESS(ca, AssignWithCopy) 18 | VALUE_WITNESS(ta, AssignWithTake) 19 | VALUE_WITNESS(de, DeallocateBuffer) 20 | VALUE_WITNESS(xx, Destroy) 21 | VALUE_WITNESS(XX, DestroyBuffer) 22 | VALUE_WITNESS(Xx, DestroyArray) 23 | VALUE_WITNESS(CP, InitializeBufferWithCopyOfBuffer) 24 | VALUE_WITNESS(Cp, InitializeBufferWithCopy) 25 | VALUE_WITNESS(cp, InitializeWithCopy) 26 | VALUE_WITNESS(Tk, InitializeBufferWithTake) 27 | VALUE_WITNESS(tk, InitializeWithTake) 28 | VALUE_WITNESS(pr, ProjectBuffer) 29 | VALUE_WITNESS(TK, InitializeBufferWithTakeOfBuffer) 30 | VALUE_WITNESS(Cc, InitializeArrayWithCopy) 31 | VALUE_WITNESS(Tt, InitializeArrayWithTakeFrontToBack) 32 | VALUE_WITNESS(tT, InitializeArrayWithTakeBackToFront) 33 | VALUE_WITNESS(xs, StoreExtraInhabitant) 34 | VALUE_WITNESS(xg, GetExtraInhabitantIndex) 35 | VALUE_WITNESS(ug, GetEnumTag) 36 | VALUE_WITNESS(up, DestructiveProjectEnumData) 37 | VALUE_WITNESS(ui, DestructiveInjectEnumTag) 38 | VALUE_WITNESS(et, GetEnumTagSinglePayload) 39 | VALUE_WITNESS(st, StoreEnumTagSinglePayload) 40 | 41 | #undef VALUE_WITNESS 42 | -------------------------------------------------------------------------------- /symbolic-testutils/fixtures/sourcemapcache/webpack/bundle.js.map: -------------------------------------------------------------------------------- 1 | { 2 | "version": 3, 3 | "file": "bundle.js", 4 | "mappings": "qBAAAA,EAAOC,QAAU,SAAaC,GAC5BA,M,QCDFF,EAAOC,QAAU,WACf,MAAM,IAAIE,MAAM,UCAdC,EAA2B,GAG/B,SAASC,EAAoBC,GAE5B,IAAIC,EAAeH,EAAyBE,GAC5C,QAAqBE,IAAjBD,EACH,OAAOA,EAAaN,QAGrB,IAAID,EAASI,EAAyBE,GAAY,CAGjDL,QAAS,IAOV,OAHAQ,EAAoBH,GAAUN,EAAQA,EAAOC,QAASI,GAG/CL,EAAOC,Q,MCrBf,MAAMS,EAAM,EAAQ,KACR,EAAQ,IAGlBC,CAGED,I", 5 | "sources": [ 6 | "webpack:///./bar.js", 7 | "webpack:///./foo.js", 8 | "webpack:///webpack/bootstrap", 9 | "webpack:///./app.js" 10 | ], 11 | "sourcesContent": [ 12 | "module.exports = function bar(f) {\n f();\n};\n", 13 | "module.exports = function foo () {\n throw new Error(\"wat\");\n};\n", 14 | "// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n", 15 | "const foo = require(\"./foo\");\nconst bar = require(\"./bar\");\n\nfunction baz(f) {\n bar(f);\n}\n\nbaz(foo);\n" 16 | ], 17 | "names": [ 18 | "module", 19 | "exports", 20 | "f", 21 | "Error", 22 | "__webpack_module_cache__", 23 | "__webpack_require__", 24 | "moduleId", 25 | "cachedModule", 26 | "undefined", 27 | "__webpack_modules__", 28 | "foo", 29 | "bar" 30 | ], 31 | "sourceRoot": "" 32 | } 33 | -------------------------------------------------------------------------------- /symbolic-cabi/c-tests/common.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "symbolic.h" 6 | 7 | void test_arch_is_known(void) { 8 | printf("[TEST] arch_is_known:\n"); 9 | 10 | SymbolicStr arch1 = symbolic_str_from_cstr("x86"); 11 | bool is_known1 = symbolic_arch_is_known(&arch1); 12 | assert(symbolic_err_get_last_code() == SYMBOLIC_ERROR_CODE_NO_ERROR); 13 | printf(" 'x86' is known: %s\n", is_known1 ? "true" : "false"); 14 | 15 | SymbolicStr arch2 = symbolic_str_from_cstr("amd64"); 16 | bool is_known2 = symbolic_arch_is_known(&arch2); 17 | assert(symbolic_err_get_last_code() == SYMBOLIC_ERROR_CODE_NO_ERROR); 18 | printf(" 'amd64' is known: %s\n", is_known2 ? "true" : "false"); 19 | 20 | SymbolicStr arch3 = symbolic_str_from_cstr("foo"); 21 | bool is_known3 = symbolic_arch_is_known(&arch3); 22 | assert(symbolic_err_get_last_code() == SYMBOLIC_ERROR_CODE_NO_ERROR); 23 | printf(" 'foo' is known: %s\n", is_known3 ? "true" : "false"); 24 | 25 | assert(is_known1); 26 | assert(is_known2); 27 | assert(!is_known3); 28 | 29 | symbolic_err_clear(); 30 | printf(" PASS\n\n"); 31 | } 32 | 33 | void test_normalize_arch(void) { 34 | printf("[TEST] normalize arch success case:\n"); 35 | SymbolicStr arch = symbolic_str_from_cstr("amd64"); 36 | SymbolicStr normalized = symbolic_normalize_arch(&arch); 37 | assert(symbolic_err_get_last_code() == SYMBOLIC_ERROR_CODE_NO_ERROR); 38 | 39 | printf(" arch: %.*s\n", (int)arch.len, arch.data); 40 | printf(" normalized: %.*s\n", (int)normalized.len, normalized.data); 41 | 42 | assert(strncmp("x86_64", normalized.data, normalized.len) == 0); 43 | 44 | symbolic_err_clear(); 45 | printf(" PASS\n\n"); 46 | } 47 | 48 | int main() { 49 | test_arch_is_known(); 50 | test_normalize_arch(); 51 | 52 | return 0; 53 | } 54 | -------------------------------------------------------------------------------- /symbolic-testutils/fixtures/sourcemapcache/trace/sync.mjs: -------------------------------------------------------------------------------- 1 | import { callsSyncCallback } from "./shared.mjs"; 2 | 3 | export function namedFn() { 4 | beepBoop(); 5 | } 6 | 7 | const beepBoop = function namedFnExpr() { 8 | anonFn(); 9 | }; 10 | 11 | const anonFn = function () { 12 | arrowFn(); 13 | }; 14 | 15 | const arrowFn = () => { 16 | function namedDeclaredCallback() { 17 | callsSyncCallback(function namedImmediateCallback() { 18 | // anonymous fn callback 19 | callsSyncCallback(function () { 20 | // anonymous arrow callback 21 | callsSyncCallback(() => { 22 | Klass.staticMethod(); 23 | }); 24 | }); 25 | }); 26 | } 27 | callsSyncCallback(namedDeclaredCallback); 28 | }; 29 | 30 | class BaseKlass { 31 | constructor() { 32 | this.classMethod(); 33 | } 34 | 35 | classCallbackArrow() { 36 | this.#privateMethod(); 37 | } 38 | 39 | #privateMethod() { 40 | this.prototypeMethod(); 41 | } 42 | } 43 | 44 | class Klass extends BaseKlass { 45 | static staticMethod() { 46 | new Klass(); 47 | } 48 | 49 | constructor() { 50 | super(); 51 | } 52 | 53 | classMethod() { 54 | let self = this; 55 | callsSyncCallback(function () { 56 | self.classCallbackSelf(); 57 | }); 58 | } 59 | 60 | classCallbackSelf() { 61 | callsSyncCallback(this.classCallbackBound.bind(this)); 62 | } 63 | 64 | classCallbackBound() { 65 | callsSyncCallback(() => this.classCallbackArrow()); 66 | } 67 | } 68 | 69 | // prettier-ignore 70 | Klass/*foo*/. prototype // comment 71 | . prototypeMethod = () => {localReassign();}; 72 | 73 | let localReassign; 74 | 75 | localReassign = () => { 76 | obj.objectLiteralMethod(); 77 | }; 78 | 79 | let obj = { 80 | objectLiteralMethod() { 81 | obj.objectLiteralAnon(); 82 | }, 83 | objectLiteralAnon: () => { 84 | throw new Error(); 85 | }, 86 | }; 87 | -------------------------------------------------------------------------------- /symbolic-demangle/tests/test_msvc.rs: -------------------------------------------------------------------------------- 1 | //! MSVC C++ Demangling Tests 2 | //! We use msvc_demangler under the hood which runs its own test suite. 3 | //! Tests here make it easier to detect regressions. 4 | 5 | #![cfg(feature = "msvc")] 6 | 7 | #[macro_use] 8 | mod utils; 9 | 10 | use symbolic_common::Language; 11 | use symbolic_demangle::DemangleOptions; 12 | 13 | #[test] 14 | fn test_msvc_demangle_without_args() { 15 | assert_demangle!(Language::Cpp, DemangleOptions::name_only(), { 16 | // These symbols were extracted from electron.exe.pdb 17 | // https://github.com/electron/electron/releases/download/v2.0.11/electron-v2.0.11-win32-x64-pdb.zip 18 | "??3@YAXPEAX@Z" => "operator delete", 19 | "?LoadV8Snapshot@V8Initializer@gin@@SAXXZ" => "gin::V8Initializer::LoadV8Snapshot", 20 | "??9@YA_NAEBVGURL@@0@Z" => "operator!=", 21 | "??_GAtomSandboxedRenderFrameObserver@?A0x77c58568@atom@@UEAAPEAXI@Z" => "atom::`anonymous namespace'::AtomSandboxedRenderFrameObserver::`scalar deleting destructor'", 22 | }) 23 | } 24 | 25 | #[test] 26 | fn test_msvc_demangle_full() { 27 | assert_demangle!(Language::Cpp, DemangleOptions::name_only().parameters(true), { 28 | // These symbols were extracted from electron.exe.pdb 29 | // https://github.com/electron/electron/releases/download/v2.0.11/electron-v2.0.11-win32-x64-pdb.zip 30 | "??3@YAXPEAX@Z" => "operator delete(void*)", 31 | "?LoadV8Snapshot@V8Initializer@gin@@SAXXZ" => "gin::V8Initializer::LoadV8Snapshot(void)", 32 | "??9@YA_NAEBVGURL@@0@Z" => "operator!=(GURL const&, GURL const&)", 33 | "??_GAtomSandboxedRenderFrameObserver@?A0x77c58568@atom@@UEAAPEAXI@Z" => "atom::`anonymous namespace'::AtomSandboxedRenderFrameObserver::`scalar deleting destructor'(unsigned int)", 34 | }) 35 | } 36 | 37 | // NOTE: msvc_demangler cannot demangle without qualifiers and argument lists yet. 38 | -------------------------------------------------------------------------------- /symbolic-demangle/vendor/swift/lib/Demangling/CrashReporter.h: -------------------------------------------------------------------------------- 1 | //===--- CrashReporter.h - Crash Reporter integration -----------*- C++ -*-===// 2 | // 3 | // This source file is part of the Swift.org open source project 4 | // 5 | // Copyright (c) 2022 Apple Inc. and the Swift project authors 6 | // Licensed under Apache License v2.0 with Runtime Library Exception 7 | // 8 | // See https://swift.org/LICENSE.txt for license information 9 | // See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors 10 | // 11 | //===----------------------------------------------------------------------===// 12 | // 13 | // Declares gCRAnnotations. This lets us link with other static libraries 14 | // that also declare gCRAnnotations, because we'll pull in their copy 15 | // (assuming they're linked first). 16 | // 17 | //===----------------------------------------------------------------------===// 18 | 19 | #ifndef SWIFT_DEMANGLING_CRASHREPORTER_H 20 | #define SWIFT_DEMANGLING_CRASHREPORTER_H 21 | 22 | #if SWIFT_HAVE_CRASHREPORTERCLIENT 23 | 24 | // For SWIFT_LIBRARY_VISIBILITY 25 | #include "swift/shims/Visibility.h" 26 | 27 | #include 28 | 29 | #define CRASHREPORTER_ANNOTATIONS_VERSION 5 30 | #define CRASHREPORTER_ANNOTATIONS_SECTION "__crash_info" 31 | 32 | struct crashreporter_annotations_t { 33 | uint64_t version; // unsigned long 34 | uint64_t message; // char * 35 | uint64_t signature_string; // char * 36 | uint64_t backtrace; // char * 37 | uint64_t message2; // char * 38 | uint64_t thread; // uint64_t 39 | uint64_t dialog_mode; // unsigned int 40 | uint64_t abort_cause; // unsigned int 41 | }; 42 | 43 | extern "C" { 44 | SWIFT_LIBRARY_VISIBILITY 45 | extern struct crashreporter_annotations_t gCRAnnotations; 46 | } 47 | 48 | #endif // SWIFT_HAVE_CRASHREPORTERCLIENT 49 | 50 | #endif // SWIFT_DEMANGLING_CRASHREPORTER_H 51 | -------------------------------------------------------------------------------- /symbolic-testutils/fixtures/linux/elf_debuglink/generate_elf_debug_link.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # This script was used to generate the fixtures in the "gen" directory, used to test the 4 | # `ElfObject::debug_link` method. 5 | 6 | # Pre-requisites: 7 | # 8 | # - gcc 9 | # - eu-elfcompress (elfutils) 10 | # - objcopy (GNU Binary Utilities) 11 | # - crc32 (perl-archive-zip) 12 | 13 | OUTPUT=gen 14 | 15 | # 0. Clean and remake output directory, switch to it 16 | rm -rf $OUTPUT 17 | mkdir -p $OUTPUT 18 | cd $OUTPUT 19 | 20 | # 1. compile our C example. To keep size low, let's compile the simplest program we can write. 21 | gcc -x c -Os -o elf_without_debuglink - << EOF 22 | int main() { 23 | return 0; 24 | } 25 | EOF 26 | 27 | # 2. generate some fake debug file. objcopy doesn't require the file to be a proper debug file, 28 | # only that it exists (to compute its CRC and embed it in the section). 29 | # Let's use a simple text file. 30 | echo "Fake debug info" > debug_info.txt 31 | 32 | # 3. compute the expected CRC for debug_info.txt. 33 | # This will be used in tests to check we find the correct CRC. 34 | crc32 debug_info.txt > debug_info.txt.crc 35 | 36 | # 4. Add the debug info to a copy of our binary 37 | objcopy --add-gnu-debuglink=debug_info.txt elf_{without,with}_debuglink 38 | 39 | # 5. To test for the various possible paddings, also add debug info 40 | # with different-sized filenames 41 | cp debug_info{,1}.txt && objcopy --add-gnu-debuglink=debug_info1.txt elf_{without,with1}_debuglink 42 | cp debug_info{,12}.txt && objcopy --add-gnu-debuglink=debug_info12.txt elf_{without,with12}_debuglink 43 | cp debug_info{,123}.txt && objcopy --add-gnu-debuglink=debug_info123.txt elf_{without,with123}_debuglink 44 | 45 | # 6. To test the "Owned" case, let's make a copy of the ELF with a compressed section 46 | eu-elfcompress -v --force --name ".gnu_debuglink" -t zlib -o elf_with{_compressed,}_debuglink 47 | 48 | # 7. Remove debug info files that aren't actually needed by the tests 49 | rm *.txt 50 | -------------------------------------------------------------------------------- /symbolic-demangle/tests/test_objcpp.rs: -------------------------------------------------------------------------------- 1 | //! Objective C++ Demangling Tests 2 | //! Objective C++ code can contain both C++ and Objective C symbols. If the 3 | //! language is passed explicitly, the correct demangler must be chosen. 4 | 5 | #[macro_use] 6 | mod utils; 7 | 8 | use symbolic_common::{Language, Name, NameMangling}; 9 | use symbolic_demangle::{Demangle, DemangleOptions}; 10 | 11 | use similar_asserts::assert_eq; 12 | 13 | #[test] 14 | #[cfg(feature = "cpp")] 15 | fn test_demangle_objcpp() { 16 | assert_demangle!(Language::ObjCpp, DemangleOptions::name_only().parameters(true), { 17 | "+[Foo bar:blub:]" => "+[Foo bar:blub:]", 18 | "_ZN4base24MessagePumpNSApplication5DoRunEPNS_11MessagePump8DelegateE" => "base::MessagePumpNSApplication::DoRun(base::MessagePump::Delegate*)", 19 | "_ZL29SupportsTextureSampleCountMTLPU19objcproto9MTLDevice11objc_objectm" => "SupportsTextureSampleCountMTL(objc_object objcproto9MTLDevice*, unsigned long)", 20 | "_ZL19StringContainsEmojiP8NSString" => "StringContainsEmoji(NSString*)", 21 | }); 22 | } 23 | 24 | #[test] 25 | #[cfg(feature = "cpp")] 26 | fn test_demangle_objcpp_no_args() { 27 | assert_demangle!(Language::ObjCpp, DemangleOptions::name_only(), { 28 | "+[Foo bar:blub:]" => "+[Foo bar:blub:]", 29 | "_ZN4base24MessagePumpNSApplication5DoRunEPNS_11MessagePump8DelegateE" => "base::MessagePumpNSApplication::DoRun", 30 | "_ZL29SupportsTextureSampleCountMTLPU19objcproto9MTLDevice11objc_objectm" => "SupportsTextureSampleCountMTL", 31 | "_ZL19StringContainsEmojiP8NSString" => "StringContainsEmoji", 32 | }); 33 | } 34 | 35 | #[test] 36 | fn invalid() { 37 | // If Objective C++ is specified explicitly, the demangler should not fall 38 | // back to auto-detection. If invalid symbols are passed in, they should not 39 | // be demangled anymore. 40 | let name = Name::new("invalid", NameMangling::Unknown, Language::ObjCpp); 41 | let result = name.demangle(DemangleOptions::complete()); 42 | assert_eq!(result, None); 43 | } 44 | -------------------------------------------------------------------------------- /symbolic/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "symbolic" 3 | version = "12.17.0" 4 | license = "MIT" 5 | authors = [ 6 | "Armin Ronacher ", 7 | "Jan Michael Auer ", 8 | ] 9 | documentation = "https://docs.rs/symbolic" 10 | homepage = "https://github.com/getsentry/symbolic" 11 | repository = "https://github.com/getsentry/symbolic" 12 | readme = "README.md" 13 | description = """ 14 | A library to symbolicate and process stack traces from native applications, 15 | minidumps, Unreal Engine 4 or minified JavaScript. 16 | """ 17 | edition.workspace = true 18 | rust-version.workspace = true 19 | 20 | [package.metadata.docs.rs] 21 | all-features = true 22 | 23 | [features] 24 | default = ["debuginfo"] 25 | cfi = ["symbolic-cfi", "debuginfo"] 26 | common-serde = ["symbolic-common/serde"] 27 | debuginfo = ["symbolic-debuginfo"] 28 | debuginfo-serde = ["debuginfo", "common-serde"] 29 | demangle = ["symbolic-demangle"] 30 | il2cpp = ["symbolic-il2cpp", "symbolic-symcache/il2cpp"] 31 | ppdb = ["symbolic-ppdb"] 32 | sourcemapcache = ["symbolic-sourcemapcache"] 33 | symcache = ["symbolic-symcache", "debuginfo"] 34 | unreal = ["symbolic-unreal"] 35 | unreal-serde = ["unreal", "common-serde", "symbolic-unreal/serde"] 36 | 37 | [dependencies] 38 | symbolic-cfi = { version = "12.17.0", path = "../symbolic-cfi", optional = true } 39 | symbolic-common = { version = "12.17.0", path = "../symbolic-common" } 40 | symbolic-debuginfo = { version = "12.17.0", path = "../symbolic-debuginfo", optional = true } 41 | symbolic-demangle = { version = "12.17.0", path = "../symbolic-demangle", optional = true } 42 | symbolic-il2cpp = { version = "12.17.0", path = "../symbolic-il2cpp", optional = true } 43 | symbolic-ppdb = { version = "12.17.0", path = "../symbolic-ppdb", optional = true } 44 | symbolic-sourcemapcache = { version = "12.17.0", path = "../symbolic-sourcemapcache", optional = true } 45 | symbolic-symcache = { version = "12.17.0", path = "../symbolic-symcache", optional = true } 46 | symbolic-unreal = { version = "12.17.0", path = "../symbolic-unreal", optional = true } 47 | -------------------------------------------------------------------------------- /symbolic-symcache/benches/bench_writer.rs: -------------------------------------------------------------------------------- 1 | use std::io::Cursor; 2 | 3 | use criterion::{criterion_group, criterion_main, Criterion}; 4 | 5 | use symbolic_common::ByteView; 6 | use symbolic_debuginfo::Object; 7 | use symbolic_symcache::SymCacheConverter; 8 | use symbolic_testutils::fixture; 9 | 10 | fn bench_write_linux(c: &mut Criterion) { 11 | c.bench_function("write_linux", |b| { 12 | let buffer = ByteView::open(fixture("linux/crash.debug")).expect("open"); 13 | b.iter(|| { 14 | let object = Object::parse(&buffer).expect("parse"); 15 | let mut converter = SymCacheConverter::new(); 16 | converter.process_object(&object).expect("process_object"); 17 | converter 18 | .serialize(&mut Cursor::new(Vec::new())) 19 | .expect("write_object") 20 | }); 21 | }); 22 | } 23 | 24 | fn bench_write_macos(c: &mut Criterion) { 25 | c.bench_function("write_macos", |b| { 26 | let buffer = ByteView::open(fixture("macos/crash.dSYM/Contents/Resources/DWARF/crash")) 27 | .expect("open"); 28 | 29 | b.iter(|| { 30 | let object = Object::parse(&buffer).expect("parse"); 31 | let mut converter = SymCacheConverter::new(); 32 | converter.process_object(&object).expect("process_object"); 33 | converter 34 | .serialize(&mut Cursor::new(Vec::new())) 35 | .expect("write_object") 36 | }); 37 | }); 38 | } 39 | 40 | fn bench_write_breakpad(c: &mut Criterion) { 41 | c.bench_function("write_breakpad", |b| { 42 | let buffer = ByteView::open(fixture("windows/crash.sym")).expect("open"); 43 | b.iter(|| { 44 | let object = Object::parse(&buffer).expect("parse"); 45 | let mut converter = SymCacheConverter::new(); 46 | converter.process_object(&object).expect("process_object"); 47 | converter 48 | .serialize(&mut Cursor::new(Vec::new())) 49 | .expect("write_object") 50 | }); 51 | }); 52 | } 53 | 54 | criterion_group!( 55 | bench_writer, 56 | bench_write_linux, 57 | bench_write_macos, 58 | bench_write_breakpad 59 | ); 60 | 61 | criterion_main!(bench_writer); 62 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [workspace] 2 | resolver = "2" 3 | members = ["symbolic*", "examples/*"] 4 | 5 | [workspace.package] 6 | edition = "2021" 7 | rust-version = "1.82" 8 | 9 | [workspace.dependencies] 10 | anyhow = "1.0.32" 11 | anylog = "0.6.4" 12 | async-trait = "0.1.53" 13 | bytes = "1.4.0" 14 | cc = "1.0.79" 15 | chrono = { version = "0.4.23", default-features = false, features = ["std"] } 16 | clap = "4.4.5" 17 | cpp_demangle = "0.4.1" 18 | criterion = { version = "0.5.1", features = ["html_reports"] } 19 | debugid = "0.8.0" 20 | elementtree = "1.2.3" 21 | elsa = "1.8.0" 22 | fallible-iterator = "0.3.0" 23 | flate2 = { version = "1.0.25", default-features = false, features = [ 24 | "rust_backend", 25 | ] } 26 | gimli = { version = "0.32.3", default-features = false, features = [ 27 | "read", 28 | "std", 29 | "fallible-iterator", 30 | ] } 31 | goblin = { version = "0.8.0", default-features = false } 32 | indexmap = "2.0.0" 33 | insta = { version = "1.28.0", features = ["yaml"] } 34 | itertools = "0.13.0" 35 | js-source-scopes = "0.7.0" 36 | lazy_static = "1.4.0" 37 | memmap2 = "0.9.0" 38 | minidump = "0.22.0" 39 | minidump-processor = "0.22.0" 40 | minidump-unwind = "0.22.0" 41 | msvc-demangler = "0.10.0" 42 | nom = "7.1.3" 43 | nom-supreme = "0.8.0" 44 | once_cell = "1.17.1" 45 | parking_lot = "0.12.1" 46 | pdb-addr2line = "0.10.4" 47 | proguard = { version = "5.4.0", features = ["uuid"] } 48 | proptest = "1.6.0" 49 | regex = "1.7.1" 50 | rustc-demangle = "0.1.21" 51 | # keep this in sync with whatever version `goblin` uses 52 | scroll = "0.12.0" 53 | serde = { version = "1.0.171", features = ["derive"] } 54 | serde_json = "1.0.102" 55 | similar-asserts = "1.4.2" 56 | smallvec = "1.10.0" 57 | sourcemap = "9.2.2" 58 | stable_deref_trait = "1.2.0" 59 | tempfile = "3.4.0" 60 | thiserror = "1.0.39" 61 | time = { version = "0.3.20", features = ["formatting"] } 62 | tokio = "1.36.0" 63 | tracing = "0.1.34" 64 | tracing-subscriber = "0.3.11" 65 | uuid = "1.3.0" 66 | walkdir = "2.3.1" 67 | wasmparser = "0.214.0" 68 | watto = { version = "0.1.0", features = ["writer", "strings"] } 69 | zip = { version = "2.1.4", default-features = false, features = ["deflate"] } 70 | zstd = { version = "0.13.1" } 71 | 72 | 73 | [profile.release] 74 | debug = true 75 | lto = true 76 | 77 | [profile.bench] 78 | debug = true 79 | -------------------------------------------------------------------------------- /symbolic-testutils/fixtures/sourcemapcache/old-logs/simple.firefox.log: -------------------------------------------------------------------------------- 1 | # sync stack trace 2 | objectLiteralAnon@file:///Users/swatinem/Coding/js-source-scopes/tests/fixtures/simple.js:28:37 3 | objectLiteralMethod@file:///Users/swatinem/Coding/js-source-scopes/tests/fixtures/simple.js:27:32 4 | globalAssign@file:///Users/swatinem/Coding/js-source-scopes/tests/fixtures/simple.js:24:27 5 | Klass.prototype.prototypeMethod@file:///Users/swatinem/Coding/js-source-scopes/tests/fixtures/simple.js:22:28 6 | #privateMethod@file:///Users/swatinem/Coding/js-source-scopes/tests/fixtures/simple.js:18:28 7 | classMethod@file:///Users/swatinem/Coding/js-source-scopes/tests/fixtures/simple.js:16:39 8 | Klass@file:///Users/swatinem/Coding/js-source-scopes/tests/fixtures/simple.js:14:25 9 | staticMethod@file:///Users/swatinem/Coding/js-source-scopes/tests/fixtures/simple.js:12:28 10 | arrowFn@file:///Users/swatinem/Coding/js-source-scopes/tests/fixtures/simple.js:9:31 11 | anonFn@file:///Users/swatinem/Coding/js-source-scopes/tests/fixtures/simple.js:7:29 12 | namedFnExpr@file:///Users/swatinem/Coding/js-source-scopes/tests/fixtures/simple.js:5:42 13 | namedFn@file:///Users/swatinem/Coding/js-source-scopes/tests/fixtures/simple.js:3:21 14 | @file:///Users/swatinem/Coding/js-source-scopes/tests/fixtures/simple.js:60:5 15 | 16 | 17 | # async stack trace 18 | asyncObjectLiteralAnon@file:///Users/swatinem/Coding/js-source-scopes/tests/fixtures/simple.js:50:48 19 | asyncObjectLiteralMethod@file:///Users/swatinem/Coding/js-source-scopes/tests/fixtures/simple.js:49:54 20 | AsyncKlass.prototype.asyncProtoMethod@file:///Users/swatinem/Coding/js-source-scopes/tests/fixtures/simple.js:45:74 21 | #privateAsyncMethod@file:///Users/swatinem/Coding/js-source-scopes/tests/fixtures/simple.js:42:45 22 | asyncClassMethod@file:///Users/swatinem/Coding/js-source-scopes/tests/fixtures/simple.js:41:61 23 | asyncStaticMethod@file:///Users/swatinem/Coding/js-source-scopes/tests/fixtures/simple.js:39:17 24 | asyncArrowFn@file:///Users/swatinem/Coding/js-source-scopes/tests/fixtures/simple.js:34:52 25 | asyncNamedFn@file:///Users/swatinem/Coding/js-source-scopes/tests/fixtures/simple.js:33:38 26 | asyncMain@file:///Users/swatinem/Coding/js-source-scopes/tests/fixtures/simple.js:69:15 27 | @file:///Users/swatinem/Coding/js-source-scopes/tests/fixtures/simple.js:75:1 28 | -------------------------------------------------------------------------------- /symbolic-symcache/src/transform/mod.rs: -------------------------------------------------------------------------------- 1 | //! Utilities that transform the Data to be written to a SymCache. 2 | 3 | mod bcsymbolmap; 4 | 5 | #[cfg(feature = "il2cpp")] 6 | pub mod il2cpp; 7 | 8 | use std::borrow::Cow; 9 | 10 | /// A Function record to be written to the SymCache. 11 | #[non_exhaustive] 12 | pub struct Function<'s> { 13 | /// The functions name. 14 | pub name: Cow<'s, str>, 15 | /// The compilation directory of the function. 16 | pub comp_dir: Option>, 17 | } 18 | 19 | /// A File to be written to the SymCache. 20 | #[non_exhaustive] 21 | pub struct File<'s> { 22 | /// The file name. 23 | pub name: Cow<'s, str>, 24 | /// The optional directory prefix. 25 | pub directory: Option>, 26 | /// The optional compilation directory prefix. 27 | pub comp_dir: Option>, 28 | } 29 | 30 | /// A Source Location (File + Line) to be written to the SymCache. 31 | #[non_exhaustive] 32 | pub struct SourceLocation<'s> { 33 | /// The [`File`] part of this [`SourceLocation`]. 34 | pub file: File<'s>, 35 | /// The line number. 36 | pub line: u32, 37 | } 38 | 39 | /// A transformer that is applied to each [`Function`] and [`SourceLocation`] record in the SymCache. 40 | pub trait Transformer { 41 | /// Transforms a [`Function`] record. 42 | /// 43 | /// This can be used for example to de-obfuscate a functions name. 44 | fn transform_function<'f>(&'f mut self, f: Function<'f>) -> Function<'f> { 45 | f 46 | } 47 | 48 | /// Transforms a [`SourceLocation`]. 49 | /// 50 | /// This can be used for example to apply a Source Mapping in case an intermediate compilation 51 | /// step might have introduced an indirection, or to de-obfuscate the [`File`] information. 52 | fn transform_source_location<'f>(&'f mut self, sl: SourceLocation<'f>) -> SourceLocation<'f> { 53 | sl 54 | } 55 | } 56 | 57 | // This is essentially just a newtype in order to implement `Debug`. 58 | #[derive(Default)] 59 | pub(crate) struct Transformers<'a>(pub Vec>); 60 | 61 | impl std::fmt::Debug for Transformers<'_> { 62 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 63 | let len = self.0.len(); 64 | f.debug_tuple("Transformers").field(&len).finish() 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /symbolic-debuginfo/src/macho/mono_archive.rs: -------------------------------------------------------------------------------- 1 | use super::Parse; 2 | use std::{fmt, iter::FusedIterator, marker::PhantomData}; 3 | 4 | pub(crate) struct MonoArchive<'d, P> { 5 | data: &'d [u8], 6 | _ph: PhantomData<&'d P>, 7 | } 8 | 9 | impl<'d, P> MonoArchive<'d, P> 10 | where 11 | P: Parse<'d>, 12 | { 13 | pub fn new(data: &'d [u8]) -> Self { 14 | MonoArchive { 15 | data, 16 | _ph: PhantomData, 17 | } 18 | } 19 | 20 | pub fn object(&self) -> Result { 21 | P::parse(self.data) 22 | } 23 | 24 | pub fn objects(&self) -> MonoArchiveObjects<'d, P> { 25 | // TODO(ja): Consider parsing this lazily instead. 26 | MonoArchiveObjects(Some(self.object())) 27 | } 28 | 29 | pub fn object_count(&self) -> usize { 30 | 1 31 | } 32 | 33 | pub fn object_by_index(&self, index: usize) -> Result, P::Error> { 34 | match index { 35 | 0 => self.object().map(Some), 36 | _ => Ok(None), 37 | } 38 | } 39 | 40 | #[allow(dead_code)] 41 | pub fn is_multi(&self) -> bool { 42 | false 43 | } 44 | } 45 | 46 | impl<'d, P> fmt::Debug for MonoArchive<'d, P> 47 | where 48 | P: Parse<'d> + fmt::Debug, 49 | P::Error: fmt::Debug, 50 | { 51 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { 52 | let mut tuple = f.debug_tuple("MonoArchive"); 53 | match self.object() { 54 | Ok(object) => tuple.field(&object), 55 | Err(error) => tuple.field(&error), 56 | }; 57 | tuple.finish() 58 | } 59 | } 60 | 61 | #[derive(Debug)] 62 | pub(crate) struct MonoArchiveObjects<'d, P>(Option>) 63 | where 64 | P: Parse<'d>; 65 | 66 | impl<'d, P> Iterator for MonoArchiveObjects<'d, P> 67 | where 68 | P: Parse<'d>, 69 | { 70 | type Item = Result; 71 | 72 | fn next(&mut self) -> Option { 73 | self.0.take() 74 | } 75 | 76 | fn size_hint(&self) -> (usize, Option) { 77 | if self.0.is_some() { 78 | (1, Some(1)) 79 | } else { 80 | (0, Some(0)) 81 | } 82 | } 83 | } 84 | 85 | impl<'d, P> FusedIterator for MonoArchiveObjects<'d, P> where P: Parse<'d> {} 86 | impl<'d, P> ExactSizeIterator for MonoArchiveObjects<'d, P> where P: Parse<'d> {} 87 | -------------------------------------------------------------------------------- /symbolic-demangle/vendor/swift/include/llvm/Config/abi-breaking.h: -------------------------------------------------------------------------------- 1 | /*===------- llvm/Config/abi-breaking.h - llvm configuration -------*- C -*-===*/ 2 | /* */ 3 | /* The LLVM Compiler Infrastructure */ 4 | /* */ 5 | /* This file is distributed under the University of Illinois Open Source */ 6 | /* License. See LICENSE.TXT for details. */ 7 | /* */ 8 | /*===----------------------------------------------------------------------===*/ 9 | 10 | /* This file controls the C++ ABI break introduced in LLVM public header. */ 11 | 12 | #ifndef LLVM_ABI_BREAKING_CHECKS_H 13 | #define LLVM_ABI_BREAKING_CHECKS_H 14 | 15 | /* Define to enable checks that alter the LLVM C++ ABI */ 16 | #define LLVM_ENABLE_ABI_BREAKING_CHECKS 0 17 | 18 | /* Define to enable reverse iteration of unordered llvm containers */ 19 | #define LLVM_ENABLE_REVERSE_ITERATION 0 20 | 21 | /* Allow selectively disabling link-time mismatch checking so that header-only 22 | ADT content from LLVM can be used without linking libSupport. */ 23 | #if !LLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING 24 | 25 | // ABI_BREAKING_CHECKS protection: provides link-time failure when clients build 26 | // mismatch with LLVM 27 | #if defined(_MSC_VER) 28 | // Use pragma with MSVC 29 | #define LLVM_XSTR(s) LLVM_STR(s) 30 | #define LLVM_STR(s) #s 31 | #pragma detect_mismatch("LLVM_ENABLE_ABI_BREAKING_CHECKS", LLVM_XSTR(LLVM_ENABLE_ABI_BREAKING_CHECKS)) 32 | #undef LLVM_XSTR 33 | #undef LLVM_STR 34 | #elif defined(_WIN32) || defined(__CYGWIN__) // Win32 w/o #pragma detect_mismatch 35 | // FIXME: Implement checks without weak. 36 | #elif defined(__cplusplus) 37 | namespace llvm { 38 | #if LLVM_ENABLE_ABI_BREAKING_CHECKS 39 | extern int EnableABIBreakingChecks; 40 | __attribute__((weak, visibility ("hidden"))) int *VerifyEnableABIBreakingChecks = &EnableABIBreakingChecks; 41 | #else 42 | extern int DisableABIBreakingChecks; 43 | __attribute__((weak, visibility ("hidden"))) int *VerifyDisableABIBreakingChecks = &DisableABIBreakingChecks; 44 | #endif 45 | } 46 | #endif // _MSC_VER 47 | 48 | #endif // LLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /symbolic-demangle/vendor/swift/README.md: -------------------------------------------------------------------------------- 1 | # Vendored Swift Demangler 2 | 3 | This folder contains a vendored subset of the [Swift Programming Language]. The Swift library is 4 | reduced to the demangler only to reduce the size of this package. 5 | 6 | The current version is **Swift 5.5.1**. 7 | 8 | ## Sentry Modifications 9 | 10 | The library has been modified to add an option to hide function arguments during demangling. This 11 | patch is maintained in `1-arguments.patch`. 12 | 13 | ## How to Update 14 | 15 | 1. **Check out the [latest release] of Swift:** 16 | 1. Create a directory that will house swift and its dependencies: 17 | ``` 18 | $ mkdir swift-source && cd swift-source 19 | ``` 20 | 2. Clone the swift repository into a subdirectory: 21 | ``` 22 | $ git clone https://github.com/apple/swift.git 23 | ``` 24 | 3. Check out dependencies: 25 | ``` 26 | $ ./swift/utils/update-checkout --clone 27 | ``` 28 | 4. Check out the release branch of the latest release: 29 | ``` 30 | $ cd swift 31 | $ git checkout swift-5.5.1-RELEASE 32 | ``` 33 | 5. Build the complete swift project (be very patient, this may take long): 34 | ``` 35 | $ ./utils/build-script --skip-build 36 | ``` 37 | 2. **Copy updated sources and headers from the checkout to this library:** 38 | 1. Run the update script in this directory (requires Python 3): 39 | ``` 40 | $ ./update.py swift-source 41 | ``` 42 | 2. Check for modifications. 43 | 3. Commit _"feat(demangle): Import libswift demangle x.x.x"_ before proceeding. 44 | 3. **Apply the patch:** 45 | 1. Apply `1-arguments.patch`. 46 | 2. Build the Rust library and ensure tests work. 47 | 3. Commit the changes. 48 | 4. **Add tests for new mangling schemes:** 49 | 1. Identify new mangling schemes. Skip if there are no known changes. 50 | 2. Add test cases to `tests/swift.rs` 51 | 5. **Update Repository metadata**: 52 | 1. Bump the Swift version number in this README. 53 | 2. Check for changes in the license and update the files. 54 | 3. Update the patch file with the commit generated in step 3: 55 | ``` 56 | $ git show > 1-arguments.patch 57 | ``` 58 | 6. **Create a pull request.** 59 | 60 | [swift programming language]: https://github.com/apple/swift 61 | [latest release]: https://github.com/apple/swift/releases/latest/ 62 | -------------------------------------------------------------------------------- /symbolic-cabi/src/cfi.rs: -------------------------------------------------------------------------------- 1 | use std::ffi::CStr; 2 | use std::os::raw::c_char; 3 | 4 | use symbolic::cfi::{CfiCache, CFICACHE_LATEST_VERSION}; 5 | use symbolic::common::ByteView; 6 | 7 | use crate::debuginfo::SymbolicObject; 8 | use crate::utils::ForeignObject; 9 | 10 | /// Contains stack frame information (CFI) for an image. 11 | pub struct SymbolicCfiCache; 12 | 13 | impl ForeignObject for SymbolicCfiCache { 14 | type RustObject = CfiCache<'static>; 15 | } 16 | 17 | ffi_fn! { 18 | /// Extracts call frame information (CFI) from an Object. 19 | unsafe fn symbolic_cficache_from_object( 20 | object: *const SymbolicObject, 21 | ) -> Result<*mut SymbolicCfiCache> { 22 | let object = SymbolicObject::as_rust(object).get(); 23 | let cache = CfiCache::from_object(object)?; 24 | Ok(SymbolicCfiCache::from_rust(cache)) 25 | } 26 | } 27 | 28 | ffi_fn! { 29 | /// Loads a CFI cache from the given path. 30 | unsafe fn symbolic_cficache_open(path: *const c_char) -> Result<*mut SymbolicCfiCache> { 31 | let byteview = ByteView::open(CStr::from_ptr(path).to_str()?)?; 32 | let cache = CfiCache::from_bytes(byteview)?; 33 | Ok(SymbolicCfiCache::from_rust(cache)) 34 | } 35 | } 36 | 37 | ffi_fn! { 38 | /// Returns the file format version of the CFI cache. 39 | unsafe fn symbolic_cficache_get_version(cache: *const SymbolicCfiCache) -> Result { 40 | Ok(SymbolicCfiCache::as_rust(cache).version()) 41 | } 42 | } 43 | 44 | ffi_fn! { 45 | /// Returns a pointer to the raw buffer of the CFI cache. 46 | unsafe fn symbolic_cficache_get_bytes(cache: *const SymbolicCfiCache) -> Result<*const u8> { 47 | Ok(SymbolicCfiCache::as_rust(cache).as_slice().as_ptr()) 48 | } 49 | } 50 | 51 | ffi_fn! { 52 | /// Returns the size of the raw buffer of the CFI cache. 53 | unsafe fn symbolic_cficache_get_size(cache: *const SymbolicCfiCache) -> Result { 54 | Ok(SymbolicCfiCache::as_rust(cache).as_slice().len()) 55 | } 56 | } 57 | 58 | ffi_fn! { 59 | /// Releases memory held by an unmanaged `SymbolicCfiCache` instance. 60 | unsafe fn symbolic_cficache_free(cache: *mut SymbolicCfiCache) { 61 | SymbolicCfiCache::drop(cache); 62 | } 63 | } 64 | 65 | ffi_fn! { 66 | /// Returns the latest CFI cache version. 67 | unsafe fn symbolic_cficache_latest_version() -> Result { 68 | Ok(CFICACHE_LATEST_VERSION) 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /symbolic-debuginfo/src/function_stack.rs: -------------------------------------------------------------------------------- 1 | use crate::base::Function; 2 | 3 | /// A stack for assembling function trees from lists of nested functions. 4 | pub struct FunctionStack<'a>(Vec<(isize, Function<'a>)>); 5 | 6 | impl<'a> FunctionStack<'a> { 7 | /// Creates a new function stack. 8 | pub fn new() -> Self { 9 | FunctionStack(Vec::with_capacity(16)) 10 | } 11 | 12 | /// Pushes a new function onto the stack at the given depth. 13 | /// 14 | /// This assumes that `flush` has been called previously. 15 | pub fn push(&mut self, depth: isize, function: Function<'a>) { 16 | self.0.push((depth, function)); 17 | } 18 | 19 | /// Flushes all functions up to the given depth into the destination. 20 | /// 21 | /// This folds remaining functions into their parents. If a non-inlined function is encountered 22 | /// at or below the given depth, it is immediately flushed to the destination. Inlined functions 23 | /// are pushed into the inlinees list of their parents, instead. 24 | /// 25 | /// After this operation, the stack is either empty or its top function (see `peek`) will have a 26 | /// depth lower than the given depth. This allows to push new functions at this depth onto the 27 | /// stack. 28 | pub fn flush(&mut self, depth: isize, destination: &mut Vec>) { 29 | // Pull functions from the stack. Inline functions are folded into their parents 30 | // transitively, while regular functions are pushed to `destination`. 31 | // This also works when functions and inlinees are interleaved. 32 | let mut inlinee: Option = None; 33 | while let Some((fn_depth, mut function)) = self.0.pop() { 34 | if let Some(inlinee) = inlinee.take() { 35 | function.inlinees.push(inlinee); 36 | } 37 | // we reached the intended depth, so re-push the function and stop 38 | if fn_depth < depth { 39 | self.0.push((fn_depth, function)); 40 | return; 41 | } 42 | 43 | if function.inline { 44 | // mark the inlinee as needing to be folded into its parent 45 | inlinee = Some(function); 46 | } else { 47 | // otherwise, this is a function which we need to flush. 48 | function.inlinees.sort_by_key(|func| func.address); 49 | destination.push(function); 50 | } 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | // See https://go.microsoft.com/fwlink/?LinkId=733558 3 | // for the documentation about the tasks.json format 4 | "version": "2.0.0", 5 | "presentation": { 6 | "reveal": "always", 7 | "panel": "new" 8 | }, 9 | "tasks": [ 10 | { 11 | "label": "cargo build", 12 | "type": "shell", 13 | "presentation": { 14 | "echo": true, 15 | "reveal": "always", 16 | "focus": false, 17 | "panel": "shared" 18 | }, 19 | "command": "cargo", 20 | "args": ["build"], 21 | "group": "build", 22 | "problemMatcher": "$rustc" 23 | }, 24 | { 25 | "label": "cargo build unreal_engine_crash", 26 | "type": "shell", 27 | "presentation": { 28 | "echo": true, 29 | "reveal": "always", 30 | "focus": false, 31 | "panel": "shared" 32 | }, 33 | "command": "cargo", 34 | "args": ["build", "--example", "unreal_engine_crash", "--all-features"], 35 | "group": "build", 36 | "problemMatcher": "$rustc" 37 | }, 38 | { 39 | "label": "cargo run", 40 | "type": "shell", 41 | "presentation": { 42 | "echo": true, 43 | "reveal": "always", 44 | "focus": false, 45 | "panel": "shared" 46 | }, 47 | "command": "cargo", 48 | "args": ["run"], 49 | "problemMatcher": "$rustc" 50 | }, 51 | { 52 | "label": "cargo test", 53 | "type": "shell", 54 | "presentation": { 55 | "echo": true, 56 | "reveal": "always", 57 | "focus": false, 58 | "panel": "shared" 59 | }, 60 | "command": "cargo", 61 | "args": ["test", "--all"], 62 | "group": "test", 63 | "problemMatcher": "$rustc" 64 | }, 65 | { 66 | "label": "cargo clean", 67 | "type": "shell", 68 | "presentation": { 69 | "echo": true, 70 | "reveal": "never", 71 | "focus": false, 72 | "panel": "shared" 73 | }, 74 | "command": "cargo", 75 | "args": ["clean"] 76 | } 77 | ] 78 | } 79 | -------------------------------------------------------------------------------- /symbolic-demangle/vendor/swift/1-arguments.patch: -------------------------------------------------------------------------------- 1 | commit 80e772078494a73f2fbb5e385de2092e6057d913 2 | Author: David Herberth 3 | Date: Thu Jan 9 10:54:28 2025 +0100 4 | 5 | apply patch 6 | 7 | diff --git a/symbolic-demangle/vendor/swift/include/swift/Demangling/Demangle.h b/symbolic-demangle/vendor/swift/include/swift/Demangling/Demangle.h 8 | index f66dd7fd..940c3652 100644 9 | --- a/symbolic-demangle/vendor/swift/include/swift/Demangling/Demangle.h 10 | +++ b/symbolic-demangle/vendor/swift/include/swift/Demangling/Demangle.h 11 | @@ -58,6 +58,7 @@ struct DemangleOptions { 12 | bool ShortenArchetype = false; 13 | bool ShowPrivateDiscriminators = true; 14 | bool ShowFunctionArgumentTypes = true; 15 | + bool ShowFunctionReturnType = true; 16 | bool DisplayDebuggerGeneratedModule = true; 17 | bool DisplayStdlibModule = true; 18 | bool DisplayObjCModule = true; 19 | @@ -90,6 +91,7 @@ struct DemangleOptions { 20 | Opt.ShortenArchetype = true; 21 | Opt.ShowPrivateDiscriminators = false; 22 | Opt.ShowFunctionArgumentTypes = false; 23 | + Opt.ShowFunctionReturnType = false; 24 | Opt.ShowAsyncResumePartial = false; 25 | return Opt; 26 | }; 27 | diff --git a/symbolic-demangle/vendor/swift/lib/Demangling/NodePrinter.cpp b/symbolic-demangle/vendor/swift/lib/Demangling/NodePrinter.cpp 28 | index 6c309bbf..5b251e8d 100644 29 | --- a/symbolic-demangle/vendor/swift/lib/Demangling/NodePrinter.cpp 30 | +++ b/symbolic-demangle/vendor/swift/lib/Demangling/NodePrinter.cpp 31 | @@ -955,10 +955,11 @@ private: 32 | if (isSendable) 33 | Printer << "@Sendable "; 34 | 35 | - printFunctionParameters(LabelList, node->getChild(argIndex), depth, 36 | - Options.ShowFunctionArgumentTypes); 37 | + if (Options.ShowFunctionArgumentTypes) { 38 | + printFunctionParameters(LabelList, node->getChild(argIndex), depth, true); 39 | + } 40 | 41 | - if (!Options.ShowFunctionArgumentTypes) 42 | + if (!Options.ShowFunctionReturnType) 43 | return; 44 | 45 | if (isAsync) 46 | diff --git a/symbolic-demangle/vendor/swift/lib/Demangling/Demangler.cpp b/symbolic-demangle/vendor/swift/lib/Demangling/Demangler.cpp 47 | index 6c309bbf..5b251e8d 100644 48 | --- a/symbolic-demangle/vendor/swift/lib/Demangling/Demangler.cpp 49 | +++ b/symbolic-demangle/vendor/swift/lib/Demangling/Demangler.cpp 50 | @@ -3423,7 +3423,6 @@ NodePointer Demangler::demangleSpecAttributes(Node::Kind SpecKind) { 51 | 52 | int PassID = (int)nextChar() - '0'; 53 | if (PassID < 0 || PassID >= MAX_SPECIALIZATION_PASS) { 54 | - assert(false && "unexpected pass id"); 55 | return nullptr; 56 | } 57 | -------------------------------------------------------------------------------- /symbolic-demangle/vendor/swift/include/swift/Demangling/Errors.h: -------------------------------------------------------------------------------- 1 | //===--- Errors.h - Demangling library error handling -----------*- C++ -*-===// 2 | // 3 | // This source file is part of the Swift.org open source project 4 | // 5 | // Copyright (c) 2022 Apple Inc. and the Swift project authors 6 | // Licensed under Apache License v2.0 with Runtime Library Exception 7 | // 8 | // See https://swift.org/LICENSE.txt for license information 9 | // See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors 10 | // 11 | //===----------------------------------------------------------------------===// 12 | // 13 | // This file exists because not every client links to libswiftCore (the 14 | // runtime), so calling swift::fatalError() or swift::warning() from within 15 | // the demangler is not an option. 16 | // 17 | //===----------------------------------------------------------------------===// 18 | 19 | #ifndef SWIFT_DEMANGLING_ERRORS_H 20 | #define SWIFT_DEMANGLING_ERRORS_H 21 | 22 | #include "swift/Demangling/NamespaceMacros.h" 23 | #include 24 | #include 25 | 26 | #ifndef SWIFT_FORMAT 27 | // SWIFT_FORMAT(fmt,first) marks a function as taking a format string argument 28 | // at argument `fmt`, with the first argument for the format string as `first`. 29 | #if __has_attribute(format) 30 | #define SWIFT_FORMAT(fmt, first) __attribute__((format(printf, fmt, first))) 31 | #else 32 | #define SWIFT_FORMAT(fmt, first) 33 | #endif 34 | #endif 35 | 36 | #ifndef SWIFT_VFORMAT 37 | // SWIFT_VFORMAT(fmt) marks a function as taking a format string argument at 38 | // argument `fmt`, with the arguments in a `va_list`. 39 | #if __has_attribute(format) 40 | #define SWIFT_VFORMAT(fmt) __attribute__((format(printf, fmt, 0))) 41 | #else 42 | #define SWIFT_VFORMAT(fmt) 43 | #endif 44 | #endif 45 | 46 | #ifndef SWIFT_NORETURN 47 | #if __has_attribute(noreturn) 48 | #define SWIFT_NORETURN __attribute__((__noreturn__)) 49 | #else 50 | #define SWIFT_NORETURN 51 | #endif 52 | #endif 53 | 54 | namespace swift { 55 | namespace Demangle { 56 | SWIFT_BEGIN_INLINE_NAMESPACE 57 | 58 | SWIFT_NORETURN SWIFT_FORMAT(2, 3) void fatal(uint32_t flags, const char *format, 59 | ...); 60 | SWIFT_FORMAT(2, 3) void warn(uint32_t flags, const char *format, ...); 61 | 62 | SWIFT_NORETURN SWIFT_VFORMAT(2) void fatalv(uint32_t flags, const char *format, 63 | va_list val); 64 | SWIFT_VFORMAT(2) void warnv(uint32_t flags, const char *format, va_list val); 65 | 66 | SWIFT_END_INLINE_NAMESPACE 67 | } // end namespace Demangle 68 | } // end namespace swift 69 | 70 | #endif // SWIFT_DEMANGLING_DEMANGLE_H 71 | -------------------------------------------------------------------------------- /symbolic-demangle/vendor/swift/lib/Demangling/NodeDumper.cpp: -------------------------------------------------------------------------------- 1 | //===--- NodeDumper.cpp - Swift Demangling Debug Dump Functions -----------===// 2 | // 3 | // This source file is part of the Swift.org open source project 4 | // 5 | // Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors 6 | // Licensed under Apache License v2.0 with Runtime Library Exception 7 | // 8 | // See https://swift.org/LICENSE.txt for license information 9 | // See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors 10 | // 11 | //===----------------------------------------------------------------------===// 12 | 13 | #include "swift/Demangling/Demangle.h" 14 | #include "swift/Demangling/Demangler.h" 15 | #include 16 | 17 | using namespace swift; 18 | using namespace Demangle; 19 | 20 | const char *Demangle::getNodeKindString(swift::Demangle::Node::Kind k) { 21 | switch (k) { 22 | #define NODE(ID) \ 23 | case Node::Kind::ID: \ 24 | return #ID; 25 | #include "swift/Demangling/DemangleNodes.def" 26 | } 27 | return "Demangle::Node::Kind::???"; 28 | } 29 | 30 | static void printNode(DemanglerPrinter &Out, const Node *node, unsigned depth) { 31 | // Indent two spaces per depth. 32 | for (unsigned i = 0; i < depth * 2; ++i) { 33 | Out << ' '; 34 | } 35 | if (!node) { 36 | Out << "<>"; 37 | return; 38 | } 39 | Out << "kind=" << getNodeKindString(node->getKind()); 40 | if (node->hasText()) { 41 | Out << ", text=\"" << node->getText() << '\"'; 42 | } 43 | if (node->hasIndex()) { 44 | Out << ", index=" << node->getIndex(); 45 | } 46 | Out << '\n'; 47 | for (auto &child : *node) { 48 | printNode(Out, child, depth + 1); 49 | } 50 | } 51 | 52 | std::string Demangle::getNodeTreeAsString(NodePointer Root) { 53 | DemanglerPrinter Printer; 54 | printNode(Printer, Root, 0); 55 | return std::move(Printer).str(); 56 | } 57 | 58 | void swift::Demangle::Node::dump() { 59 | std::string TreeStr = getNodeTreeAsString(this); 60 | fputs(TreeStr.c_str(), stderr); 61 | } 62 | 63 | void Demangler::dump() { 64 | for (unsigned Idx = 0; Idx < Substitutions.size(); ++Idx) { 65 | fprintf(stderr, "Substitution[%c]:\n", Idx + 'A'); 66 | Substitutions[Idx]->dump(); 67 | fprintf(stderr, "\n"); 68 | } 69 | 70 | for (unsigned Idx = 0; Idx < NodeStack.size(); ++Idx) { 71 | fprintf(stderr, "NodeStack[%u]:\n", Idx); 72 | NodeStack[Idx]->dump(); 73 | fprintf(stderr, "\n"); 74 | } 75 | fprintf(stderr, "Position = %zd:\n%.*s\n%*s\n", Pos, 76 | (int)Text.size(), Text.data(), (int)Pos + 1, "^"); 77 | } 78 | 79 | -------------------------------------------------------------------------------- /symbolic-demangle/vendor/swift/include/llvm/ADT/STLForwardCompat.h: -------------------------------------------------------------------------------- 1 | //===- STLForwardCompat.h - Library features from future STLs ------C++ -*-===// 2 | // 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 | // See https://llvm.org/LICENSE.txt for license information. 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 | // 7 | //===----------------------------------------------------------------------===// 8 | /// 9 | /// \file 10 | /// This file contains library features backported from future STL versions. 11 | /// 12 | /// These should be replaced with their STL counterparts as the C++ version LLVM 13 | /// is compiled with is updated. 14 | /// 15 | //===----------------------------------------------------------------------===// 16 | 17 | #ifndef LLVM_ADT_STLFORWARDCOMPAT_H 18 | #define LLVM_ADT_STLFORWARDCOMPAT_H 19 | 20 | #include 21 | #include 22 | 23 | namespace llvm { 24 | 25 | //===----------------------------------------------------------------------===// 26 | // Features from C++20 27 | //===----------------------------------------------------------------------===// 28 | 29 | template 30 | struct remove_cvref // NOLINT(readability-identifier-naming) 31 | { 32 | using type = std::remove_cv_t>; 33 | }; 34 | 35 | template 36 | using remove_cvref_t // NOLINT(readability-identifier-naming) 37 | = typename llvm::remove_cvref::type; 38 | 39 | //===----------------------------------------------------------------------===// 40 | // Features from C++23 41 | //===----------------------------------------------------------------------===// 42 | 43 | // TODO: Remove this in favor of std::optional::transform once we switch to 44 | // C++23. 45 | template 46 | auto transformOptional(const std::optional &O, const Function &F) 47 | -> std::optional { 48 | if (O) 49 | return F(*O); 50 | return std::nullopt; 51 | } 52 | 53 | // TODO: Remove this in favor of std::optional::transform once we switch to 54 | // C++23. 55 | template 56 | auto transformOptional(std::optional &&O, const Function &F) 57 | -> std::optional { 58 | if (O) 59 | return F(*std::move(O)); 60 | return std::nullopt; 61 | } 62 | 63 | /// Returns underlying integer value of an enum. Backport of C++23 64 | /// std::to_underlying. 65 | template 66 | [[nodiscard]] constexpr std::underlying_type_t to_underlying(Enum E) { 67 | return static_cast>(E); 68 | } 69 | 70 | } // namespace llvm 71 | 72 | #endif // LLVM_ADT_STLFORWARDCOMPAT_H 73 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | SYMBOLIC_PYTHON := python3 2 | 3 | all: check test 4 | .PHONY: all 5 | 6 | check: style lint 7 | .PHONY: check 8 | 9 | clean: 10 | cargo clean 11 | rm -rf .venv 12 | .PHONY: clean 13 | 14 | # Builds 15 | 16 | build: 17 | @cargo +stable build --all --all-features 18 | .PHONY: build 19 | 20 | sdist: .venv/bin/python 21 | cd py && ../.venv/bin/python setup.py sdist 22 | .PHONY: sdist 23 | 24 | wheel: .venv/bin/python 25 | cd py && ../.venv/bin/pip install -U wheel && ../.venv/bin/python setup.py bdist_wheel $(PLATFORM:%=-p %) 26 | .PHONY: wheel 27 | 28 | wheel-manylinux: 29 | docker run --rm -v $(CURDIR):/work -w /work/py $(IMAGE) sh manylinux.sh 30 | .PHONY: wheel-manylinux 31 | 32 | wheel-manylinux-aarch64: 33 | docker run --rm -v $(CURDIR):/work -w /work/py $(IMAGE) sh manylinux_aarch64.sh 34 | .PHONY: wheel-manylinux-aarch64 35 | 36 | 37 | # Tests 38 | 39 | test: test-rust test-python 40 | .PHONY: test 41 | 42 | test-rust: 43 | cargo test --workspace --all-features 44 | .PHONY: test-rust 45 | 46 | test-python: .venv/bin/python 47 | .venv/bin/pip install -U "pytest>=5.0.0,<6.0.0" 48 | .venv/bin/pip install -v --editable py 49 | .venv/bin/pytest -v py 50 | .PHONY: test-python 51 | 52 | # Style checking 53 | 54 | style: style-rust style-python 55 | .PHONY: style 56 | 57 | style-rust: 58 | @rustup component add rustfmt --toolchain stable 2> /dev/null 59 | cargo +stable fmt --all -- --check 60 | .PHONY: style-rust 61 | 62 | style-python: .venv/bin/python 63 | .venv/bin/pip install -U black==22.3.0 64 | .venv/bin/black --check py --exclude 'symbolic/_lowlevel*|dist|build|\.eggs' 65 | 66 | # Linting 67 | 68 | lint: lint-rust lint-python 69 | .PHONY: lint 70 | 71 | lint-rust: 72 | @rustup component add clippy --toolchain stable 2> /dev/null 73 | cargo +stable clippy --all-features --workspace --tests --examples -- -D clippy::all 74 | .PHONY: lint-rust 75 | 76 | lint-python: .venv/bin/python 77 | .venv/bin/pip install -U flake8==6.0.0 mypy==1.4.0 pytest types-setuptools 78 | cd py && ../.venv/bin/flake8 . 79 | cd py && ../.venv/bin/mypy . 80 | .PHONY: lint-python 81 | 82 | # Formatting 83 | 84 | format: format-rust format-python 85 | .PHONY: format 86 | 87 | format-rust: 88 | @rustup component add rustfmt --toolchain stable 2> /dev/null 89 | cargo +stable fmt --all 90 | .PHONY: format-rust 91 | 92 | format-python: .venv/bin/python 93 | .venv/bin/pip install -U black==22.3.0 94 | .venv/bin/black py --exclude 'symbolic/_lowlevel*|dist|build|\.eggs' 95 | .PHONY: format-python 96 | 97 | # Dependencies 98 | 99 | .venv/bin/python: Makefile 100 | @rm -rf .venv 101 | $(SYMBOLIC_PYTHON) -m venv .venv 102 | -------------------------------------------------------------------------------- /symbolic-demangle/tests/test_detection.rs: -------------------------------------------------------------------------------- 1 | //! Language auto-detection tests 2 | 3 | use symbolic_common::{Language, Name}; 4 | use symbolic_demangle::Demangle; 5 | 6 | use similar_asserts::assert_eq; 7 | 8 | fn assert_language(input: &str, lang: Language) { 9 | let name = Name::from(input); 10 | assert_eq!(name.detect_language(), lang); 11 | } 12 | 13 | #[test] 14 | fn test_unknown() { 15 | // Fallback to test false positives 16 | assert_language("xxxxxxxxxxx", Language::Unknown); 17 | } 18 | 19 | #[test] 20 | fn test_cpp_gcc() { 21 | // This is a symbol generated for "void h(int, char)" by: 22 | // - Intel C++ 8.0 for Linux 23 | // - HP aC++ A.05.55 IA-64 24 | // - IAR EWARM C++ 5.4 ARM 25 | // - GCC 3.x and higher 26 | // - Clang 1.x and higher[1] 27 | // 28 | // NOTE: Microsoft Visual C++ would generate a different 29 | // symbol, but we do not support that yet. 30 | assert_language("_Z1hic", Language::Cpp); 31 | } 32 | 33 | #[test] 34 | fn test_cpp_msvc() { 35 | // The same symbol as above, mangled by MSVC: 36 | assert_language("?h@@YAXH@Z ", Language::Cpp); 37 | } 38 | 39 | #[test] 40 | fn test_objc_static() { 41 | assert_language("+[Foo bar:blub:]", Language::ObjC); 42 | } 43 | 44 | #[test] 45 | fn test_objc_member() { 46 | assert_language("-[Foo bar:blub:]", Language::ObjC); 47 | } 48 | 49 | #[test] 50 | fn test_ambiguous_cpp_rust() { 51 | // This symbol might look like a legacy Rust symbol at first because of the _ZN...E schema, but 52 | // comes from a C++ file and is not even a valid Rust. 53 | // It demangles to: 54 | // content::ContentMain(content::ContentMainParams const&) 55 | assert_language( 56 | "_ZN7content11ContentMainERKNS_17ContentMainParamsE", 57 | Language::Cpp, 58 | ); 59 | } 60 | 61 | #[cfg(feature = "swift")] 62 | mod swift_tests { 63 | use super::*; 64 | 65 | #[test] 66 | fn test_swift_old() { 67 | assert_language("_T08mangling3barSiyKF", Language::Swift); 68 | } 69 | 70 | #[test] 71 | fn test_swift_4() { 72 | assert_language("$S8mangling6curry1yyF", Language::Swift); 73 | } 74 | 75 | #[test] 76 | fn test_swift_5() { 77 | assert_language("$s8mangling6curry1yyF", Language::Swift); 78 | } 79 | } 80 | 81 | #[cfg(feature = "rust")] 82 | mod rust_tests { 83 | use super::*; 84 | 85 | #[test] 86 | fn test_rust_legacy() { 87 | assert_language( 88 | "__ZN3std2io4Read11read_to_end17hb85a0f6802e14499E", 89 | Language::Rust, 90 | ); 91 | } 92 | 93 | #[test] 94 | fn test_rust_v0() { 95 | assert_language("_RNvNtCs1234_7mycrate3foo3bar", Language::Rust); 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /symbolic-symcache/tests/test_cache.rs: -------------------------------------------------------------------------------- 1 | use symbolic_common::ByteView; 2 | use symbolic_symcache::{FunctionsDebug, SymCache}; 3 | use symbolic_testutils::fixture; 4 | 5 | type Error = Box; 6 | 7 | #[test] 8 | fn test_load_header_linux() -> Result<(), Error> { 9 | let buffer = ByteView::open(fixture("symcache/current/linux.symc"))?; 10 | let symcache = SymCache::parse(&buffer)?; 11 | insta::assert_debug_snapshot!(symcache, @r#" 12 | SymCache { 13 | version: 7, 14 | debug_id: DebugId { 15 | uuid: "c0bcc3f1-9827-fe65-3058-404b2831d9e6", 16 | appendix: 0, 17 | }, 18 | arch: Amd64, 19 | files: 55, 20 | functions: 697, 21 | source_locations: 8236, 22 | ranges: 6762, 23 | string_bytes: 52180, 24 | } 25 | "#); 26 | Ok(()) 27 | } 28 | 29 | #[test] 30 | fn test_load_functions_linux() -> Result<(), Error> { 31 | let buffer = ByteView::open(fixture("symcache/current/linux.symc"))?; 32 | let symcache = SymCache::parse(&buffer)?; 33 | insta::assert_debug_snapshot!("functions_linux", FunctionsDebug(&symcache)); 34 | Ok(()) 35 | } 36 | 37 | #[test] 38 | fn test_load_header_macos() -> Result<(), Error> { 39 | let buffer = ByteView::open(fixture("symcache/current/macos.symc"))?; 40 | let symcache = SymCache::parse(&buffer)?; 41 | insta::assert_debug_snapshot!(symcache, @r#" 42 | SymCache { 43 | version: 7, 44 | debug_id: DebugId { 45 | uuid: "67e9247c-814e-392b-a027-dbde6748fcbf", 46 | appendix: 0, 47 | }, 48 | arch: Amd64, 49 | files: 36, 50 | functions: 639, 51 | source_locations: 6033, 52 | ranges: 4591, 53 | string_bytes: 42829, 54 | } 55 | "#); 56 | Ok(()) 57 | } 58 | 59 | #[test] 60 | fn test_load_functions_macos() -> Result<(), Error> { 61 | let buffer = ByteView::open(fixture("symcache/current/macos.symc"))?; 62 | let symcache = SymCache::parse(&buffer)?; 63 | insta::assert_debug_snapshot!("functions_macos", FunctionsDebug(&symcache)); 64 | Ok(()) 65 | } 66 | 67 | #[test] 68 | fn test_lookup() -> Result<(), Error> { 69 | let buffer = ByteView::open(fixture("symcache/current/macos.symc"))?; 70 | let symcache = SymCache::parse(&buffer)?; 71 | let source_locations = symcache.lookup(4_458_187_797 - 4_458_131_456); 72 | let result: Vec<_> = source_locations 73 | .map(|sl| { 74 | ( 75 | sl.file().map(|file| file.full_path()).unwrap(), 76 | sl.line(), 77 | sl.function(), 78 | ) 79 | }) 80 | .collect(); 81 | insta::assert_debug_snapshot!("lookup", result); 82 | 83 | Ok(()) 84 | } 85 | -------------------------------------------------------------------------------- /symbolic-unreal/src/error.rs: -------------------------------------------------------------------------------- 1 | use std::error::Error; 2 | use std::fmt; 3 | 4 | use thiserror::Error; 5 | 6 | /// The error type for [`Unreal4Error`]. 7 | #[non_exhaustive] 8 | #[derive(Clone, Copy, Debug, PartialEq, Eq)] 9 | pub enum Unreal4ErrorKind { 10 | /// Empty data blob received. 11 | Empty, 12 | 13 | /// Invalid compressed data. 14 | BadCompression, 15 | 16 | /// Invalid contents of the crash file container. 17 | BadData, 18 | 19 | /// The crash file contains unexpected trailing data after the footer. 20 | TrailingData, 21 | 22 | /// The crash file contents are too large during decompression. 23 | TooLarge, 24 | 25 | /// Can't process a log entry. 26 | InvalidLogEntry, 27 | 28 | /// Invalid XML. 29 | InvalidXml, 30 | } 31 | 32 | impl fmt::Display for Unreal4ErrorKind { 33 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { 34 | match self { 35 | Self::Empty => write!(f, "empty crash"), 36 | Self::BadCompression => write!(f, "bad compression"), 37 | Self::BadData => write!(f, "invalid crash file contents"), 38 | Self::TrailingData => write!(f, "unexpected trailing data"), 39 | Self::TooLarge => write!(f, "crash file contents are too large"), 40 | Self::InvalidLogEntry => write!(f, "invalid log entry"), 41 | Self::InvalidXml => write!(f, "invalid xml"), 42 | } 43 | } 44 | } 45 | 46 | /// An error returned when handling an UE4 crash file. 47 | #[derive(Debug, Error)] 48 | #[error("{kind}")] 49 | pub struct Unreal4Error { 50 | kind: Unreal4ErrorKind, 51 | #[source] 52 | source: Option>, 53 | } 54 | 55 | impl Unreal4Error { 56 | /// Creates a new Unreal4 error from a known kind of error as well as an 57 | /// arbitrary error payload. 58 | pub(crate) fn new(kind: Unreal4ErrorKind, source: E) -> Self 59 | where 60 | E: Into>, 61 | { 62 | let source = Some(source.into()); 63 | Self { kind, source } 64 | } 65 | 66 | /// Returns the corresponding [`Unreal4ErrorKind`] for this error. 67 | pub fn kind(&self) -> Unreal4ErrorKind { 68 | self.kind 69 | } 70 | } 71 | 72 | impl From for Unreal4Error { 73 | fn from(kind: Unreal4ErrorKind) -> Self { 74 | Self { kind, source: None } 75 | } 76 | } 77 | 78 | impl From for Unreal4Error { 79 | fn from(source: elementtree::Error) -> Self { 80 | Self::new(Unreal4ErrorKind::InvalidXml, source) 81 | } 82 | } 83 | 84 | impl From for Unreal4Error { 85 | fn from(source: scroll::Error) -> Self { 86 | Self::new(Unreal4ErrorKind::BadData, source) 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /symbolic-demangle/vendor/swift/include/llvm/Support/SwapByteOrder.h: -------------------------------------------------------------------------------- 1 | //===- SwapByteOrder.h - Generic and optimized byte swaps -------*- C++ -*-===// 2 | // 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 | // See https://llvm.org/LICENSE.txt for license information. 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 | // 7 | //===----------------------------------------------------------------------===// 8 | // 9 | // This file declares generic and optimized functions to swap the byte order of 10 | // an integral type. 11 | // 12 | //===----------------------------------------------------------------------===// 13 | 14 | #ifndef LLVM_SUPPORT_SWAPBYTEORDER_H 15 | #define LLVM_SUPPORT_SWAPBYTEORDER_H 16 | 17 | #include "llvm/ADT/STLForwardCompat.h" 18 | #include "llvm/ADT/bit.h" 19 | #include 20 | #include 21 | 22 | namespace llvm { 23 | 24 | namespace sys { 25 | 26 | constexpr bool IsBigEndianHost = 27 | llvm::endianness::native == llvm::endianness::big; 28 | 29 | static const bool IsLittleEndianHost = !IsBigEndianHost; 30 | 31 | inline unsigned char getSwappedBytes(unsigned char C) { return llvm::byteswap(C); } 32 | inline signed char getSwappedBytes( signed char C) { return llvm::byteswap(C); } 33 | inline char getSwappedBytes( char C) { return llvm::byteswap(C); } 34 | 35 | inline unsigned short getSwappedBytes(unsigned short C) { return llvm::byteswap(C); } 36 | inline signed short getSwappedBytes( signed short C) { return llvm::byteswap(C); } 37 | 38 | inline unsigned int getSwappedBytes(unsigned int C) { return llvm::byteswap(C); } 39 | inline signed int getSwappedBytes( signed int C) { return llvm::byteswap(C); } 40 | 41 | inline unsigned long getSwappedBytes(unsigned long C) { return llvm::byteswap(C); } 42 | inline signed long getSwappedBytes( signed long C) { return llvm::byteswap(C); } 43 | 44 | inline unsigned long long getSwappedBytes(unsigned long long C) { return llvm::byteswap(C); } 45 | inline signed long long getSwappedBytes( signed long long C) { return llvm::byteswap(C); } 46 | 47 | inline float getSwappedBytes(float C) { 48 | return llvm::bit_cast(llvm::byteswap(llvm::bit_cast(C))); 49 | } 50 | 51 | inline double getSwappedBytes(double C) { 52 | return llvm::bit_cast(llvm::byteswap(llvm::bit_cast(C))); 53 | } 54 | 55 | template 56 | inline std::enable_if_t, T> getSwappedBytes(T C) { 57 | return static_cast(llvm::byteswap(llvm::to_underlying(C))); 58 | } 59 | 60 | template 61 | inline void swapByteOrder(T &Value) { 62 | Value = getSwappedBytes(Value); 63 | } 64 | 65 | } // end namespace sys 66 | } // end namespace llvm 67 | 68 | #endif 69 | -------------------------------------------------------------------------------- /examples/dump_sources/src/main.rs: -------------------------------------------------------------------------------- 1 | use std::path::{Path, PathBuf}; 2 | 3 | use clap::{value_parser, Arg, ArgAction, ArgMatches, Command}; 4 | 5 | use symbolic::common::{ByteView, DSymPathExt}; 6 | use symbolic::debuginfo::sourcebundle::SourceBundleWriter; 7 | use symbolic::debuginfo::Archive; 8 | 9 | fn print_error(mut error: &dyn std::error::Error) { 10 | println!("Error: {error}"); 11 | 12 | while let Some(source) = error.source() { 13 | println!(" caused by {source}"); 14 | error = source; 15 | } 16 | } 17 | 18 | fn write_object_sources(path: &Path, output_path: &Path) -> Result<(), Box> { 19 | println!("Inspecting {}", path.display()); 20 | 21 | let dsym_path = path.resolve_dsym(); 22 | let buffer = ByteView::open(dsym_path.as_deref().unwrap_or(path))?; 23 | let archive = Archive::parse(&buffer)?; 24 | 25 | println!("File format: {}", archive.file_format()); 26 | 27 | for object in archive.objects() { 28 | match object { 29 | Ok(object) => { 30 | let out = output_path.join(format!("{}.zip", &object.debug_id())); 31 | println!(" -> {}", out.display()); 32 | let writer = SourceBundleWriter::create(&out)?; 33 | writer.write_object(&object, &path.file_name().unwrap().to_string_lossy())?; 34 | } 35 | Err(e) => { 36 | print!(" - "); 37 | print_error(&e); 38 | continue; 39 | } 40 | } 41 | } 42 | 43 | Ok(()) 44 | } 45 | 46 | fn execute(matches: &ArgMatches) { 47 | let output_path = matches.get_one::("output").unwrap(); 48 | for path in matches.get_many::("paths").unwrap_or_default() { 49 | if let Err(e) = write_object_sources(Path::new(&path), output_path) { 50 | print_error(e.as_ref()); 51 | } 52 | 53 | println!(); 54 | } 55 | } 56 | 57 | fn main() { 58 | let matches = Command::new("object-debug") 59 | .about("Shows some information on object files") 60 | .arg( 61 | Arg::new("paths") 62 | .required(true) 63 | .action(ArgAction::Append) 64 | .value_name("PATH") 65 | .value_parser(value_parser!(PathBuf)) 66 | .help("Path to the debug file") 67 | .number_of_values(1) 68 | .index(1), 69 | ) 70 | .arg( 71 | Arg::new("output") 72 | .short('o') 73 | .long("output") 74 | .required(true) 75 | .value_name("PATH") 76 | .value_parser(value_parser!(PathBuf)) 77 | .help("Path to the source output folder"), 78 | ) 79 | .get_matches(); 80 | 81 | execute(&matches); 82 | } 83 | -------------------------------------------------------------------------------- /examples/object_debug/src/main.rs: -------------------------------------------------------------------------------- 1 | use std::path::{Path, PathBuf}; 2 | 3 | use clap::{value_parser, Arg, ArgAction, ArgMatches, Command}; 4 | 5 | use symbolic::common::{ByteView, DSymPathExt}; 6 | use symbolic::debuginfo::Archive; 7 | 8 | fn print_error(mut error: &dyn std::error::Error) { 9 | println!("Error: {error}"); 10 | 11 | while let Some(source) = error.source() { 12 | println!(" caused by {source}"); 13 | error = source; 14 | } 15 | } 16 | 17 | fn inspect_object>(path: P) -> Result<(), Box> { 18 | let path = path.as_ref(); 19 | println!("Inspecting {}", path.display()); 20 | 21 | let dsym_path = path.resolve_dsym(); 22 | let buffer = ByteView::open(dsym_path.as_deref().unwrap_or(path))?; 23 | let archive = Archive::parse(&buffer)?; 24 | 25 | println!("File format: {}", archive.file_format()); 26 | println!("Objects:"); 27 | 28 | for object in archive.objects() { 29 | match object { 30 | Ok(object) => { 31 | println!(" - {}: {}", object.arch(), object.debug_id()); 32 | if let Some(code_id) = object.code_id() { 33 | println!(" code id: {code_id}"); 34 | } else { 35 | println!(" code id: -"); 36 | } 37 | println!(" object kind: {:#}", object.kind()); 38 | println!(" load address: {:#x}", object.load_address()); 39 | println!(" symbol table: {}", object.has_symbols()); 40 | println!(" debug info: {}", object.has_debug_info()); 41 | println!(" unwind info: {}", object.has_unwind_info()); 42 | println!(" is malformed: {}", object.is_malformed()); 43 | } 44 | Err(e) => { 45 | print!(" - "); 46 | print_error(&e); 47 | continue; 48 | } 49 | } 50 | } 51 | 52 | Ok(()) 53 | } 54 | 55 | fn execute(matches: &ArgMatches) { 56 | for path in matches.get_many::("paths").unwrap_or_default() { 57 | if let Err(e) = inspect_object(path) { 58 | print_error(e.as_ref()) 59 | } 60 | 61 | println!(); 62 | } 63 | } 64 | 65 | fn main() { 66 | let matches = Command::new("object-debug") 67 | .about("Shows some information on object files") 68 | .arg( 69 | Arg::new("paths") 70 | .required(true) 71 | .action(ArgAction::Append) 72 | .value_name("PATH") 73 | .value_parser(value_parser!(PathBuf)) 74 | .help("Path to the debug file") 75 | .number_of_values(1) 76 | .index(1), 77 | ) 78 | .get_matches(); 79 | 80 | execute(&matches); 81 | } 82 | -------------------------------------------------------------------------------- /symbolic-ppdb/src/cache/lookup.rs: -------------------------------------------------------------------------------- 1 | use symbolic_common::Language; 2 | 3 | use super::{raw, PortablePdbCache}; 4 | 5 | /// Line information for a given IL offset in a function. 6 | #[derive(Debug, Copy, Clone, PartialEq, Eq)] 7 | pub struct LineInfo<'data> { 8 | /// The line in the source file. 9 | pub line: u32, 10 | /// The source file's name. 11 | pub file_name: &'data str, 12 | /// The source language. 13 | pub file_lang: Language, 14 | } 15 | 16 | impl<'data> PortablePdbCache<'data> { 17 | /// Looks up line information for a function in the cache. 18 | /// 19 | /// `func_idx` is the (1-based) index of the function in the ECMA-335 `MethodDef` table 20 | /// (see the ECMA-335 spec, Section II.22.26). In C#, it is encoded in the 21 | /// [`MetadataToken`](https://docs.microsoft.com/en-us/dotnet/api/system.reflection.memberinfo.metadatatoken?view=net-6.0#system-reflection-memberinfo-metadatatoken) 22 | /// property on the [`MethodBase`](https://docs.microsoft.com/en-us/dotnet/api/system.reflection.methodbase?view=net-6.0) class. 23 | /// See [Metadata Tokens](https://docs.microsoft.com/en-us/previous-versions/dotnet/netframework-4.0/ms404456(v=vs.100)) for an 24 | /// explanation of the encoding. 25 | /// 26 | /// `il_offset` is the offset from the start of the method's Intermediate Language code. 27 | /// It can be obtained via the [`StackFrame.GetILOffset`](https://docs.microsoft.com/en-us/dotnet/api/system.diagnostics.stackframe.getiloffset?view=net-6.0#system-diagnostics-stackframe-getiloffset) 28 | /// method. 29 | pub fn lookup(&self, func_idx: u32, il_offset: u32) -> Option> { 30 | let range = raw::Range { 31 | func_idx, 32 | il_offset, 33 | }; 34 | let sl = match self.ranges.binary_search(&range) { 35 | Ok(idx) => self.source_locations.get(idx)?, 36 | Err(idx) => { 37 | let idx = idx.checked_sub(1)?; 38 | let range = self.ranges.get(idx)?; 39 | if range.func_idx < func_idx { 40 | return None; 41 | } 42 | 43 | self.source_locations.get(idx)? 44 | } 45 | }; 46 | 47 | let (file_name, file_lang) = self.get_file(sl.file_idx)?; 48 | 49 | Some(LineInfo { 50 | line: sl.line, 51 | file_name, 52 | file_lang, 53 | }) 54 | } 55 | 56 | fn get_file(&self, idx: u32) -> Option<(&'data str, Language)> { 57 | let raw = self.files.get(idx as usize)?; 58 | let name = self.get_string(raw.name_offset)?; 59 | 60 | Some((name, Language::from_u32(raw.lang))) 61 | } 62 | 63 | /// Resolves a string reference to the pointed-to `&str` data. 64 | fn get_string(&self, offset: u32) -> Option<&'data str> { 65 | watto::StringTable::read(self.string_bytes, offset as usize).ok() 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /symbolic-demangle/vendor/swift/include/swift/Demangling/Punycode.h: -------------------------------------------------------------------------------- 1 | //===--- Punycode.h - UTF-8 to Punycode transcoding -------------*- C++ -*-===// 2 | // 3 | // This source file is part of the Swift.org open source project 4 | // 5 | // Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors 6 | // Licensed under Apache License v2.0 with Runtime Library Exception 7 | // 8 | // See https://swift.org/LICENSE.txt for license information 9 | // See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors 10 | // 11 | //===----------------------------------------------------------------------===// 12 | // 13 | // These functions implement a variant of the Punycode algorithm from RFC3492, 14 | // originally designed for encoding international domain names, for the purpose 15 | // of encoding Swift identifiers into mangled symbol names. This version differs 16 | // from RFC3492 in the following respects: 17 | // - '_' is used as the encoding delimiter instead of '-'. 18 | // - Encoding digits are represented using [a-zA-J] instead of [a-z0-9], because 19 | // symbol names are case-sensitive, and Swift mangled identifiers cannot begin 20 | // with a digit. 21 | // - Optionally, non-symbol ASCII characters (characters except [$_a-zA-Z0-9]) 22 | // are mapped to the code range 0xD800 - 0xD880 and are also encoded like 23 | // non-ASCII unicode characters. 24 | // 25 | //===----------------------------------------------------------------------===// 26 | 27 | #ifndef SWIFT_DEMANGLING_PUNYCODE_H 28 | #define SWIFT_DEMANGLING_PUNYCODE_H 29 | 30 | #include "llvm/ADT/StringRef.h" 31 | #include "swift/Demangling/NamespaceMacros.h" 32 | #include 33 | #include 34 | 35 | namespace swift { 36 | namespace Punycode { 37 | SWIFT_BEGIN_INLINE_NAMESPACE 38 | 39 | using llvm::StringRef; 40 | 41 | /// Encodes a sequence of code points into Punycode. 42 | /// 43 | /// Returns false if input contains surrogate code points. 44 | bool encodePunycode(const std::vector &InputCodePoints, 45 | std::string &OutPunycode); 46 | 47 | /// Decodes a Punycode string into a sequence of Unicode scalars. 48 | /// 49 | /// Returns false if decoding failed. 50 | bool decodePunycode(StringRef InputPunycode, 51 | std::vector &OutCodePoints); 52 | 53 | /// Encodes an UTF8 string into Punycode. 54 | /// 55 | /// If \p mapNonSymbolChars is true, non-symbol ASCII characters (characters 56 | /// except [$_a-zA-Z0-9]) are also encoded like non-ASCII unicode characters. 57 | /// Returns false if \p InputUTF8 contains surrogate code points. 58 | bool encodePunycodeUTF8(StringRef InputUTF8, std::string &OutPunycode, 59 | bool mapNonSymbolChars = false); 60 | 61 | bool decodePunycodeUTF8(StringRef InputPunycode, std::string &OutUTF8); 62 | 63 | SWIFT_END_INLINE_NAMESPACE 64 | } // end namespace Punycode 65 | } // end namespace swift 66 | 67 | #endif // SWIFT_DEMANGLING_PUNYCODE_H 68 | 69 | -------------------------------------------------------------------------------- /symbolic-demangle/vendor/swift/lib/Demangling/ManglingUtils.cpp: -------------------------------------------------------------------------------- 1 | //===--- ManglingUtils.cpp - Utilities for Swift name mangling ------------===// 2 | // 3 | // This source file is part of the Swift.org open source project 4 | // 5 | // Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors 6 | // Licensed under Apache License v2.0 with Runtime Library Exception 7 | // 8 | // See https://swift.org/LICENSE.txt for license information 9 | // See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors 10 | // 11 | //===----------------------------------------------------------------------===// 12 | 13 | #include "swift/Demangling/ManglingUtils.h" 14 | #include 15 | 16 | using namespace swift; 17 | using namespace Mangle; 18 | 19 | 20 | bool Mangle::isNonAscii(StringRef str) { 21 | for (unsigned char c : str) { 22 | if (c >= 0x80) 23 | return true; 24 | } 25 | return false; 26 | } 27 | 28 | bool Mangle::needsPunycodeEncoding(StringRef str) { 29 | for (unsigned char c : str) { 30 | if (!isValidSymbolChar(c)) 31 | return true; 32 | } 33 | return false; 34 | } 35 | 36 | /// Translate the given operator character into its mangled form. 37 | /// 38 | /// Current operator characters: @/=-+*%<>!&|^~ and the special operator '..' 39 | char Mangle::translateOperatorChar(char op) { 40 | switch (op) { 41 | case '&': return 'a'; // 'and' 42 | case '@': return 'c'; // 'commercial at sign' 43 | case '/': return 'd'; // 'divide' 44 | case '=': return 'e'; // 'equal' 45 | case '>': return 'g'; // 'greater' 46 | case '<': return 'l'; // 'less' 47 | case '*': return 'm'; // 'multiply' 48 | case '!': return 'n'; // 'negate' 49 | case '|': return 'o'; // 'or' 50 | case '+': return 'p'; // 'plus' 51 | case '?': return 'q'; // 'question' 52 | case '%': return 'r'; // 'remainder' 53 | case '-': return 's'; // 'subtract' 54 | case '~': return 't'; // 'tilde' 55 | case '^': return 'x'; // 'xor' 56 | case '.': return 'z'; // 'zperiod' (the z is silent) 57 | default: 58 | return op; 59 | } 60 | } 61 | 62 | std::string Mangle::translateOperator(StringRef Op) { 63 | std::string Encoded; 64 | for (char ch : Op) { 65 | Encoded.push_back(translateOperatorChar(ch)); 66 | } 67 | return Encoded; 68 | } 69 | 70 | std::optional 71 | Mangle::getStandardTypeSubst(StringRef TypeName, 72 | bool allowConcurrencyManglings) { 73 | #define STANDARD_TYPE(KIND, MANGLING, TYPENAME) \ 74 | if (TypeName == #TYPENAME) { \ 75 | return StringRef(#MANGLING); \ 76 | } 77 | 78 | #define STANDARD_TYPE_CONCURRENCY(KIND, MANGLING, TYPENAME) \ 79 | if (allowConcurrencyManglings && TypeName == #TYPENAME) { \ 80 | return StringRef("c" #MANGLING); \ 81 | } 82 | 83 | #include "swift/Demangling/StandardTypesMangling.def" 84 | 85 | return std::nullopt; 86 | } 87 | -------------------------------------------------------------------------------- /symbolic-debuginfo/benches/breakpad_parser.rs: -------------------------------------------------------------------------------- 1 | use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion}; 2 | 3 | use symbolic_common::ByteView; 4 | use symbolic_debuginfo::breakpad::{BreakpadObject, BreakpadStackRecord}; 5 | use symbolic_testutils::fixture; 6 | 7 | pub fn breakpad_parser(c: &mut Criterion) { 8 | let mut group = c.benchmark_group("Breakpad parser benchmarks"); 9 | 10 | for file in ["linux/crash.sym", "macos/crash.sym", "windows/crash.sym"].iter() { 11 | let view = ByteView::open(fixture(file)).unwrap(); 12 | let object: BreakpadObject = BreakpadObject::parse(&view).unwrap(); 13 | 14 | group.bench_with_input( 15 | BenchmarkId::new("info records", file), 16 | &object, 17 | |b, object| { 18 | b.iter(|| { 19 | for record in object.info_records() { 20 | record.unwrap(); 21 | } 22 | }) 23 | }, 24 | ); 25 | 26 | group.bench_with_input( 27 | BenchmarkId::new("func and line records", file), 28 | &object, 29 | |b, object| { 30 | b.iter(|| { 31 | for record in object.func_records() { 32 | for line in record.unwrap().lines() { 33 | line.unwrap(); 34 | } 35 | } 36 | }) 37 | }, 38 | ); 39 | 40 | group.bench_with_input( 41 | BenchmarkId::new("public records", file), 42 | &object, 43 | |b, object| { 44 | b.iter(|| { 45 | for record in object.public_records() { 46 | record.unwrap(); 47 | } 48 | }) 49 | }, 50 | ); 51 | 52 | group.bench_with_input( 53 | BenchmarkId::new("file records", file), 54 | &object, 55 | |b, object| { 56 | b.iter(|| { 57 | for record in object.file_records() { 58 | record.unwrap(); 59 | } 60 | }) 61 | }, 62 | ); 63 | 64 | group.bench_with_input( 65 | BenchmarkId::new("stack records", file), 66 | &object, 67 | |b, object| { 68 | b.iter(|| { 69 | for record in object.stack_records() { 70 | if let BreakpadStackRecord::Cfi(cfi_record) = record.unwrap() { 71 | for delta in cfi_record.deltas() { 72 | delta.unwrap(); 73 | } 74 | } 75 | } 76 | }) 77 | }, 78 | ); 79 | } 80 | 81 | group.finish(); 82 | } 83 | 84 | criterion_group!(benches, breakpad_parser); 85 | criterion_main!(benches); 86 | -------------------------------------------------------------------------------- /symbolic-ppdb/tests/test_caches.rs: -------------------------------------------------------------------------------- 1 | use symbolic_common::Language; 2 | use symbolic_ppdb::LineInfo; 3 | use symbolic_ppdb::PortablePdb; 4 | use symbolic_ppdb::PortablePdbCache; 5 | use symbolic_ppdb::PortablePdbCacheConverter; 6 | use symbolic_testutils::fixture; 7 | 8 | #[test] 9 | fn test_documents() { 10 | let buf = std::fs::read("tests/fixtures/Documents.pdbx").unwrap(); 11 | 12 | let pdb = PortablePdb::parse(&buf).unwrap(); 13 | 14 | let mut converter = PortablePdbCacheConverter::new(); 15 | converter.process_portable_pdb(&pdb).unwrap(); 16 | let mut buf = Vec::new(); 17 | converter.serialize(&mut buf).unwrap(); 18 | 19 | let _cache = PortablePdbCache::parse(&buf).unwrap(); 20 | } 21 | 22 | #[test] 23 | fn test_async() { 24 | let buf = std::fs::read("tests/fixtures/Async.pdbx").unwrap(); 25 | 26 | let pdb = PortablePdb::parse(&buf).unwrap(); 27 | 28 | let mut converter = PortablePdbCacheConverter::new(); 29 | converter.process_portable_pdb(&pdb).unwrap(); 30 | let mut buf = Vec::new(); 31 | converter.serialize(&mut buf).unwrap(); 32 | 33 | let _cache = PortablePdbCache::parse(&buf).unwrap(); 34 | } 35 | 36 | #[test] 37 | fn test_integration() { 38 | let buf = std::fs::read(fixture("windows/portable.pdb")).unwrap(); 39 | 40 | let pdb = PortablePdb::parse(&buf).unwrap(); 41 | 42 | let mut converter = PortablePdbCacheConverter::new(); 43 | converter.process_portable_pdb(&pdb).unwrap(); 44 | let mut buf = Vec::new(); 45 | converter.serialize(&mut buf).unwrap(); 46 | 47 | let cache = PortablePdbCache::parse(&buf).unwrap(); 48 | 49 | assert_eq!( 50 | cache.lookup(7, 10), 51 | Some(LineInfo { 52 | line: 81, 53 | file_name: "/Users/swatinem/Coding/sentry-dotnet/samples/foo/Program.cs", 54 | file_lang: Language::CSharp 55 | }) 56 | ); 57 | 58 | assert_eq!( 59 | cache.lookup(5, 6), 60 | Some(LineInfo { 61 | line: 37, 62 | file_name: "/Users/swatinem/Coding/sentry-dotnet/samples/foo/Program.cs", 63 | file_lang: Language::CSharp 64 | }) 65 | ); 66 | 67 | assert_eq!( 68 | cache.lookup(3, 0), 69 | Some(LineInfo { 70 | line: 30, 71 | file_name: "/Users/swatinem/Coding/sentry-dotnet/samples/foo/Program.cs", 72 | file_lang: Language::CSharp 73 | }) 74 | ); 75 | 76 | assert_eq!( 77 | cache.lookup(2, 0), 78 | Some(LineInfo { 79 | line: 25, 80 | file_name: "/Users/swatinem/Coding/sentry-dotnet/samples/foo/Program.cs", 81 | file_lang: Language::CSharp 82 | }) 83 | ); 84 | 85 | assert_eq!( 86 | cache.lookup(1, 45), 87 | Some(LineInfo { 88 | line: 20, 89 | file_name: "/Users/swatinem/Coding/sentry-dotnet/samples/foo/Program.cs", 90 | file_lang: Language::CSharp 91 | }) 92 | ); 93 | } 94 | -------------------------------------------------------------------------------- /symbolic-testutils/fixtures/sourcemapcache/old-logs/simple.safari.log: -------------------------------------------------------------------------------- 1 | # sync stack trace 2 | objectLiteralAnon@file:///Users/swatinem/Coding/js-source-scopes/tests/fixtures/simple.js:28:46 3 | objectLiteralMethod@file:///Users/swatinem/Coding/js-source-scopes/tests/fixtures/simple.js:27:49 4 | globalAssign@file:///Users/swatinem/Coding/js-source-scopes/tests/fixtures/simple.js:24:46 5 | @file:///Users/swatinem/Coding/js-source-scopes/tests/fixtures/simple.js:22:40 6 | #privateMethod@file:///Users/swatinem/Coding/js-source-scopes/tests/fixtures/simple.js:18:43 7 | classMethod@file:///Users/swatinem/Coding/js-source-scopes/tests/fixtures/simple.js:16:39 8 | Klass@file:///Users/swatinem/Coding/js-source-scopes/tests/fixtures/simple.js:14:36 9 | staticMethod@file:///Users/swatinem/Coding/js-source-scopes/tests/fixtures/simple.js:12:37 10 | arrowFn@file:///Users/swatinem/Coding/js-source-scopes/tests/fixtures/simple.js:9:43 11 | anonFn@file:///Users/swatinem/Coding/js-source-scopes/tests/fixtures/simple.js:7:36 12 | namedFnExpr@file:///Users/swatinem/Coding/js-source-scopes/tests/fixtures/simple.js:5:48 13 | namedFn@file:///Users/swatinem/Coding/js-source-scopes/tests/fixtures/simple.js:3:29 14 | global code@file:///Users/swatinem/Coding/js-source-scopes/tests/fixtures/simple.js:60:12 15 | 16 | # async stack trace 17 | @file:///Users/swatinem/Coding/js-source-scopes/tests/fixtures/simple.js:50:57 18 | asyncFunctionResume@[native code] 19 | asyncObjectLiteralAnon@file:///Users/swatinem/Coding/js-source-scopes/tests/fixtures/simple.js:50:61 20 | @file:///Users/swatinem/Coding/js-source-scopes/tests/fixtures/simple.js:49:76 21 | asyncFunctionResume@[native code] 22 | asyncObjectLiteralMethod@file:///Users/swatinem/Coding/js-source-scopes/tests/fixtures/simple.js:49:80 23 | @file:///Users/swatinem/Coding/js-source-scopes/tests/fixtures/simple.js:45:98 24 | asyncFunctionResume@[native code] 25 | @file:///Users/swatinem/Coding/js-source-scopes/tests/fixtures/simple.js:45:102 26 | @file:///Users/swatinem/Coding/js-source-scopes/tests/fixtures/simple.js:42:61 27 | asyncFunctionResume@[native code] 28 | @file:///Users/swatinem/Coding/js-source-scopes/tests/fixtures/simple.js:41:61 29 | asyncFunctionResume@[native code] 30 | @file:///Users/swatinem/Coding/js-source-scopes/tests/fixtures/simple.js:39:33 31 | asyncFunctionResume@[native code] 32 | @file:///Users/swatinem/Coding/js-source-scopes/tests/fixtures/simple.js:34:69 33 | asyncFunctionResume@[native code] 34 | asyncArrowFn@file:///Users/swatinem/Coding/js-source-scopes/tests/fixtures/simple.js:34:73 35 | @file:///Users/swatinem/Coding/js-source-scopes/tests/fixtures/simple.js:33:50 36 | asyncFunctionResume@[native code] 37 | asyncNamedFn@file:///Users/swatinem/Coding/js-source-scopes/tests/fixtures/simple.js:33:54 38 | @file:///Users/swatinem/Coding/js-source-scopes/tests/fixtures/simple.js:69:27 39 | asyncFunctionResume@[native code] 40 | asyncMain@file:///Users/swatinem/Coding/js-source-scopes/tests/fixtures/simple.js:66:26 41 | global code@file:///Users/swatinem/Coding/js-source-scopes/tests/fixtures/simple.js:76:10 -------------------------------------------------------------------------------- /symbolic-demangle/vendor/swift/include/llvm/ADT/STLFunctionalExtras.h: -------------------------------------------------------------------------------- 1 | //===- llvm/ADT/STLFunctionalExtras.h - Extras for -*- C++ -*-===// 2 | // 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 | // See https://llvm.org/LICENSE.txt for license information. 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 | // 7 | //===----------------------------------------------------------------------===// 8 | // 9 | // This file contains some extension to . 10 | // 11 | // No library is required when using these functions. 12 | // 13 | //===----------------------------------------------------------------------===// 14 | 15 | #ifndef LLVM_ADT_STLFUNCTIONALEXTRAS_H 16 | #define LLVM_ADT_STLFUNCTIONALEXTRAS_H 17 | 18 | #include "llvm/ADT/STLForwardCompat.h" 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | namespace llvm { 25 | 26 | //===----------------------------------------------------------------------===// 27 | // Extra additions to 28 | //===----------------------------------------------------------------------===// 29 | 30 | /// An efficient, type-erasing, non-owning reference to a callable. This is 31 | /// intended for use as the type of a function parameter that is not used 32 | /// after the function in question returns. 33 | /// 34 | /// This class does not own the callable, so it is not in general safe to store 35 | /// a function_ref. 36 | template class function_ref; 37 | 38 | template 39 | class function_ref { 40 | Ret (*callback)(intptr_t callable, Params ...params) = nullptr; 41 | intptr_t callable; 42 | 43 | template 44 | static Ret callback_fn(intptr_t callable, Params ...params) { 45 | return (*reinterpret_cast(callable))( 46 | std::forward(params)...); 47 | } 48 | 49 | public: 50 | function_ref() = default; 51 | function_ref(std::nullptr_t) {} 52 | 53 | template 54 | function_ref( 55 | Callable &&callable, 56 | // This is not the copy-constructor. 57 | std::enable_if_t, 58 | function_ref>::value> * = nullptr, 59 | // Functor must be callable and return a suitable type. 60 | std::enable_if_t::value || 61 | std::is_convertible()( 62 | std::declval()...)), 63 | Ret>::value> * = nullptr) 64 | : callback(callback_fn>), 65 | callable(reinterpret_cast(&callable)) {} 66 | 67 | Ret operator()(Params ...params) const { 68 | return callback(callable, std::forward(params)...); 69 | } 70 | 71 | explicit operator bool() const { return callback; } 72 | }; 73 | 74 | } // end namespace llvm 75 | 76 | #endif // LLVM_ADT_STLFUNCTIONALEXTRAS_H 77 | -------------------------------------------------------------------------------- /symbolic/README.md: -------------------------------------------------------------------------------- 1 | [![Build Status](https://travis-ci.org/getsentry/symbolic.svg?branch=master)](https://travis-ci.org/getsentry/symbolic) 2 | 3 | # symbolic 4 | 5 | [Symbolic](https://docs.rs/symbolic) is a library written in Rust which is used at 6 | [Sentry](https://sentry.io/) to implement symbolication of native stack traces, sourcemap 7 | handling for minified JavaScript and more. It consists of multiple largely independent crates 8 | which are bundled together into a C and Python library so it can be used independently of Rust. 9 | 10 | ## What's in the package 11 | 12 | Symbolic provides the following functionality: 13 | 14 | - Symbolication based on custom cache files (symcache) 15 | - Symbol cache file generators from: 16 | - Mach, ELF and PE symbol tables 17 | - Mach and ELF embedded DWARF data 18 | - PDB CodeView debug information 19 | - Breakpad symbol files 20 | - Demangling support 21 | - C++ (GCC, clang and MSVC) 22 | - Objective C / Objective C++ 23 | - Rust 24 | - Swift 25 | - JavaScript sourcemap expansion 26 | - Basic token mapping 27 | - Heuristics to find original function names based on minified sources 28 | - Indexed sourcemap to sourcemap merging 29 | - Minidump / Breakpad processing 30 | - Generate Breakpad symbol files from Mach, ELF and PDBs 31 | - Process Minidumps to retrieve stack traces 32 | - Convenient C and Python library 33 | - Processing of Unreal Engine 4 native crash reports 34 | - Extract and process minidumps 35 | - Expose logs and UE4 context information 36 | 37 | ## Usage 38 | 39 | Add `symbolic` as a dependency to your `Cargo.toml`. You will most likely want to activate some 40 | of the features: 41 | 42 | - **`debuginfo`** (default): Contains support for various object file formats and debugging 43 | information. Currently, this comprises MachO and ELF (with DWARF debugging), PE and PDB, as 44 | well as Breakpad symbols. 45 | - **`demangle`**: Demangling for Rust, C++, Swift and Objective C symbols. This feature requires 46 | a C++14 compiler on the PATH. 47 | - **`minidump`**: Rust bindings for the Breakpad Minidump processor. Additionally, this includes 48 | facilities to extract stack unwinding information (sometimes called CFI) from object files. 49 | This feature requires a C++11 compiler on the PATH. 50 | - **`sourcemap`**: Processing and expansion of JavaScript source maps, as well as lookups for 51 | minified function names. 52 | - **`symcache`**: An optimized, platform-independent storage for common debugging information. 53 | This allows blazing fast symbolication of instruction addresses to function names and file 54 | locations. 55 | - **`unreal`**: Processing of Unreal Engine 4 crash reports. 56 | 57 | There are also alternate versions for some of the above features that additionally add 58 | implementations for `serde::{Deserialize, Serialize}` on suitable types: 59 | 60 | - **`common-serde`** 61 | - **`debuginfo-serde`** 62 | - **`minidump-serde`** 63 | - **`unreal-serde`** 64 | 65 | ## Minimal Rust Version 66 | 67 | This crate is known to require at least Rust 1.41. 68 | 69 | License: MIT 70 | -------------------------------------------------------------------------------- /symbolic-debuginfo/fuzz/fuzz_targets/fuzz_objects.rs: -------------------------------------------------------------------------------- 1 | #![no_main] 2 | 3 | // cargo +nightly fuzz run fuzz_objects -j 12 -- -max_len=16777216 # 16M 4 | libfuzzer_sys::fuzz_target!(|data| { 5 | if let Ok(arc) = symbolic_debuginfo::Archive::parse(&data) { 6 | let _ = arc.file_format(); 7 | let num_objects = arc.object_count(); 8 | 9 | for idx in 0..num_objects { 10 | if let Ok(Some(obj)) = arc.object_by_index(idx) { 11 | test_object(obj); 12 | } 13 | } 14 | 15 | // we test both random access, and iteration 16 | for obj in arc.objects() { 17 | if let Ok(obj) = obj { 18 | test_object(obj); 19 | } 20 | } 21 | } 22 | }); 23 | 24 | fn test_object(obj: symbolic_debuginfo::Object) { 25 | let _ = obj.file_format(); 26 | let _ = obj.code_id(); 27 | let _ = obj.debug_id(); 28 | let _ = obj.arch(); 29 | let _ = obj.kind(); 30 | let _ = obj.load_address(); 31 | let _ = obj.has_symbols(); 32 | let _ = obj.has_debug_info(); 33 | let _ = obj.has_unwind_info(); 34 | let _ = obj.has_sources(); 35 | let _ = obj.is_malformed(); 36 | 37 | let _ = obj.symbol_map(); 38 | // the `symbol_map` already exhausts the `symbols` iterator 39 | // let mut symbols = obj.symbols(); 40 | 41 | if let Ok(session) = obj.debug_session() { 42 | for _ in session.functions() {} 43 | for _ in session.files() {} 44 | } 45 | } 46 | 47 | const MH_MAGIC: &[u8] = &0xfeed_face_u32.to_be_bytes(); 48 | const MH_MAGIC_64: &[u8] = &0xfeed_facf_u32.to_be_bytes(); 49 | const MH_MAGIC_LE: &[u8] = &0xfeed_face_u32.to_le_bytes(); 50 | const MH_MAGIC_64_LE: &[u8] = &0xfeed_facf_u32.to_le_bytes(); 51 | const FAT_MAGIC: &[u8] = &0xcafe_babe_u32.to_be_bytes(); 52 | const FAT_MAGIC_LE: &[u8] = &0xcafe_babe_u32.to_le_bytes(); 53 | const WASM_MAGIC: &[u8] = b"\x00asm"; 54 | const BREAKPAD_MAGIC: &[u8] = b"MODULE "; 55 | const SOURCEBUNDLE_MAGIC: &[u8] = b"SYSB"; 56 | const PDB_MAGIC: &[u8] = b"Microsoft C/C++ MSF 7.00\r\n\x1a\x44\x53\x00\x00\x00"; 57 | const PE_MAGIC: &[u8] = &0x5a4d_u16.to_le_bytes(); 58 | const ELF_MAGIC: &[u8] = b"\x7FELF"; 59 | 60 | // This mutator makes sure we always have a valid file magic. 61 | libfuzzer_sys::fuzz_mutator!(|data: &mut [u8], size: usize, max_size: usize, seed: u32| { 62 | let new_size = libfuzzer_sys::fuzzer_mutate(data, size, max_size); 63 | 64 | let magic = match seed % 12 { 65 | // mach-o 66 | 0 => MH_MAGIC, 67 | 1 => MH_MAGIC_64, 68 | 2 => MH_MAGIC_LE, 69 | 3 => MH_MAGIC_64_LE, 70 | // fat mach-o 71 | 4 => FAT_MAGIC, 72 | 5 => FAT_MAGIC_LE, 73 | // wasm 74 | 6 => WASM_MAGIC, 75 | // breakpad 76 | 7 => BREAKPAD_MAGIC, 77 | // source bundle 78 | 8 => SOURCEBUNDLE_MAGIC, 79 | // pdb 80 | 9 => PDB_MAGIC, 81 | // pe 82 | 10 => PE_MAGIC, 83 | // elf 84 | _ => ELF_MAGIC, 85 | }; 86 | let len = magic.len().min(data.len()); 87 | data[..len].copy_from_slice(&magic[..len]); 88 | 89 | new_size 90 | }); 91 | -------------------------------------------------------------------------------- /symbolic-ppdb/src/lib.rs: -------------------------------------------------------------------------------- 1 | //! Provides support for reading Portable PDB files, 2 | //! specifically line information resolution for functions. 3 | //! 4 | //! [Portable PDB](https://github.com/dotnet/runtime/blob/main/docs/design/specs/PortablePdb-Metadata.md) 5 | //! is a debugging information file format for Common Language Infrastructure (CLI) languages. 6 | //! It is an extension of the [ECMA-335 format](https://www.ecma-international.org/wp-content/uploads/ECMA-335_6th_edition_june_2012.pdf). 7 | //! 8 | //! # Functionality 9 | //! 10 | //! * Parse Portable PDB files with [`PortablePdb::parse`]. 11 | //! * Convert Portable PDB files to [`PortablePdbCaches`](PortablePdbCache) with 12 | //! [`PortablePdbCacheConverter::process_portable_pdb`]. 13 | //! * Serialize `PortablePdbCaches` with [`PortablePdbCacheConverter::serialize`] 14 | //! and parse them with [`PortablePdbCache::parse`]. 15 | //! * Look up line information for a function on a `PortablePdbCache` with 16 | //! [`PortablePdbCache::lookup`]. 17 | //! 18 | //! ## Example 19 | //! ``` 20 | //! use symbolic_testutils::fixture; 21 | //! use symbolic_ppdb::{LineInfo, PortablePdb, PortablePdbCacheConverter, PortablePdbCache}; 22 | //! 23 | //! let buf = std::fs::read(fixture("windows/portable.pdb")).unwrap(); 24 | //! let pdb = PortablePdb::parse(&buf).unwrap(); 25 | //! 26 | //! let mut converter = PortablePdbCacheConverter::new(); 27 | //! converter.process_portable_pdb(&pdb).unwrap(); 28 | //! let mut buf = Vec::new(); 29 | //! converter.serialize(&mut buf).unwrap(); 30 | //! 31 | //! let cache = PortablePdbCache::parse(&buf).unwrap(); 32 | //! let line_info = cache.lookup(7, 10).unwrap(); 33 | //! assert_eq!(line_info.line, 81); 34 | //! ``` 35 | //! 36 | //! # Structure of a Portable PDB file 37 | //! 38 | //! An ECMA-335 file is divided into sections called _streams_. The possible streams are: 39 | //! 40 | //! * `#~` ("metadata"), comprising information about classes, methods, modules, &c., 41 | //! organized into tables adhering to various schemas. The original ECMA-335 tables 42 | //! are described in Section II.22 of the ECMA-335 spec, the tables added by Portable PDB are described 43 | //! in the Portable PDB spec. 44 | //! The [`MethodDebugInformation`](https://github.com/dotnet/runtime/blob/main/docs/design/specs/PortablePdb-Metadata.md#methoddebuginformation-table-0x31) 45 | //! table is of particular interest to `symbolic`, as it contains 46 | //! line information for functions. 47 | //! * `#Strings`, comprising null-terminated UTF-8 strings. 48 | //! * `#GUID`, a list of GUIDs. 49 | //! * `#US` ("user strings"), comprising UTF-16 encoded strings. 50 | //! * `#Blob`, comprising blobs of data that don't fit in any of the other streams. 51 | //! 52 | //! The Portable PDB format extends ECMA-335 by the addition of another steam, `#PDB`, as well 53 | //! as several tables to the `#~` stream. 54 | 55 | #![warn(missing_docs)] 56 | 57 | mod cache; 58 | mod format; 59 | 60 | pub use cache::lookup::LineInfo; 61 | pub use cache::writer::PortablePdbCacheConverter; 62 | pub use cache::{CacheError, CacheErrorKind, PortablePdbCache}; 63 | pub use format::{Document, EmbeddedSource, FormatError, FormatErrorKind, PortablePdb}; 64 | -------------------------------------------------------------------------------- /symbolic-cfi/tests/snapshots/test_cfi__cfi_pe_windows.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: symbolic-cfi/tests/test_cfi.rs 3 | expression: cfi 4 | --- 5 | STACK CFI INIT 1010 55 .cfa: $rsp 80 + $rbx: .cfa 16 - ^ $rsi: .cfa 24 - ^ $rdi: .cfa 32 - ^ .ra: .cfa 8 - ^ 6 | STACK CFI INIT 10b0 43 .cfa: $rsp 48 + $rdi: .cfa 16 - ^ $rbx: .cfa 0 - ^ .ra: .cfa 8 - ^ 7 | STACK CFI INIT 1120 2d .cfa: $rsp 48 + .ra: .cfa 8 - ^ 8 | STACK CFI INIT 1150 18 .cfa: $rsp 64 + .ra: .cfa 8 - ^ 9 | STACK CFI INIT 1170 a .cfa: $rsp 48 + .ra: .cfa 8 - ^ 10 | STACK CFI INIT 1190 21 .cfa: $rsp 8 + .ra: .cfa 8 - ^ 11 | STACK CFI INIT 11bc 3c .cfa: $rsp 48 + $rbx: .cfa 16 - ^ .ra: .cfa 8 - ^ 12 | STACK CFI INIT 11f8 2b .cfa: $rsp 48 + $rbx: .cfa 16 - ^ .ra: .cfa 8 - ^ 13 | STACK CFI INIT 1224 b7 .cfa: $rsp 48 + $rbx: .cfa 16 - ^ .ra: .cfa 8 - ^ 14 | STACK CFI INIT 12dc 10 .cfa: $rsp 48 + .ra: .cfa 8 - ^ 15 | STACK CFI INIT 12ec 19 .cfa: $rsp 48 + .ra: .cfa 8 - ^ 16 | STACK CFI INIT 1308 17c .cfa: $rsp 64 + $rdi: .cfa 16 - ^ $rbx: .cfa 0 - ^ $rsi: .cfa -8 - ^ .ra: .cfa 8 - ^ 17 | STACK CFI INIT 1484 12 .cfa: $rsp 48 + .ra: .cfa 8 - ^ 18 | STACK CFI INIT 1498 34 .cfa: $rsp 48 + $rbx: .cfa 16 - ^ .ra: .cfa 8 - ^ 19 | STACK CFI INIT 14cc d1 .cfa: $rsp 64 + .ra: .cfa 8 - ^ 20 | STACK CFI INIT 15a0 71 .cfa: $rsp 96 + $rbx: .cfa 16 - ^ $rsi: .cfa 24 - ^ $rdi: .cfa 32 - ^ .ra: .cfa 8 - ^ 21 | STACK CFI INIT 161c 3f .cfa: $rsp 48 + $rbx: .cfa 16 - ^ .ra: .cfa 8 - ^ 22 | STACK CFI INIT 167c 3f .cfa: $rsp 48 + $rbx: .cfa 16 - ^ .ra: .cfa 8 - ^ 23 | STACK CFI INIT 16dc 35 .cfa: $rsp 48 + $rbx: .cfa 16 - ^ .ra: .cfa 8 - ^ 24 | STACK CFI INIT 1728 42 .cfa: $rsp 48 + $rdi: .cfa 16 - ^ $rbx: .cfa 0 - ^ .ra: .cfa 8 - ^ 25 | STACK CFI INIT 176c 20 .cfa: $rsp 80 + .ra: .cfa 8 - ^ 26 | STACK CFI INIT 178c 20 .cfa: $rsp 80 + .ra: .cfa 8 - ^ 27 | STACK CFI INIT 17ac 39 .cfa: $rsp 48 + .ra: .cfa 8 - ^ 28 | STACK CFI INIT 17e8 49 .cfa: $rsp 48 + $rbx: .cfa 16 - ^ .ra: .cfa 8 - ^ 29 | STACK CFI INIT 1834 d8 .cfa: $rsp 80 + $rbx: .cfa 16 - ^ .ra: .cfa 8 - ^ 30 | STACK CFI INIT 190c 99 .cfa: $rsp 32 + .ra: .cfa 8 - ^ 31 | STACK CFI INIT 19a8 24 .cfa: $rsp 48 + $rbx: .cfa 16 - ^ .ra: .cfa 8 - ^ 32 | STACK CFI INIT 19cc 2b .cfa: $rsp 48 + $rbx: .cfa 16 - ^ .ra: .cfa 8 - ^ 33 | STACK CFI INIT 19f8 4f .cfa: $rsp 48 + $rbx: .cfa 16 - ^ .ra: .cfa 8 - ^ 34 | STACK CFI INIT 1a48 17 .cfa: $rsp 48 + .ra: .cfa 8 - ^ 35 | STACK CFI INIT 1a60 ac .cfa: $rsp 48 + $rbp: .cfa 16 - ^ $rbx: .cfa -24 - ^ .ra: .cfa 8 - ^ 36 | STACK CFI INIT 1b40 1b .cfa: $rsp 48 + .ra: .cfa 8 - ^ 37 | STACK CFI INIT 1b80 14a .cfa: $rsp 1488 + $rbp: .cfa 16 - ^ $rbx: .cfa 0 - ^ .ra: .cfa 8 - ^ 38 | STACK CFI INIT 1cd4 52 .cfa: $rsp 48 + .ra: .cfa 8 - ^ 39 | STACK CFI INIT 1d38 38 .cfa: $rsp 48 + .ra: .cfa 8 - ^ 40 | STACK CFI INIT 1d70 3c .cfa: $rsp 48 + $rdi: .cfa 16 - ^ $rbx: .cfa 0 - ^ .ra: .cfa 8 - ^ 41 | STACK CFI INIT 1dac 3c .cfa: $rsp 48 + $rdi: .cfa 16 - ^ $rbx: .cfa 0 - ^ .ra: .cfa 8 - ^ 42 | STACK CFI INIT 1de8 1b9 .cfa: $rsp 48 + $rsi: .cfa 16 - ^ $rdi: .cfa 24 - ^ $r14: .cfa 32 - ^ $rbx: .cfa -8 - ^ $rbp: .cfa -16 - ^ .ra: .cfa 8 - ^ 43 | STACK CFI INIT 2090 2 .cfa: $rsp 8 + .ra: .cfa 8 - ^ 44 | STACK CFI INIT 20ac 1e .cfa: $rsp 48 + $rbp: .cfa 16 - ^ .ra: .cfa 8 - ^ 45 | STACK CFI INIT 20ca 18 .cfa: $rsp 16 + $rbp: .cfa 16 - ^ .ra: .cfa 8 - ^ 46 | -------------------------------------------------------------------------------- /symbolic-ppdb/src/cache/raw.rs: -------------------------------------------------------------------------------- 1 | use symbolic_common::DebugId; 2 | use watto::Pod; 3 | 4 | /// The magic file preamble as individual bytes. 5 | const PPDBCACHE_MAGIC_BYTES: [u8; 4] = *b"PDBC"; 6 | 7 | /// The magic file preamble to identify PortablePdbCache files. 8 | /// 9 | /// Serialized as ASCII "PDBC" on little-endian (x64) systems. 10 | pub(crate) const PPDBCACHE_MAGIC: u32 = u32::from_le_bytes(PPDBCACHE_MAGIC_BYTES); 11 | /// The byte-flipped magic, which indicates an endianness mismatch. 12 | pub(crate) const PPDBCACHE_MAGIC_FLIPPED: u32 = PPDBCACHE_MAGIC.swap_bytes(); 13 | 14 | /// The header of a PortablePdbCache file. 15 | #[derive(Debug, Clone, PartialEq, Eq)] 16 | #[repr(C)] 17 | pub(crate) struct Header { 18 | /// The file magic representing the file format and endianness. 19 | pub(crate) magic: u32, 20 | /// The PortablePdbCache format version. 21 | pub(crate) version: u32, 22 | /// A byte sequence uniquely representing the debugging metadata blob content. 23 | pub(crate) pdb_id: DebugId, 24 | /// The number of files contained in the cache file. 25 | pub(crate) num_files: u32, 26 | /// The number of ranges/source locations contained in the cache file. 27 | pub(crate) num_ranges: u32, 28 | /// Total number of bytes used for string data. 29 | pub(crate) string_bytes: u32, 30 | /// Some reserved space in the header for future extensions that would not require a 31 | /// completely new parsing method. 32 | pub(crate) _reserved: [u8; 16], 33 | } 34 | 35 | /// A location in a source file, comprising a line and the index of a file. 36 | #[derive(Debug, Clone, Copy, PartialEq, Eq)] 37 | #[repr(C)] 38 | pub(crate) struct SourceLocation { 39 | pub(crate) line: u32, 40 | pub(crate) file_idx: u32, 41 | } 42 | 43 | /// A range of IL offsets in a function. 44 | /// 45 | /// Only the starting IL offset is saved; the ending offset is given implicitly by 46 | /// the starting offset of the next range (if any). 47 | #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] 48 | #[repr(C)] 49 | pub(crate) struct Range { 50 | pub(crate) func_idx: u32, 51 | pub(crate) il_offset: u32, 52 | } 53 | 54 | /// Serialized file in the cache. 55 | #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] 56 | #[repr(C)] 57 | pub(crate) struct File { 58 | /// The file path (reference to a [`String`]). 59 | pub(crate) name_offset: u32, 60 | /// The file's source language. 61 | pub(crate) lang: u32, 62 | } 63 | 64 | unsafe impl Pod for Header {} 65 | unsafe impl Pod for SourceLocation {} 66 | unsafe impl Pod for Range {} 67 | unsafe impl Pod for File {} 68 | 69 | #[cfg(test)] 70 | mod tests { 71 | use std::mem; 72 | 73 | use super::*; 74 | 75 | #[test] 76 | fn test_sizeof() { 77 | assert_eq!(mem::size_of::
(), 68); 78 | assert_eq!(mem::align_of::
(), 4); 79 | 80 | assert_eq!(mem::size_of::(), 8); 81 | assert_eq!(mem::align_of::(), 4); 82 | 83 | assert_eq!(mem::size_of::(), 8); 84 | assert_eq!(mem::align_of::(), 4); 85 | 86 | assert_eq!(mem::size_of::(), 8); 87 | assert_eq!(mem::align_of::(), 4); 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /symbolic-demangle/vendor/swift/lib/Demangling/DemanglerAssert.h: -------------------------------------------------------------------------------- 1 | //===--- DemanglerAssert.h - Assertions for de/re-mangling ------*- C++ -*-===// 2 | // 3 | // This source file is part of the Swift.org open source project 4 | // 5 | // Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors 6 | // Licensed under Apache License v2.0 with Runtime Library Exception 7 | // 8 | // See https://swift.org/LICENSE.txt for license information 9 | // See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors 10 | // 11 | //===----------------------------------------------------------------------===// 12 | // 13 | // This file implements a macro, DEMANGLE_ASSERT(), which will assert in the 14 | // compiler, but in the runtime will return a ManglingError on failure. 15 | // 16 | //===----------------------------------------------------------------------===// 17 | 18 | #ifndef SWIFT_DEMANGLING_ASSERT_H 19 | #define SWIFT_DEMANGLING_ASSERT_H 20 | 21 | #include "llvm/Support/Compiler.h" 22 | #include "swift/Demangling/Demangle.h" 23 | #include "swift/Demangling/NamespaceMacros.h" 24 | 25 | #if defined(NDEBUG) || defined (SWIFT_RUNTIME) 26 | 27 | // In the runtime and non-asserts builds, DEMANGLER_ASSERT() returns an error. 28 | #define DEMANGLER_ASSERT(expr, node) \ 29 | do { \ 30 | if (!(expr)) \ 31 | return ManglingError(ManglingError::AssertionFailed, (node), __LINE__); \ 32 | } while (0) 33 | 34 | #else 35 | 36 | // Except in unittests, assert builds cause DEMANGLER_ASSERT() to assert() 37 | #define DEMANGLER_ASSERT(expr, node) \ 38 | do { \ 39 | if (!(expr)) { \ 40 | if (Factory.disableAssertionsForUnitTest) \ 41 | return ManglingError(ManglingError::AssertionFailed, (node), \ 42 | __LINE__); \ 43 | else \ 44 | swift::Demangle::failAssert(__FILE__, __LINE__, node, #expr); \ 45 | } \ 46 | } while (0) 47 | 48 | #endif 49 | 50 | // DEMANGLER_ALWAYS_ASSERT() *always* fails the program, even in the runtime 51 | #define DEMANGLER_ALWAYS_ASSERT(expr, node) \ 52 | do { \ 53 | if (!(expr)) \ 54 | swift::Demangle::failAssert(__FILE__, __LINE__, node, #expr); \ 55 | } while (0) 56 | 57 | namespace swift { 58 | namespace Demangle { 59 | SWIFT_BEGIN_INLINE_NAMESPACE 60 | 61 | [[noreturn]] void failAssert(const char *file, unsigned line, NodePointer node, 62 | const char *expr); 63 | 64 | SWIFT_END_INLINE_NAMESPACE 65 | } // end namespace Demangle 66 | } // end namespace swift 67 | 68 | #endif // SWIFT_DEMANGLING_ASSERT_H 69 | -------------------------------------------------------------------------------- /symbolic-demangle/vendor/swift/include/llvm-c/DataTypes.h: -------------------------------------------------------------------------------- 1 | /*===-- include/llvm-c/DataTypes.h - Define fixed size types ------*- C -*-===*\ 2 | |* *| 3 | |* Part of the LLVM Project, under the Apache License v2.0 with LLVM *| 4 | |* Exceptions. *| 5 | |* See https://llvm.org/LICENSE.txt for license information. *| 6 | |* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *| 7 | |* *| 8 | |*===----------------------------------------------------------------------===*| 9 | |* *| 10 | |* This file contains definitions to figure out the size of _HOST_ data types.*| 11 | |* This file is important because different host OS's define different macros,*| 12 | |* which makes portability tough. This file exports the following *| 13 | |* definitions: *| 14 | |* *| 15 | |* [u]int(32|64)_t : typedefs for signed and unsigned 32/64 bit system types*| 16 | |* [U]INT(8|16|32|64)_(MIN|MAX) : Constants for the min and max values. *| 17 | |* *| 18 | |* No library is required when using these functions. *| 19 | |* *| 20 | |*===----------------------------------------------------------------------===*/ 21 | 22 | /* Please leave this file C-compatible. */ 23 | 24 | #ifndef LLVM_C_DATATYPES_H 25 | #define LLVM_C_DATATYPES_H 26 | 27 | #include 28 | #include 29 | 30 | #ifndef _MSC_VER 31 | 32 | #if !defined(UINT32_MAX) 33 | # error "The standard header is not C++11 compliant. Must #define "\ 34 | "__STDC_LIMIT_MACROS before #including llvm-c/DataTypes.h" 35 | #endif 36 | 37 | #if !defined(UINT32_C) 38 | # error "The standard header is not C++11 compliant. Must #define "\ 39 | "__STDC_CONSTANT_MACROS before #including llvm-c/DataTypes.h" 40 | #endif 41 | 42 | /* Note that includes , if this is a C99 system. */ 43 | #include 44 | 45 | #ifdef _AIX 46 | // GCC is strict about defining large constants: they must have LL modifier. 47 | #undef INT64_MAX 48 | #undef INT64_MIN 49 | #endif 50 | 51 | #else /* _MSC_VER */ 52 | #ifdef __cplusplus 53 | #include 54 | #include 55 | #else 56 | #include 57 | #include 58 | #endif 59 | #include 60 | 61 | #if defined(_WIN64) 62 | typedef signed __int64 ssize_t; 63 | #else 64 | typedef signed int ssize_t; 65 | #endif /* _WIN64 */ 66 | 67 | #endif /* _MSC_VER */ 68 | 69 | /* Set defaults for constants which we cannot find. */ 70 | #if !defined(INT64_MAX) 71 | # define INT64_MAX 9223372036854775807LL 72 | #endif 73 | #if !defined(INT64_MIN) 74 | # define INT64_MIN ((-INT64_MAX)-1) 75 | #endif 76 | #if !defined(UINT64_MAX) 77 | # define UINT64_MAX 0xffffffffffffffffULL 78 | #endif 79 | 80 | #endif /* LLVM_C_DATATYPES_H */ 81 | -------------------------------------------------------------------------------- /symbolic-debuginfo/src/lib.rs: -------------------------------------------------------------------------------- 1 | //! Abstractions for dealing with object files and debug information. 2 | //! 3 | //! This module defines the [`Object`] type, which is an abstraction over various object file 4 | //! formats used in different platforms. Also, since executables on MacOS might contain multiple 5 | //! object files (called a _"Fat MachO"_), there is an [`Archive`] type, that provides a uniform 6 | //! interface with access to an objects iterator in all platforms. 7 | //! 8 | //! Most processing of object files will happen on the `Object` type or its concrete implementation 9 | //! for one platform. To allow abstraction over this, there is the [`ObjectLike`] trait. It defines 10 | //! common attributes and gives access to a [`DebugSession`], which can be used to perform more 11 | //! stateful handling of debug information. 12 | //! 13 | //! See [`Object`] for the full API, or use one of the modules for direct access to the 14 | //! platform-dependent data. 15 | //! 16 | //! # Background 17 | //! 18 | //! The functionality of `symbolic::debuginfo` is conceptionally similar to the [`object crate`]. 19 | //! However, there are key differences that warranted a separate implementation: 20 | //! 21 | //! - `object` has a stronger focus on executable formats, while `symbolic` focusses on debugging 22 | //! information. This is why `symbolic` also includes a variant for PDBs and Breakpad objects, 23 | //! where `object` instead has a WASM variant. 24 | //! - `object` contains far more generic access to the data within objects at the cost of 25 | //! performance. `symbolic` tries to optimize for debugging scenarios at the cost of generic 26 | //! usage. 27 | //! - `symbolic` contains an abstraction for multi-object files ([`Archive`]), which is not easily 28 | //! possible in `object` due to the use of lifetimes on the `object::Object` trait. 29 | //! 30 | //! [`Object`]: enum.Object.html 31 | //! [`Archive`]: enum.Archive.html 32 | //! [`ObjectLike`]: trait.ObjectLike.html 33 | //! [`DebugSession`]: trait.DebugSession.html 34 | //! [`object crate`]: https://docs.rs/object 35 | 36 | #![warn(missing_docs)] 37 | 38 | mod base; 39 | #[cfg(all( 40 | feature = "breakpad", 41 | feature = "dwarf", 42 | feature = "elf", 43 | feature = "macho", 44 | feature = "ms", 45 | feature = "sourcebundle", 46 | feature = "wasm" 47 | ))] 48 | mod object; 49 | 50 | #[cfg(feature = "breakpad")] 51 | pub mod breakpad; 52 | #[cfg(feature = "dwarf")] 53 | pub mod dwarf; 54 | #[cfg(feature = "elf")] 55 | pub mod elf; 56 | #[cfg(any(feature = "dwarf", feature = "breakpad"))] 57 | pub mod function_builder; 58 | #[cfg(feature = "ms")] 59 | pub(crate) mod function_stack; 60 | #[cfg(feature = "js")] 61 | pub mod js; 62 | #[cfg(feature = "macho")] 63 | pub mod macho; 64 | #[cfg(feature = "ms")] 65 | pub mod pdb; 66 | #[cfg(feature = "ms")] 67 | pub mod pe; 68 | #[cfg(feature = "ppdb")] 69 | pub mod ppdb; 70 | #[cfg(feature = "sourcebundle")] 71 | pub mod sourcebundle; 72 | #[cfg(feature = "wasm")] 73 | pub mod wasm; 74 | 75 | pub use crate::base::*; 76 | #[cfg(all( 77 | feature = "breakpad", 78 | feature = "dwarf", 79 | feature = "elf", 80 | feature = "macho", 81 | feature = "ms", 82 | feature = "ppdb", 83 | feature = "sourcebundle", 84 | feature = "wasm" 85 | ))] 86 | pub use crate::object::*; 87 | --------------------------------------------------------------------------------