UI: fix 'Cannot read property 'source' of undefined'

The bug was about sidebar.ts hardcoding state.engines[0].
The engine ID keeps changing monotonically as more traces
are open. The proper way to deal with that is to do
Object.values(engines)[0] as we do elsewhere.
In future we should get rid of this as we never open more
than one trace at the same time.
This CL also fixes a bug in the WASM error reporting code.
This was causing some bugs happening when an exception is
thrown in a ccall, to be reported as '{}' (e.g. b/168645606)
rather than showing the full stack trace. Turns out that
JSON.stringify doesn't do anything useful for Error().

Test: manual: open two traces, share the second.
Bug: 173785472
Bug: 173016918
Bug: 172517820
Bug: 172517541
Change-Id: I0b3db9fc51cbc2adca64a01f5610dd4254b99928
3 files changed
tree: 92c42bc69281197e5249d247d6055b226591c19a
  1. .github/
  2. bazel/
  3. build_overrides/
  4. buildtools/
  5. debian/
  6. docs/
  7. examples/
  8. gn/
  9. include/
  10. infra/
  11. protos/
  12. src/
  13. test/
  14. tools/
  15. ui/
  16. .clang-format
  17. .clang-tidy
  18. .gitignore
  19. .gn
  20. .style.yapf
  21. Android.bp
  22. Android.bp.extras
  23. BUILD
  24. BUILD.extras
  25. BUILD.gn
  26. CHANGELOG
  27. codereview.settings
  28. heapprofd.rc
  29. LICENSE
  30. METADATA
  31. MODULE_LICENSE_APACHE2
  32. OWNERS
  33. perfetto.rc
  34. PRESUBMIT.py
  35. README.chromium
  36. README.md
  37. TEST_MAPPING
  38. traced_perf.rc
  39. WORKSPACE
README.md

Perfetto - System profiling, app tracing and trace analysis

Perfetto is a production-grade open-source stack for performance instrumentation and trace analysis. It offers services and libraries and for recording system-level and app-level traces, native + java heap profiling, a library for analyzing traces using SQL and a web-based UI to visualize and explore multi-GB traces.

See https://perfetto.dev/docs or the /docs/ directory for documentation.