Loading system/btif/src/bluetooth.cc +1 −1 Original line number Diff line number Diff line Loading @@ -331,7 +331,7 @@ static void dump(int fd, const char** arguments) { connection_manager::dump(fd); bluetooth::bqr::DebugDump(fd); if (bluetooth::shim::is_gd_shim_enabled()) { bluetooth::shim::Dump(fd); bluetooth::shim::Dump(fd, arguments); } else { #if (BTSNOOP_MEM == TRUE) btif_debug_btsnoop_dump(fd); Loading system/gd/shim/dumpsys.cc +39 −5 Original line number Diff line number Diff line Loading @@ -35,9 +35,37 @@ namespace { constexpr char kModuleName[] = "shim::Dumpsys"; } // namespace constexpr char kArgumentDeveloper[] = "--dev"; class ParsedDumpsysArgs { public: ParsedDumpsysArgs(const char** args) { if (args == nullptr) return; const char* p = *args; while (p != nullptr) { num_args_++; if (!strcmp(p, kArgumentDeveloper)) { dev_arg_ = true; } else { // silently ignore unexpected option } if (++args == nullptr) break; p = *args; } } bool IsDeveloper() const { return dev_arg_; } private: unsigned num_args_{0}; bool dev_arg_{false}; }; struct Dumpsys::impl { public: void Dump(int fd, std::promise<void> promise); void DumpWithArgs(int fd, const char** args, std::promise<void> promise); void RegisterDumpsysFunction(const void* token, DumpsysFunction func); void UnregisterDumpsysFunction(const void* token); Loading @@ -49,8 +77,14 @@ struct Dumpsys::impl { const ModuleFactory Dumpsys::Factory = ModuleFactory([]() { return new Dumpsys(); }); void Dumpsys::impl::Dump(int fd, std::promise<void> promise) { dprintf(fd, "%s Registered submodules:%zd\n", kModuleName, dumpsys_functions_.size()); void Dumpsys::impl::DumpWithArgs(int fd, const char** args, std::promise<void> promise) { ParsedDumpsysArgs parsed_dumpsys_args(args); if (parsed_dumpsys_args.IsDeveloper()) { // TODO(cmanton) Create development Dumper } else { // TODO(cmanton) Create typical Dumper } std::for_each(dumpsys_functions_.begin(), dumpsys_functions_.end(), [fd](std::pair<const void*, DumpsysFunction> element) { element.second(fd); }); promise.set_value(); Loading @@ -66,10 +100,10 @@ void Dumpsys::impl::UnregisterDumpsysFunction(const void* token) { dumpsys_functions_.erase(token); } void Dumpsys::Dump(int fd) { void Dumpsys::Dump(int fd, const char** args) { std::promise<void> promise; auto future = promise.get_future(); GetHandler()->Post(common::BindOnce(&Dumpsys::impl::Dump, common::Unretained(pimpl_.get()), fd, std::move(promise))); GetHandler()->BindOnceOn(pimpl_.get(), &Dumpsys::impl::DumpWithArgs, fd, args, std::move(promise)); future.get(); } Loading system/gd/shim/dumpsys.h +2 −1 Original line number Diff line number Diff line Loading @@ -27,7 +27,8 @@ using DumpsysFunction = std::function<void(int fd)>; class Dumpsys : public bluetooth::Module { public: void Dump(int fd); void Dump(int fd, const char** args); void RegisterDumpsysFunction(const void* token, DumpsysFunction func); void UnregisterDumpsysFunction(const void* token); Loading system/main/shim/dumpsys.cc +3 −3 Original line number Diff line number Diff line Loading @@ -41,15 +41,15 @@ void bluetooth::shim::UnregisterDumpsysFunction(const void* token) { dumpsys_functions_->erase(token); } void bluetooth::shim::Dump(int fd) { void bluetooth::shim::Dump(int fd, const char** args) { dprintf(fd, "%s Dumping shim legacy targets:%zd\n", kModuleName, dumpsys_functions_->size()); for (auto& dumpsys : *dumpsys_functions_) { dumpsys.second(fd); } if (bluetooth::shim::is_gd_stack_started_up()) { bluetooth::shim::GetDumpsys()->Dump(fd); bluetooth::shim::GetDumpsys()->Dump(fd, args); } else { dprintf(fd, "%s gd stack has not started up\n", kModuleName); dprintf(fd, "%s gd stack is enabled but not started\n", kModuleName); } } system/main/shim/dumpsys.h +1 −1 Original line number Diff line number Diff line Loading @@ -28,7 +28,7 @@ using DumpsysFunction = std::function<void(int fd)>; * Entrypoint from legacy stack to provide dumpsys functionality * for both the legacy shim and the Gabeldorsche stack. */ void Dump(int fd); void Dump(int fd, const char** args); /** * Dumpsys access for legacy shim modules. Loading Loading
system/btif/src/bluetooth.cc +1 −1 Original line number Diff line number Diff line Loading @@ -331,7 +331,7 @@ static void dump(int fd, const char** arguments) { connection_manager::dump(fd); bluetooth::bqr::DebugDump(fd); if (bluetooth::shim::is_gd_shim_enabled()) { bluetooth::shim::Dump(fd); bluetooth::shim::Dump(fd, arguments); } else { #if (BTSNOOP_MEM == TRUE) btif_debug_btsnoop_dump(fd); Loading
system/gd/shim/dumpsys.cc +39 −5 Original line number Diff line number Diff line Loading @@ -35,9 +35,37 @@ namespace { constexpr char kModuleName[] = "shim::Dumpsys"; } // namespace constexpr char kArgumentDeveloper[] = "--dev"; class ParsedDumpsysArgs { public: ParsedDumpsysArgs(const char** args) { if (args == nullptr) return; const char* p = *args; while (p != nullptr) { num_args_++; if (!strcmp(p, kArgumentDeveloper)) { dev_arg_ = true; } else { // silently ignore unexpected option } if (++args == nullptr) break; p = *args; } } bool IsDeveloper() const { return dev_arg_; } private: unsigned num_args_{0}; bool dev_arg_{false}; }; struct Dumpsys::impl { public: void Dump(int fd, std::promise<void> promise); void DumpWithArgs(int fd, const char** args, std::promise<void> promise); void RegisterDumpsysFunction(const void* token, DumpsysFunction func); void UnregisterDumpsysFunction(const void* token); Loading @@ -49,8 +77,14 @@ struct Dumpsys::impl { const ModuleFactory Dumpsys::Factory = ModuleFactory([]() { return new Dumpsys(); }); void Dumpsys::impl::Dump(int fd, std::promise<void> promise) { dprintf(fd, "%s Registered submodules:%zd\n", kModuleName, dumpsys_functions_.size()); void Dumpsys::impl::DumpWithArgs(int fd, const char** args, std::promise<void> promise) { ParsedDumpsysArgs parsed_dumpsys_args(args); if (parsed_dumpsys_args.IsDeveloper()) { // TODO(cmanton) Create development Dumper } else { // TODO(cmanton) Create typical Dumper } std::for_each(dumpsys_functions_.begin(), dumpsys_functions_.end(), [fd](std::pair<const void*, DumpsysFunction> element) { element.second(fd); }); promise.set_value(); Loading @@ -66,10 +100,10 @@ void Dumpsys::impl::UnregisterDumpsysFunction(const void* token) { dumpsys_functions_.erase(token); } void Dumpsys::Dump(int fd) { void Dumpsys::Dump(int fd, const char** args) { std::promise<void> promise; auto future = promise.get_future(); GetHandler()->Post(common::BindOnce(&Dumpsys::impl::Dump, common::Unretained(pimpl_.get()), fd, std::move(promise))); GetHandler()->BindOnceOn(pimpl_.get(), &Dumpsys::impl::DumpWithArgs, fd, args, std::move(promise)); future.get(); } Loading
system/gd/shim/dumpsys.h +2 −1 Original line number Diff line number Diff line Loading @@ -27,7 +27,8 @@ using DumpsysFunction = std::function<void(int fd)>; class Dumpsys : public bluetooth::Module { public: void Dump(int fd); void Dump(int fd, const char** args); void RegisterDumpsysFunction(const void* token, DumpsysFunction func); void UnregisterDumpsysFunction(const void* token); Loading
system/main/shim/dumpsys.cc +3 −3 Original line number Diff line number Diff line Loading @@ -41,15 +41,15 @@ void bluetooth::shim::UnregisterDumpsysFunction(const void* token) { dumpsys_functions_->erase(token); } void bluetooth::shim::Dump(int fd) { void bluetooth::shim::Dump(int fd, const char** args) { dprintf(fd, "%s Dumping shim legacy targets:%zd\n", kModuleName, dumpsys_functions_->size()); for (auto& dumpsys : *dumpsys_functions_) { dumpsys.second(fd); } if (bluetooth::shim::is_gd_stack_started_up()) { bluetooth::shim::GetDumpsys()->Dump(fd); bluetooth::shim::GetDumpsys()->Dump(fd, args); } else { dprintf(fd, "%s gd stack has not started up\n", kModuleName); dprintf(fd, "%s gd stack is enabled but not started\n", kModuleName); } }
system/main/shim/dumpsys.h +1 −1 Original line number Diff line number Diff line Loading @@ -28,7 +28,7 @@ using DumpsysFunction = std::function<void(int fd)>; * Entrypoint from legacy stack to provide dumpsys functionality * for both the legacy shim and the Gabeldorsche stack. */ void Dump(int fd); void Dump(int fd, const char** args); /** * Dumpsys access for legacy shim modules. Loading