diff options
| author | 2022-09-29 20:09:49 +0000 | |
|---|---|---|
| committer | 2022-09-29 20:09:49 +0000 | |
| commit | 73855b5e1514be84bf2919e36722f3e6f1fe05a7 (patch) | |
| tree | 186d63b3ade274ab1f85caf6ff412a6dde9d2f48 | |
| parent | 5cff7f4c51620c4e36394d2efc47948a08868a18 (diff) | |
| parent | 7c4521cc7735aade700fff2be9b2aaae2a99a846 (diff) | |
Merge "binderRpcTest: backtrace on leaked session" am: 445682055b am: 341a05cc3b am: 992e9ef47e am: 7c4521cc77
Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/2237182
Change-Id: I3c861393de2c7188dd37986c290de1297d620792
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
| -rw-r--r-- | libs/binder/tests/binderRpcTest.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/libs/binder/tests/binderRpcTest.cpp b/libs/binder/tests/binderRpcTest.cpp index 21b0354b60..9a6d4dfa53 100644 --- a/libs/binder/tests/binderRpcTest.cpp +++ b/libs/binder/tests/binderRpcTest.cpp @@ -85,6 +85,11 @@ static std::string WaitStatusToString(int 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 { public: Process(Process&&) = default; @@ -125,6 +130,8 @@ public: // Kill the process. Avoid if possible. Shutdown gracefully via an RPC instead. void terminate() { kill(mPid, SIGTERM); } + pid_t getPid() { return mPid; } + private: std::function<void(int wstatus)> mCustomExitStatusCheck; pid_t mPid = 0; @@ -173,7 +180,9 @@ struct ProcessSession { wp<RpcSession> weakSession = session; session = nullptr; - EXPECT_EQ(nullptr, weakSession.promote()) << "Leaked session"; + + EXPECT_EQ(nullptr, weakSession.promote()) + << (debugBacktrace(host.getPid()), debugBacktrace(getpid()), "Leaked session"); } } }; |