diff --git a/paddle/fluid/platform/init.cc b/paddle/fluid/platform/init.cc index feb6b1e7dc1b03189efe89e734537eb4101e68bf..d96d1c031562d686f165a52ea3d38566cd1bf855 100644 --- a/paddle/fluid/platform/init.cc +++ b/paddle/fluid/platform/init.cc @@ -203,9 +203,10 @@ void InitDevices(bool init_p2p, const std::vector devices) { } #ifndef _WIN32 -static void SignalHandle(const char *data, int size) { +void SignalHandle(const char *data, int size) { auto file_path = string::Sprintf("/tmp/paddle.%d.dump_info", ::getpid()); try { + LOG(WARNING) << "Signal raises!\n" + std::string(data, size); std::ofstream dump_info; dump_info.open(file_path, std::ios::app); dump_info << std::string(data, size); diff --git a/paddle/fluid/platform/init.h b/paddle/fluid/platform/init.h index 01d66f57dc96c30b474e8a794e375677594ff5f5..d25e79e78faa86c3105a2c901c514f7239c85c99 100644 --- a/paddle/fluid/platform/init.h +++ b/paddle/fluid/platform/init.h @@ -32,5 +32,9 @@ void InitDevices(bool init_p2p, const std::vector devices); void InitDGC(); +#ifndef _WIN32 +void SignalHandle(const char *data, int size); +#endif + } // namespace framework } // namespace paddle diff --git a/paddle/fluid/platform/init_test.cc b/paddle/fluid/platform/init_test.cc index eef1470a90c7da15efff965fc8f66dfa616ba25f..3f911843c57877cfbedfe47da390f1bebc8dd256 100644 --- a/paddle/fluid/platform/init_test.cc +++ b/paddle/fluid/platform/init_test.cc @@ -38,3 +38,10 @@ TEST(InitDevices, CUDA) { ASSERT_EQ(pool.size(), 1U + static_cast(count)); #endif } + +#ifndef _WIN32 +TEST(SignalHandle, SignalHandle) { + std::string msg = "Signal raises"; + paddle::framework::SignalHandle(msg.c_str(), msg.size()); +} +#endif