[zeromq-dev] Custom refactoring of ZeroMQ to work with pintools...

Kenneth Adam Miller kennethadammiller at gmail.com
Fri Jan 24 14:28:44 CET 2014

I would like to use zeromq to work with intel pintool (pintool.org).
Pintool is a dynamic binary instrumentation framework; it allows the
developer to specify some callbacks at many levels of execution of any
binary program. But to allow zeromq to work with it, you have to restrict
thread creation down to only the context or whatever other threads you
have, and then specify that the thread creation and any other thread apis
go through the pin interface. If they don't then you potentially have a
recursive instrument and execute condition, where a thread you want to work
for the instrumentation/analysis side is also being targeted for

My changes to zeromq consist of some minor alterations to thread.hpp and
mutex.hpp. You can see what I've changed on my forked repository over
here-all I do is replace the threading primitives that each class is
abstracting from with an instance for pin's.

I know for certain that my changes are at taking effect, because what I can
see is that inter thread communication for just ZMQ_PULL and ZMQ_PUSH works
just fine. But when I go to create dealer's and router's and link them with
a proxy I start getting errors with code that came straight from the
manual, which is really not good. I would prefer that my hack continue to
work, and I have confidence that with some help I can make it work.

custom libzmq implementation:  https://github.com/KennethAdamMiller/libzmq


(for 64 bit)
./configure CXXFLAGS="-DBIGARRAY_MULTIPLIER=1 -Wall -Werror
-Wno-unknown-pragmas -fno-stack-protector -DTARGET_IA32E -DHOST_IA32E -fPIC
-DTARGET_LINUX  -I$HOME/pin-2.13/source/include/pin
-I$HOME/pin-2.13/source/tools/InstLib -O3 -fomit-frame-pointer
-fno-strict-aliasing  -g -std=c++11 -L$HOMEpin-2.13/intel64/lib
-L$HOME/pin-2.13/intel64/lib-ext -L$HOME/pin-2.13/intel64/runtime/glibc
-L$HOME/pin-2.13/extras/xed2-intel64/lib -lpin -lxed -ldwarf -lelf -ldl "

sudo make install

repeatable pintool error:
Building this pintool is easy:
download a pin kit and extract to some location, like ~/pin-2.13

export PIN_ROOT=location
export TOOLS_ROOT=$PIN_ROOT/source/tools

then just cd to where you checked out my tool and type make. You'll see
that you get socket operation on non-socket. I was hoping that someone else
could help me find out why it is getting that error, and then may suggest
what I change in libzmq.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20140124/6331a405/attachment.htm>

More information about the zeromq-dev mailing list