statinf-otawa / obviews

Obviews, viewer for OTAWA
0 stars 1 forks source link

Support cached and prettified absolute source paths by trimming them #26

Closed jordr closed 5 months ago

jordr commented 5 months ago

This provides a fix for https://github.com/statinf-software/rocqstat-ng/issues/624

For test files, use multi_bench_ram_thumb_ii_v7m.elf and the multi_bench.c mentioned in https://github.com/statinf-software/rocqstat-ng/issues/754

Running Obviews in debug mode on a binary annotated with absolute path displays:

$ obviews.py multi_bench_ram_thumb_ii_v7m.elf binarysearch_main ../demo/ --debug
INFO: debug mode enabled.
DEBUG: Looking for sources, trying path '../demo/multi_bench.c'... OK
DEBUG: Found sources for trimmed path 'multi_bench.c'
INFO: listening to http://localhost:46083

The original path /home/kos/rocqstat-ng/gui/demo/multi_bench.c is decomposed into its core path, here ./multi_bench.c, and appended to the sources we provide, here ../demo/. Obviews finds the sources, and on top of that replaces the long absolute path with a more readable "core path": "multi_bench.c" (it could have a few parent folders, it does not here).

This is what it looks like: image

Note the sources tab is not replaced on the left hand side with the "core path", but clicking them still works: image

On top of this, the debugs that can be enabled with --debug enable us to test the success of this feature in the RocqStat, by checking the console output of Obviews.