From 5f328892a84418825bbfb5a2c074fc1a13e4eb7a Mon Sep 17 00:00:00 2001 From: Steven Moreland Date: Thu, 18 Jan 2018 14:38:07 -0800 Subject: Add 'exclude parent' option to debug. We could add this to list in the future if it seems useful. This allows someone to call debug on all registered hal instances without dumping subclasses multiple times. Bug: 72123369 Test: w/ bugreport using this and manual Change-Id: Ib201194a9f81ae1aded7105d123ac6399c847494 --- cmds/lshal/DebugCommand.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'cmds/lshal/DebugCommand.cpp') diff --git a/cmds/lshal/DebugCommand.cpp b/cmds/lshal/DebugCommand.cpp index f371320bd0..dd8812d5bf 100644 --- a/cmds/lshal/DebugCommand.cpp +++ b/cmds/lshal/DebugCommand.cpp @@ -35,6 +35,14 @@ Status DebugCommand::parseArgs(const Arg &arg) { if (optind >= arg.argc) { return USAGE; } + + // Optargs cannnot be used because the flag should not be considered set + // if it should really be contained in mOptions. + if (std::string(arg.argv[optind]) == "-E") { + mExcludesParentInstances = true; + optind++; + } + mInterfaceName = arg.argv[optind]; ++optind; for (; optind < arg.argc; ++optind) { @@ -59,6 +67,7 @@ Status DebugCommand::main(const Arg &arg) { return mLshal.emitDebugInfo( pair.first, pair.second.empty() ? "default" : pair.second, mOptions, + mExcludesParentInstances, mLshal.out().buf(), mLshal.err()); } @@ -67,8 +76,9 @@ void DebugCommand::usage() const { static const std::string debug = "debug:\n" - " lshal debug [options [options [...]]] \n" + " lshal debug [-E] [options [options [...]]] \n" " Print debug information of a specified interface.\n" + " -E: excludes debug output if HAL is actually a subclass.\n" " : Format is `android.hardware.foo@1.0::IFoo/default`.\n" " If instance name is missing `default` is used.\n" " options: space separated options to IBase::debug.\n"; -- cgit v1.2.3-59-g8ed1b