Add `lshal debug` command.
Supported command:
lshal debug android.hardware.foo@1.0::IFoo option option
Test: adb unroot && lshal --debug ; echo $?
Test: adb unroot && lshal debug android.hardware.nfc@1.0::INfc ; echo $?
Test: adb root && lshal --debug ; echo $?
Test: adb root && lshal debug android.hardware.nfc@1.0::INfc ; echo $?
Bug: 37954458
Change-Id: Ia2f4c9c0d3fb0a7bb26e76f01d02f49dc426e7f8
diff --git a/cmds/lshal/ListCommand.cpp b/cmds/lshal/ListCommand.cpp
index 5696843..a0ed7a3 100644
--- a/cmds/lshal/ListCommand.cpp
+++ b/cmds/lshal/ListCommand.cpp
@@ -350,15 +350,6 @@
printLine("Interface", "Transport", "Arch", "Server", "Server CMD",
"PTR", "Clients", "Clients CMD");
- // We're only interested in dumping debug info for already
- // instantiated services. There's little value in dumping the
- // debug info for a service we create on the fly, so we only operate
- // on the "mServicesTable".
- sp<IServiceManager> serviceManager;
- if (mEmitDebugInfo && &table == &mServicesTable) {
- serviceManager = ::android::hardware::defaultServiceManager();
- }
-
for (const auto &entry : table) {
printLine(entry.interfaceName,
entry.transport,
@@ -369,9 +360,14 @@
join(entry.clientPids, " "),
join(entry.clientCmdlines, ";"));
- if (serviceManager != nullptr) {
+ // We're only interested in dumping debug info for already
+ // instantiated services. There's little value in dumping the
+ // debug info for a service we create on the fly, so we only operate
+ // on the "mServicesTable".
+ if (mEmitDebugInfo && &table == &mServicesTable) {
auto pair = splitFirst(entry.interfaceName, '/');
- mLshal.emitDebugInfo(serviceManager, pair.first, pair.second, {}, mOut.buf());
+ mLshal.emitDebugInfo(pair.first, pair.second, {}, mOut.buf(),
+ NullableOStream<std::ostream>(nullptr));
}
}
mOut << std::endl;