Auterion / embedded-debug-tools

Tools for debugging and profiling ARM Cortex-M devices as found on the PX4 Autopilot FMU boards
https://auterion.github.io/embedded-debug-tools/
BSD 3-Clause "New" or "Revised" License
51 stars 7 forks source link

[Orbetto]: Converting trace.swo to orbetto.perf does not finish #5

Open sebglatz opened 7 months ago

sebglatz commented 7 months ago

I have recorded some profiles with: python3 -m emdbg.bench.fmu --target px4_fmu-v6x_default --jlink

Then I try to convert the file for visualization with: build/orbetto -C 480000 -f trace.swo -e px4_fmu-v6x_default.elf

Problem: Even for the smallest .swo (3.6MB) file, the conversion does not finish (gave up after ~30min).

Attached is the .elf file and the .swo file orbetto_files.zip

niklaut commented 7 months ago

It should only take a few seconds even for large traces (~100MB). It should also output information about the elf file. Maybe you can run this in GDB or LLDB and see where it's stuck?

For your dataset this is the stdout:

$ orbetto -C 480000 -f trace.swo -e px4_fmu-v6x_default.elf
Loading ELF file px4_fmu-v6x_default.elf without source lines
Loaded ELF with 2 sections:
  Section '.text': [0x08020000, 0x081f80f0] (1933552)
  Section '.data': [0x24000000, 0x24001470] (5232)
Found Name safety_button for 0x0819b1c3
Found Name tone_alarm for 0x0818d979
Found Name load_mon for 0x0818daa1
Found Name <single_shot> for 0x081ebbfc
Found Name send_event for 0x0818da1c
Found Name px4io for 0x08197492
Found Name manual_control for 0x081f06a3
Found Name ina226 for 0x0818d84e
Found Name board_adc for 0x0818d72b
Found Name icm20649 for 0x0818d80f
Found Name icm42688p for 0x0819472c
Found Name icm42670p for 0x0818d83a
Found Name bmm150 for 0x0818d897
Found Name vehicle_angular_velocity for 0x081a07f0
Found Name vehicle_air_data for 0x081dc460
Found Name vehicle_gps_position for 0x081dc8f0
Found Name vehicle_magnetometer for 0x081dc988
Found Name battery_status for 0x0818d9d0
Found Name vehicle_imu for 0x081a1314
Found Name sensors for 0x0818db2f
Found Name dshot for 0x0818d7ea
Found Name pwm_out for 0x0818d909
Found Name ekf2 for 0x0819d69c
Found Name ekf2_selector for 0x0819db80
Found Name vehicle_acceleration for 0x081a0f90
Found Name mc_rate_control for 0x081a5d40
Found Name control_allocator for 0x0819cf04
Found Name mc_pos_control for 0x0818daf5
Found Name mag_bias_estimator for 0x0818dab1
Found Name mc_hover_thrust_estimator for 0x081a5980
Found Name flight_mode_manager for 0x0818da27
Found Name land_detector for 0x0818da7a
Found Name bmp388 for 0x0818d712
Found Name gyro_calibration for 0x0818da69
Found Name uavcan-actuators-esc for 0x08198bc0
Found Name uavcan-actuators-servo for 0x08198bdf
Found Name uavcan for 0x08199ca0
Found Name mc_att_control for 0x081a581c
Serializing into 'orbetto.perf'

And here is the resulting (gzipped) file. (perfetto also works with gzipped files directly).

sebglatz commented 7 months ago

The last print that I see is: Found Name mc_att_control for 0x081a581c

The bt of where it hangs:

bt
#0  0x00007ffff6b1b59d in __GI___select (nfds=5, readfds=0x7ffffffba888, writefds=0x0, exceptfds=0x0, timeout=0x7fffffffafd8) at ../sysdeps/unix/sysv/linux/select.c:69
#1  0x00007ffff7fb051d in _posixFileStreamReceive (stream=0x555556087bf0, buffer=0x7ffffffbafd0, bufferSize=262144, timeout=0x7fffffffafd8, receivedSize=0x7ffffffbaf98) at ../subprojects/orbuculum/Src/stream_file_posix.c:26
#2  0x00005555555f7d33 in _feedStream (stream=0x555556087bf0) at ../orbetto.cpp:1550
#3  0x00005555555f7aa6 in main (argc=7, argv=0x7fffffffb158) at ../orbetto.cpp:1742

Moreover, which orbetto version do you use? The newer ones (e.g. v1.3.9) do not compile with clang 14.0.0-1ubuntu1.1 (x86_64-pc-linux-gnu). -> error: src/orbetto.cpp:713:27: error: no member named 'manglename' in 'symbolFunctionStore' src/orbetto.cpp:1034:18: error: no matching function for call to 'symbolAcquire'

Commit hash 4f63c8b7cb71530229b2b7c72be62e0ecd0dfe2a still compiles successfully, though.

niklaut commented 7 months ago

Hm, the file stream part I took from orbuculum, not sure how it works tbh.

The orbuculum subproject SHA has changed in the new version. Maybe meson subprojects update --reset will help?