dbus-vis: Show message arguments in pop-up window
Messages show up in the pop-window like the following:
Message type: sig
Serial : 123456
Sender : :1.234
Destination : <none>
Path : /xyz/openbmc_project/sensors/temperature/SomeSensor
Interface : org.freedesktop.DBus.Properties
Member : PropertiesChanged
args[0]: Value, 38.625
This is very convenient for quickly seeing what is in the DBus messages,
and makes debugging certain bugs, for example, sensor-related ones, more
convenient.
Signed-off-by: Sui Chen <suichen@google.com>
Change-Id: I29d52d5b8da315f7de1025b7f266b69ce32edb09
diff --git a/dbus-vis/timeline_view.js b/dbus-vis/timeline_view.js
index 39f98a0..98b94a7 100644
--- a/dbus-vis/timeline_view.js
+++ b/dbus-vis/timeline_view.js
@@ -1809,6 +1809,27 @@
labels.push('Interface : ' + iface);
labels.push('Member : ' + member);
+ let packet_idx = -1;
+ if (msg_type == 'mc') {
+ packet_idx = 10;
+ } else if (msg_type == 'sig') {
+ packet_idx = 9;
+ }
+
+ if (packet_idx != -1) {
+ let packet = theHoveredReq[packet_idx];
+ if (packet.length >= 2) {
+ const args = packet[1].length;
+ if (args.length < 1) {
+ labels.push("(no args)");
+ } else {
+ for (let i = 0; i < packet[1].length; i ++) {
+ labels.push('args[' + i + "]: " + packet[1][i]);
+ }
+ }
+ }
+ }
+
let w = 1, h = LINE_SPACING * labels.length + 2 * PAD;
for (let i = 0; i < labels.length; i++) {
w = Math.max(w, ctx.measureText(labels[i]).width);