diff options
| author | 2022-09-29 18:10:20 +0000 | |
|---|---|---|
| committer | 2022-09-29 18:10:20 +0000 | |
| commit | 341a05cc3bfdf4fb797d2d64faea66431c13006a (patch) | |
| tree | a10d92eab4e811a0db3e945f508bb9f819a50149 | |
| parent | 251493d8fc68e31bfe6361dcbf2ec07976f8203c (diff) | |
| parent | 445682055bac69504eca478a0271c8048e195be8 (diff) | |
Merge "binderRpcTest: backtrace on leaked session" am: 445682055b
Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/2237182
Change-Id: I0b79b8bb18cff8eb219ccaaa91d8a94ecc8c6c00
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"); } } }; |