OvermindDL1 | 1 Aug 01:22
Picon

Re: boost::lambda::bind temporary function objects.. and raw C

On Fri, Jul 31, 2009 at 9:20 AM, Steven Watanabe<watanabesj <at> gmail.com> wrote:
> AMDG
>
> Tomasz Mloduchowski wrote:
>>
>> Hello everyone!
>>
>> I have a rather challenging question, that perhaps can be resolved without
>> too much dark magic.
>>
>> A little background: I'm patching an executable (x86 platform, but could
>> be easily extended to other architectures).
>>
>> players:
>> void TargetFunc(some parameters);
>> void Hook(some parameters);
>>
>> method:
>> Grab first 5 bytes of TargetFunc. Back them up. Replace them with a jmp
>> Hook.
>>
>> Make Hook finish as follows:
>>    Restore the backup of 5 bytes.
>>    Call TargetFunc again, this time the real one, not the jmp.
>>    Replace the 5 bytes with jmp Hook, getting ready for the next
>> invocation.
>>
>> In a nutshell - typical trampoline.
>>
>> Now, I want to write a framework for this. I would prefer to be able to
(Continue reading)

Caligula | 1 Aug 09:16
Picon
Favicon

copy_graph - accessing property maps

If you use copy_graph(g, g2) how can you access the corresponding property maps in g2?

Thanks
-Caligula

_______________________________________________
Boost-users mailing list
Boost-users <at> lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users
er | 1 Aug 21:58
Picon

reference_wrapper

Hi All,

1) I don't understand this part of reference_wrapper:

template<class T> class reference_wrapper
{
	operator T& () const { return *t_; }
};

Could someone please explain it?

2) Is there already a reference wrapper for n-ary functors which exposes 
the same result_type (if it exists) as the n-ary functor, but whose 
arguments types are arbitrary (deduced from the arguments)?
Gennadiy Rozental | 1 Aug 23:49
Picon

Re: [Boost.Test] [1.38] Automated test suite registration with muti-file-test-modules

Greg Christopher wrote:
> #include <boost/test/execution_monitor.hpp>
> #include <boost/test/unit_test.hpp>
> 
> #define BOOST_TEST_MODULE Yeah

You obviously need to define the symbol *before* include, not after.

Gennadiy
Gennadiy Rozental | 1 Aug 23:50
Picon

Re: Boost.test applicability

Joel Falcou wrote:
> Other point, I saw that there is check in Boost.test which check for an 
> arbitrary precision result. However it uses raw value (like 0.001) where 
> having a check based on ULP or RMS maybe better. Is there anyway to 
> integrate those test using existing test framework ?

So, how did you mean to use RMS for FP value comparison?

Gennadiy
Selçuk Cevher | 1 Aug 10:03
Picon

non-POD C++ objects and Boost.Interprocess

Hi,

Is it possible to pass user-defined "non-POD" C++ class objects to message queues and retrieve them back on the receiver side using Boost.Interprocess ?

Thanks.

_______________________________________________
Boost-users mailing list
Boost-users <at> lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Seth Fowler | 2 Aug 01:37
Picon
Favicon

Valgrind's DRD tool produces false positives when used with Boost.Thread?

Hi all,

I've been trying to debug some data races in an application that uses  
Boost.Thread. I tried running valgrind's DRD tool against my binary to  
see if it could locate the source of the problem. It produced more  
errors than I expected, so I progressively removed portions of my  
application unless I was left with almost nothing. I found that even  
with the most minimal program I could produce, the DRD tool still  
reported errors - in fact, it even reported errors with the examples  
included with the Boost distribution! I was able to reproduce this  
behavior on Mac OS X 10.5.7 with Boost 1.39, and on Ubuntu 9.04 with  
Boost 1.37.

Here are steps to reproduce the problem:

1. Build the sample program thread.cpp included in the Boost  
distribution in libs/thread/example. For Boost 1.39, I used the  
following command:

g++ -L<Boost lib directory> -lboost_thread-xgcc40-mt-1_39 thread.cpp - 
o thread

2. Run it using valgrind's DRD tool:

valgrind --tool=drd --var-info=yes ./thread

On Mac OS X 10.5.7, I get the following output:

==20729== drd, a thread error detector.
==20729== Copyright (C) 2006-2009, and GNU GPL'd, by Bart Van Assche.
==20729== Using Valgrind-3.5.0.SVN and LibVEX; rerun with -h for  
copyright info
==20729== Command: ./thread
==20729==
--20729-- ./thread:
--20729-- dSYM directory is missing; consider using --auto-run- 
dsymutil=yes
setting alarm for 5 seconds...
==20729== Conflicting load by thread 1 at 0x00012018 size 4
==20729==    at 0x58B1: void boost::call_once<void (*) 
()>(boost::once_flag&, void (*)()) (in ./thread)
==20729==    by 0x390C: boost::thread::join() (in ./thread)
==20729==    by 0x9A13: main (in ./thread)
==20729== Allocation context: Data section of ./thread
==20729== Other segment start (thread 2)
==20729==    at 0x396B3: pthread_mutex_lock (drd_pthread_intercepts.c: 
580)
==20729==    by 0x5993: void boost::call_once<void (*) 
()>(boost::once_flag&, void (*)()) (in ./thread)
==20729==    by 0x30CC: thread_proxy (in ./thread)
==20729==    by 0x3707B: vgDrd_thread_wrapper  
(drd_pthread_intercepts.c:272)
==20729==    by 0x228154: _pthread_start (in /usr/lib/libSystem.B.dylib)
==20729==    by 0x228011: thread_start (in /usr/lib/libSystem.B.dylib)
==20729== Other segment end (thread 2)
==20729==    at 0x39BC2: pthread_mutex_unlock  
(drd_pthread_intercepts.c:633)
==20729==    by 0x30CC: thread_proxy (in ./thread)
==20729==    by 0x3707B: vgDrd_thread_wrapper  
(drd_pthread_intercepts.c:272)
==20729==    by 0x228154: _pthread_start (in /usr/lib/libSystem.B.dylib)
==20729==    by 0x228011: thread_start (in /usr/lib/libSystem.B.dylib)
==20729== Other segment start (thread 2)
==20729==    at 0x396B3: pthread_mutex_lock (drd_pthread_intercepts.c: 
580)
==20729==    by 0x58D2: void boost::call_once<void (*) 
()>(boost::once_flag&, void (*)()) (in ./thread)
==20729==    by 0x30CC: thread_proxy (in ./thread)
==20729==    by 0x3707B: vgDrd_thread_wrapper  
(drd_pthread_intercepts.c:272)
==20729==    by 0x228154: _pthread_start (in /usr/lib/libSystem.B.dylib)
==20729==    by 0x228011: thread_start (in /usr/lib/libSystem.B.dylib)
==20729== Other segment end (thread 2)
==20729==    at 0x39BC2: pthread_mutex_unlock  
(drd_pthread_intercepts.c:633)
==20729==    by 0x5988: void boost::call_once<void (*) 
()>(boost::once_flag&, void (*)()) (in ./thread)
==20729==    by 0x30CC: thread_proxy (in ./thread)
==20729==    by 0x3707B: vgDrd_thread_wrapper  
(drd_pthread_intercepts.c:272)
==20729==    by 0x228154: _pthread_start (in /usr/lib/libSystem.B.dylib)
==20729==    by 0x228011: thread_start (in /usr/lib/libSystem.B.dylib)
==20729==
==20729== Conflicting load by thread 1 at 0x00012014 size 4
==20729==    at 0x58B4: void boost::call_once<void (*) 
()>(boost::once_flag&, void (*)()) (in ./thread)
==20729==    by 0x390C: boost::thread::join() (in ./thread)
==20729==    by 0x9A13: main (in ./thread)
==20729== Allocation context: Data section of ./thread
==20729== Other segment start (thread 2)
==20729==    at 0x396B3: pthread_mutex_lock (drd_pthread_intercepts.c: 
580)
==20729==    by 0x5993: void boost::call_once<void (*) 
()>(boost::once_flag&, void (*)()) (in ./thread)
==20729==    by 0x30CC: thread_proxy (in ./thread)
==20729==    by 0x3707B: vgDrd_thread_wrapper  
(drd_pthread_intercepts.c:272)
==20729==    by 0x228154: _pthread_start (in /usr/lib/libSystem.B.dylib)
==20729==    by 0x228011: thread_start (in /usr/lib/libSystem.B.dylib)
==20729== Other segment end (thread 2)
==20729==    at 0x39BC2: pthread_mutex_unlock  
(drd_pthread_intercepts.c:633)
==20729==    by 0x30CC: thread_proxy (in ./thread)
==20729==    by 0x3707B: vgDrd_thread_wrapper  
(drd_pthread_intercepts.c:272)
==20729==    by 0x228154: _pthread_start (in /usr/lib/libSystem.B.dylib)
==20729==    by 0x228011: thread_start (in /usr/lib/libSystem.B.dylib)
==20729== Other segment start (thread 2)
==20729==    at 0x396B3: pthread_mutex_lock (drd_pthread_intercepts.c: 
580)
==20729==    by 0x58D2: void boost::call_once<void (*) 
()>(boost::once_flag&, void (*)()) (in ./thread)
==20729==    by 0x30CC: thread_proxy (in ./thread)
==20729==    by 0x3707B: vgDrd_thread_wrapper  
(drd_pthread_intercepts.c:272)
==20729==    by 0x228154: _pthread_start (in /usr/lib/libSystem.B.dylib)
==20729==    by 0x228011: thread_start (in /usr/lib/libSystem.B.dylib)
==20729== Other segment end (thread 2)
==20729==    at 0x39BC2: pthread_mutex_unlock  
(drd_pthread_intercepts.c:633)
==20729==    by 0x5988: void boost::call_once<void (*) 
()>(boost::once_flag&, void (*)()) (in ./thread)
==20729==    by 0x30CC: thread_proxy (in ./thread)
==20729==    by 0x3707B: vgDrd_thread_wrapper  
(drd_pthread_intercepts.c:272)
==20729==    by 0x228154: _pthread_start (in /usr/lib/libSystem.B.dylib)
==20729==    by 0x228011: thread_start (in /usr/lib/libSystem.B.dylib)
==20729==
==20729== Conflicting load by thread 1 at 0x00013b5c size 4
==20729==    at 0x993A: boost::detail::get_once_per_thread_epoch()  
(in ./thread)
==20729==    by 0x58BA: void boost::call_once<void (*) 
()>(boost::once_flag&, void (*)()) (in ./thread)
==20729==    by 0x390C: boost::thread::join() (in ./thread)
==20729==    by 0x9A13: main (in ./thread)
==20729== Allocation context: Data section of ./thread
==20729== Other segment start (thread 2)
==20729==    at 0x227FF0: thread_start (in /usr/lib/libSystem.B.dylib)
==20729== Other segment end (thread 2)
==20729==    at 0x396B3: pthread_mutex_lock (drd_pthread_intercepts.c: 
580)
==20729==    by 0x58D2: void boost::call_once<void (*) 
()>(boost::once_flag&, void (*)()) (in ./thread)
==20729==    by 0x30CC: thread_proxy (in ./thread)
==20729==    by 0x3707B: vgDrd_thread_wrapper  
(drd_pthread_intercepts.c:272)
==20729==    by 0x228154: _pthread_start (in /usr/lib/libSystem.B.dylib)
==20729==    by 0x228011: thread_start (in /usr/lib/libSystem.B.dylib)
==20729==
==20729== Conflicting load by thread 1 at 0x00013b5c size 4
==20729==    at 0x9972: boost::detail::get_once_per_thread_epoch()  
(in ./thread)
==20729==    by 0x58BA: void boost::call_once<void (*) 
()>(boost::once_flag&, void (*)()) (in ./thread)
==20729==    by 0x390C: boost::thread::join() (in ./thread)
==20729==    by 0x9A13: main (in ./thread)
==20729== Allocation context: Data section of ./thread
==20729== Other segment start (thread 2)
==20729==    at 0x227FF0: thread_start (in /usr/lib/libSystem.B.dylib)
==20729== Other segment end (thread 2)
==20729==    at 0x396B3: pthread_mutex_lock (drd_pthread_intercepts.c: 
580)
==20729==    by 0x58D2: void boost::call_once<void (*) 
()>(boost::once_flag&, void (*)()) (in ./thread)
==20729==    by 0x30CC: thread_proxy (in ./thread)
==20729==    by 0x3707B: vgDrd_thread_wrapper  
(drd_pthread_intercepts.c:272)
==20729==    by 0x228154: _pthread_start (in /usr/lib/libSystem.B.dylib)
==20729==    by 0x228011: thread_start (in /usr/lib/libSystem.B.dylib)
==20729==
==20729== Conflicting load by thread 1 at 0x00397680 size 4
==20729==    at 0x20038D: pthread_setspecific (in /usr/lib/ 
libSystem.B.dylib)
==20729==    by 0x997F: boost::detail::get_once_per_thread_epoch()  
(in ./thread)
==20729==    by 0x58BA: void boost::call_once<void (*) 
()>(boost::once_flag&, void (*)()) (in ./thread)
==20729==    by 0x390C: boost::thread::join() (in ./thread)
==20729==    by 0x9A13: main (in ./thread)
==20729== Allocation context: Data section of /usr/lib/libSystem.B.dylib
==20729== Other segment start (thread 2)
==20729==    at 0x227FF0: thread_start (in /usr/lib/libSystem.B.dylib)
==20729== Other segment end (thread 2)
==20729==    at 0x396B3: pthread_mutex_lock (drd_pthread_intercepts.c: 
580)
==20729==    by 0x58D2: void boost::call_once<void (*) 
()>(boost::once_flag&, void (*)()) (in ./thread)
==20729==    by 0x30CC: thread_proxy (in ./thread)
==20729==    by 0x3707B: vgDrd_thread_wrapper  
(drd_pthread_intercepts.c:272)
==20729==    by 0x228154: _pthread_start (in /usr/lib/libSystem.B.dylib)
==20729==    by 0x228011: thread_start (in /usr/lib/libSystem.B.dylib)
alarm sounded...
==20729==
==20729== ERROR SUMMARY: 5 errors from 5 contexts (suppressed: 725  
from 8)

The output on linux is similar.

Does this indicate a problem with valgrind's DRD tool, Boost.Thread,  
or both? Does any workaround exist?

Thanks in advance,
- Seth Fowler
Ion Gaztañaga | 2 Aug 07:05
Picon

Re: non-POD C++ objects and Boost.Interprocess

Selçuk Cevher escribió:
> Hi,
> 
> Is it possible to pass user-defined "non-POD" C++ class objects to 
> message queues and retrieve them back on the receiver side using 
> Boost.Interprocess ?
> 
> Thanks.

Yes, provided both processes are compiled with the same ABI, but 
remember that non-POD is limited to "non-virtual, non mutable static 
classes with non-raw pointers", the same classes you are allowed to put 
in managed_shared_memory. See:

"Limitations When Constructing Objects In Mapped Regions"

http://www.boost.org/doc/libs/1_39_0/doc/html/interprocess/sharedmemorybetweenprocesses.html

Best,

Ion
Archie14 | 2 Aug 14:24
Picon
Gravatar

Remove elements from accumulator

I am trying to use accumulator to calculate statistics in "rolling window", 
traversing the data. I searched accumulators library for a method to remove 
first N elements from the accumulator and did not find one.

Question: is is possible to remove first N values from the accumulator?
Eric Niebler | 2 Aug 17:45
Picon
Favicon
Gravatar

Re: Remove elements from accumulator

Archie14 wrote:
> I am trying to use accumulator to calculate statistics in "rolling window", 
> traversing the data. I searched accumulators library for a method to remove 
> first N elements from the accumulator and did not find one.
> 
> Question: is is possible to remove first N values from the accumulator?

No, but there are some rolling window statistical accumulators: 
rolling_sum and rolling_mean.

--

-- 
Eric Niebler
BoostPro Computing
http://www.boostpro.com

Gmane