scripts/trace.py: Transparent dumpfile/tracefile usage + extended symbol resolution (if avail)

Instead of converting from trace dump files to tracefiles (basically raw
trace data), detect which we are reading on opening the file, and use
the appropriate reader to extract data.  Also allow more chaining of
symbol resolution, making it possible to use trace dump symbol info when
available (and debug symbol resolution fails).
 
(Note the dump format reader assumes the slightly revised dump symbol
format, which in turn is in a different patch. But since nothing until
that patch actually creates SYMB chunks in dump files, this is safe).

Reviewed-by: Tomasz Grabiec <tgrabiec@gmail.com>
Signed-off-by: Calle Wilund <calle@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
java: Mechanism to auto-load resident JVMTI agents iff included in image

Will make java launcher add any JVMTI agent (i.e. .so) present in
'/usr/lib/jvm/agents/autoload/'.

Since dickering with actual appliance command lines is error prone,
and having a feature (agent) included or not in the image should
be distinction enough, picking up extensions this way feels ok.

Purpose of course to be able to have optional java symbol agent
loaded into the jvm if the image is built with it.

Reviewed-by: Tomasz Grabiec <tgrabiec@gmail.com>
Signed-off-by: Calle Wilund <calle@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
trace: Add callback registry for trace symbol resolution

Lets other code/modules hook in symbol dictionary callbacks, which
will be called on trace dump and the returned info included in the
binary dump.

Note, the symbol and module format has been slightly revised (see docs)
to make it more useful. Modules now include their size, and symbols
optionally include source and line number info.

Reviewed-by: Tomasz Grabiec <tgrabiec@gmail.com>
Signed-off-by: Calle Wilund <calle@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
modules/josvsym: Optional module to add JVM JIT symbol resolution to trace dumps

If loaded into the JVM, will register with symbol callback and generate
symbol entries for all JIT:ed code currently running.

Does not deal with interpreter or dead/unloaded code. Note that HS call
frames are RBP-walkable (i.e. works with OSv backtrace), so as long as
we are in JIT code, we will get at least some symbols almost for free.

Reviewed-by: Tomasz Grabiec <tgrabiec@gmail.com>
Signed-off-by: Calle Wilund <calle@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
build.mk: fix parallel build with libtools, route

similarly to commit c51e3daba983401f, in build.mk we have
tools/route/lsroute.so: EXTRA_LIBS = -Ltools/ -ltools
This means libtools.so needs to exist before lsroute.so is built.

Signed-off-by: Claudio Fontana <claudio.fontana@huawei.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>