From: Sachin Kadloor Date: Fri, 31 Oct 2014 17:58:47 +0000 (-0700) Subject: SocketAddress logging X-Git-Tag: v0.22.0~211 X-Git-Url: http://plrg.eecs.uci.edu/git/?p=folly.git;a=commitdiff_plain;h=5ea13370592a6dcdb5a90ee1d89273162bda960d SocketAddress logging Summary: Better logging in SocketAddress Test Plan: run it Reviewed By: qwu@fb.com Subscribers: ps, bmatheny, xning FB internal diff: D1644573 Tasks: 5406091 Signature: t1:1644573:1414626398:1e23ee85ec8ee0be89cb6bdc07da23978b4d988a --- diff --git a/folly/SocketAddress.cpp b/folly/SocketAddress.cpp index f624b3a6..0f9b9d16 100644 --- a/folly/SocketAddress.cpp +++ b/folly/SocketAddress.cpp @@ -29,6 +29,9 @@ #include #include #include +#include +#include +#include namespace { @@ -543,6 +546,14 @@ size_t SocketAddress::hash() const { break; case AF_UNSPEC: default: + void *array[20]; + size_t size; + // get void*'s for all entries on the stack + size = backtrace(array, 20); + // print out all the frames to stderr + fprintf(stderr, "Exception: \n"); + backtrace_symbols_fd(array, size, STDERR_FILENO); + LOG(FATAL) << "Invalid ip address: " << describe(); throw std::invalid_argument( "SocketAddress: unsupported address family " "for hashing");