Re: Issues with C# Swig Bindings, NUnit and Settings.instance().setEvaluationDate()

Posted by Henner Heck on
URL: http://quantlib.414.s1.nabble.com/Issues-with-C-Swig-Bindings-NUnit-and-Settings-instance-setEvaluationDate-tp9517p9522.html


I changed the pure virtual update() method in QuantLib::Observer
to this to get a breakpoint inside the observer that causes the error:

virtual void update() {
        DebugBreak();
}


Here is one quick scenario i got from the debugger when the DebugBreak()  
triggered:




- this 0x19ef7398 {observables_=[3]({px=0x19bfd760 pn={...}  
},{px=0x19d69608 pn={...} },{px=0x19dc5638 pn={...} })  
} QuantLib::Observer * const

+ __vfptr 0x62780ee8 const QuantLib::Observer::`vftable' *
- observables_ [3]({px=0x19bfd760 pn={...} },{px=0x19d69608 pn={...}  
},{px=0x19dc5638 pn={...}  
}) std::list<boost::shared_ptr<QuantLib::Observable>,std::allocator<boost::shared_ptr<QuantLib::Observable>  
> >

- [0] {px=0x19bfd760 pn={...} } boost::shared_ptr<QuantLib::Observable>
- px 0x19bfd760 {coupon_=??? discount_=??? gearing_=???  
...} QuantLib::Observable *
+ __vfptr 0x627c6054 const QuantLib::BlackIborCouponPricer::`vftable'{for  
`QuantLib::Observable'} *
- observers_ [13](0x19ef7e28 {iborIndex_={...} },0x19ef7d58  
{iborIndex_={...} },0x19ef7c88 {iborIndex_={...} },0x19ef7bb8  
{iborIndex_={...} },0x19ef7ae8 {iborIndex_={...} },0x19ef7a18  
{iborIndex_={...} },0x19ef7948 {iborIndex_={...} },0x19ef7878  
{iborIndex_={...} },0x19ef77a8 {iborIndex_={...} },0x19ef76d8  
{iborIndex_={...} },0x19ef7608 {iborIndex_={...} },0x19ef7538  
{iborIndex_={...} },0x19ef7468  
{iborIndex_=,...) std::list<QuantLib::Observer  
*,std::allocator<QuantLib::Observer *> >
+ [0] 0x19ef7e28 {iborIndex_={...} } QuantLib::Observer *
+ [1] 0x19ef7d58 {iborIndex_={...} } QuantLib::Observer *
+ [2] 0x19ef7c88 {iborIndex_={...} } QuantLib::Observer *
+ [3] 0x19ef7bb8 {iborIndex_={...} } QuantLib::Observer *
+ [4] 0x19ef7ae8 {iborIndex_={...} } QuantLib::Observer *
+ [5] 0x19ef7a18 {iborIndex_={...} } QuantLib::Observer *
+ [6] 0x19ef7948 {iborIndex_={...} } QuantLib::Observer *
+ [7] 0x19ef7878 {iborIndex_={...} } QuantLib::Observer *
+ [8] 0x19ef77a8 {iborIndex_={...} } QuantLib::Observer *
+ [9] 0x19ef76d8 {iborIndex_={...} } QuantLib::Observer *
+ [10] 0x19ef7608 {iborIndex_={...} } QuantLib::Observer *
+ [11] 0x19ef7538 {iborIndex_={...} } QuantLib::Observer *
+ [12] 0x19ef7468 {iborIndex_={...} } QuantLib::Observer *
+ pn {pi_=0x19eecfd0 } boost::detail::shared_count

- [1] {px=0x19d69608 pn={...} } boost::shared_ptr<QuantLib::Observable>
- px 0x19d69608 {observers_=[1218](0x19f17418 {iborIndex_={...}  
},0x19f17348 {iborIndex_={...} },0x19f17278 {iborIndex_={...} },0x19f171a8  
{iborIndex_={...} },0x19f170d8 {iborIndex_={...} },0x19f17008  
{iborIndex_={...} },0x19f16f38 {iborIndex_={...} },0x19f16e68  
{iborIndex_={...} },0x19f16d98 {iborIndex_={...} },0x19f16cc8  
{iborIndex_={...} },0x19f16bf8 {iborIndex_={...} },0x19f16b28 {iborIndex_=  
},   QuantLib::Observable *
+ __vfptr 0x6277f90c const QuantLib::Observable::`vftable' *
+ observers_ [1218](0x19f17418 {iborIndex_={...} },0x19f17348  
{iborIndex_={...} },0x19f17278 {iborIndex_={...} },0x19f171a8  
{iborIndex_={...} },0x19f170d8 {iborIndex_={...} },0x19f17008  
{iborIndex_={...} },0x19f16f38 {iborIndex_={...} },0x19f16e68  
{iborIndex_={...} },0x19f16d98 {iborIndex_={...} },0x19f16cc8  
{iborIndex_={...} },0x19f16bf8 {iborIndex_={...} },0x19f16b28  
{iborIndex_={...} },0x19f16a58  
{iborIndex,...) std::list<QuantLib::Observer  
*,std::allocator<QuantLib::Observer *> >
+ pn {pi_=0x19d685e8 } boost::detail::shared_count

- [2] {px=0x19dc5638 pn={...} } boost::shared_ptr<QuantLib::Observable>
- px 0x19dc5638 QuantLib::Observable *
+ [QuantLib::Euribor6M] {...} QuantLib::Euribor6M
+ __vfptr 0x627858c4 const QuantLib::Euribor6M::`vftable'{for  
`QuantLib::Index'} *
- observers_ [14](0x19ef7e28 {iborIndex_={...} },0x19ef7d58  
{iborIndex_={...} },0x19ef7c88 {iborIndex_={...} },0x19ef7bb8  
{iborIndex_={...} },0x19ef7ae8 {iborIndex_={...} },0x19ef7a18  
{iborIndex_={...} },0x19ef7948 {iborIndex_={...} },0x19ef7878  
{iborIndex_={...} },0x19ef77a8 {iborIndex_={...} },0x19ef76d8  
{iborIndex_={...} },0x19ef7608 {iborIndex_={...} },0x19ef7538  
{iborIndex_={...} },0x19ef7468  
{iborIndex_=,...) std::list<QuantLib::Observer  
*,std::allocator<QuantLib::Observer *> >
+ [0] 0x19ef7e28 {iborIndex_={...} } QuantLib::Observer *
+ [1] 0x19ef7d58 {iborIndex_={...} } QuantLib::Observer *
+ [2] 0x19ef7c88 {iborIndex_={...} } QuantLib::Observer *
+ [3] 0x19ef7bb8 {iborIndex_={...} } QuantLib::Observer *
+ [4] 0x19ef7ae8 {iborIndex_={...} } QuantLib::Observer *
+ [5] 0x19ef7a18 {iborIndex_={...} } QuantLib::Observer *
+ [6] 0x19ef7948 {iborIndex_={...} } QuantLib::Observer *
+ [7] 0x19ef7878 {iborIndex_={...} } QuantLib::Observer *
+ [8] 0x19ef77a8 {iborIndex_={...} } QuantLib::Observer *
+ [9] 0x19ef76d8 {iborIndex_={...} } QuantLib::Observer *
+ [10] 0x19ef7608 {iborIndex_={...} } QuantLib::Observer *
- [11] 0x19ef7538 {iborIndex_={...} } QuantLib::Observer *
+ [QuantLib::IborCoupon] {iborIndex_={...} } QuantLib::IborCoupon
+ __vfptr 0x627c5fc4 const QuantLib::IborCoupon::`vftable'{for  
`QuantLib::Observer'} *
+ observables_ [3]({px=0x19bfd760 pn={...} },{px=0x19d69608 pn={...}  
},{px=0x19dc5638 pn={...}  
}) std::list<boost::shared_ptr<QuantLib::Observable>,std::allocator<boost::shared_ptr<QuantLib::Observable>  
> >
- [12] 0x19ef7468 {iborIndex_={...} } QuantLib::Observer *
+ [QuantLib::IborCoupon] {iborIndex_={...} } QuantLib::IborCoupon
+ __vfptr 0x627c5fc4 const QuantLib::IborCoupon::`vftable'{for  
`QuantLib::Observer'} *
+ observables_ [3]({px=0x19bfd760 pn={...} },{px=0x19d69608 pn={...}  
},{px=0x19dc5638 pn={...}  
}) std::list<boost::shared_ptr<QuantLib::Observable>,std::allocator<boost::shared_ptr<QuantLib::Observable>  
> >
- [13] 0x19ef7398 {observables_=[3]({px=0x19bfd760 pn={...}  
},{px=0x19d69608 pn={...} },{px=0x19dc5638 pn={...} })  
} QuantLib::Observer *
- __vfptr 0x62780ee8 const QuantLib::Observer::`vftable' *
                [0] 0x61fd201c QuantLib::Observer::`vector deleting destructor'(unsigned  
int) *
                [1] 0x61fcd7b5 QuantLib::Observer::update(void) *
+ observables_ [3]({px=0x19bfd760 pn={...} },{px=0x19d69608 pn={...}  
},{px=0x19dc5638 pn={...}  
}) std::list<boost::shared_ptr<QuantLib::Observable>,std::allocator<boost::shared_ptr<QuantLib::Observable>  
> >
+ pn {pi_=0x19eeb5d0 } boost::detail::shared_count




The Call Stack:



  KernelBase.dll!761422a1()
  [Frames below may be incorrect and/or missing, no symbols loaded for  
KernelBase.dll]
> QuantLibJNI.dll!QuantLib::Observer::update()  Line 81 + 0x8 bytes C++
  QuantLibJNI.dll!QuantLib::Observable::notifyObservers()  Line 130 + 0x31  
bytes C++
  QuantLibJNI.dll!QuantLib::InterestRateIndex::update()  Line 94 C++
  QuantLibJNI.dll!QuantLib::Observable::notifyObservers()  Line 130 + 0x31  
bytes C++
  QuantLibJNI.dll!QuantLib::ObservableValue<QuantLib::Date>::operator=(const  
QuantLib::Date & t={...})  Line 81 C++
  QuantLibJNI.dll!QuantLib::Settings::DateProxy::operator=(const  
QuantLib::Date & d={...})  Line 37 C++
  QuantLibJNI.dll!Settings_setEvaluationDate(QuantLib::Settings *  
self=0x19d685a8, const QuantLib::Date & d={...})  Line 4384 C++
  QuantLibJNI.dll!Java_org_quantlib_QuantLibJNI_Settings_1setEvaluationDate(JNIEnv_  
* jenv=0x01ca4918, _jclass * jcls=0x003dfa4c, __int64 jarg1=433489320,  
_jobject * jarg1_=0x003dfa60, __int64 jarg2=433778680, _jobject *  
jarg2_=0x003dfa54)  Line 24282 + 0xd bytes C++
  0243e772()
  jvm.dll!6d8e3a9c()


The observable at index [2], an Euribor6M IborIndex, has 14 observers.
I assume all of them should be IborCoupons. The observer at index 13 is
recognized only as Observer, which seems odd, and it is also the observer
in which update() fails (this == 0x19ef7398). It seems to me that it is not
a fully constructed/destructed IborCoupon object.
In my final Euribor6M index i expect 21 coupons.

Best regards,
Henner Heck

------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and,
should the need arise, upgrade to a full multi-node Oracle RAC database
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev