Loading libs/binder/tests/binderRpcTest.cpp +10 −1 Original line number Original line Diff line number Diff line Loading @@ -85,6 +85,11 @@ static std::string WaitStatusToString(int wstatus) { return base::StringPrintf("unexpected state %d", wstatus); return base::StringPrintf("unexpected state %d", wstatus); } } static void debugBacktrace(pid_t pid) { std::cerr << "TAKING BACKTRACE FOR PID " << pid << std::endl; system((std::string("debuggerd -b ") + std::to_string(pid)).c_str()); } class Process { class Process { public: public: Process(Process&&) = default; Process(Process&&) = default; Loading Loading @@ -125,6 +130,8 @@ public: // Kill the process. Avoid if possible. Shutdown gracefully via an RPC instead. // Kill the process. Avoid if possible. Shutdown gracefully via an RPC instead. void terminate() { kill(mPid, SIGTERM); } void terminate() { kill(mPid, SIGTERM); } pid_t getPid() { return mPid; } private: private: std::function<void(int wstatus)> mCustomExitStatusCheck; std::function<void(int wstatus)> mCustomExitStatusCheck; pid_t mPid = 0; pid_t mPid = 0; Loading Loading @@ -173,7 +180,9 @@ struct ProcessSession { wp<RpcSession> weakSession = session; wp<RpcSession> weakSession = session; session = nullptr; session = nullptr; EXPECT_EQ(nullptr, weakSession.promote()) << "Leaked session"; EXPECT_EQ(nullptr, weakSession.promote()) << (debugBacktrace(host.getPid()), debugBacktrace(getpid()), "Leaked session"); } } } } }; }; Loading Loading
libs/binder/tests/binderRpcTest.cpp +10 −1 Original line number Original line Diff line number Diff line Loading @@ -85,6 +85,11 @@ static std::string WaitStatusToString(int wstatus) { return base::StringPrintf("unexpected state %d", wstatus); return base::StringPrintf("unexpected state %d", wstatus); } } static void debugBacktrace(pid_t pid) { std::cerr << "TAKING BACKTRACE FOR PID " << pid << std::endl; system((std::string("debuggerd -b ") + std::to_string(pid)).c_str()); } class Process { class Process { public: public: Process(Process&&) = default; Process(Process&&) = default; Loading Loading @@ -125,6 +130,8 @@ public: // Kill the process. Avoid if possible. Shutdown gracefully via an RPC instead. // Kill the process. Avoid if possible. Shutdown gracefully via an RPC instead. void terminate() { kill(mPid, SIGTERM); } void terminate() { kill(mPid, SIGTERM); } pid_t getPid() { return mPid; } private: private: std::function<void(int wstatus)> mCustomExitStatusCheck; std::function<void(int wstatus)> mCustomExitStatusCheck; pid_t mPid = 0; pid_t mPid = 0; Loading Loading @@ -173,7 +180,9 @@ struct ProcessSession { wp<RpcSession> weakSession = session; wp<RpcSession> weakSession = session; session = nullptr; session = nullptr; EXPECT_EQ(nullptr, weakSession.promote()) << "Leaked session"; EXPECT_EQ(nullptr, weakSession.promote()) << (debugBacktrace(host.getPid()), debugBacktrace(getpid()), "Leaked session"); } } } } }; }; Loading