From: Julian Seward Date: Wed, 1 May 2002 21:46:38 +0000 (+0000) Subject: Fix free and free-mismatch err so the top frame in the bt isn't skipped. X-Git-Tag: svn/VALGRIND_1_0_3~262 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=50ca1d2fc22a764416135f924849a05c85b68e89;p=thirdparty%2Fvalgrind.git Fix free and free-mismatch err so the top frame in the bt isn't skipped. Put a better example of free-mismatch error in the manual. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@190 --- diff --git a/cachegrind/docs/manual.html b/cachegrind/docs/manual.html index db1d28326f..8a24c85cf6 100644 --- a/cachegrind/docs/manual.html +++ b/cachegrind/docs/manual.html @@ -792,18 +792,19 @@ be told that -- making duplicate frees of the same block easy to spot.

2.6.4  When a block is freed with an inappropriate deallocation function

-For example: +In the following example, a block allocated with new [] +has wrongly been deallocated with free:
   Mismatched free() / delete / delete []
-     at 0x40303847: DeviceContextImpl::~DeviceContextImpl(void)
-     by 0x45149BCB: nsDeviceContextGTK::~nsDeviceContextGTK(void)
-     by 0x4030341A: DeviceContextImpl::Release(void)
-     by 0x460C0CAC: nsBaseWidget::OnDestroy(void)
-     Address 0x41C11A7C is 0 bytes inside a block of size 120 alloc'd
-     at 0x40040BEC: malloc (vg_clientfuncs.c:100)
-     by 0x4516DAAC: ??? (../../gcc-2.95.3/gcc/cp/new1.cc:78)
-     by 0x4515FA11: nsDeviceContextGTKConstructor(nsISupports *, ...
-     by 0x40553ABB: nsGenericFactory::CreateInstance(nsISupports *, ...
+     at 0x40043249: free (vg_clientfuncs.c:171)
+     by 0x4102BB4E: QGArray::~QGArray(void) (tools/qgarray.cpp:149)
+     by 0x4C261C41: PptDoc::~PptDoc(void) (include/qmemarray.h:60)
+     by 0x4C261F0E: PptXml::~PptXml(void) (pptxml.cc:44)
+     Address 0x4BB292A8 is 0 bytes inside a block of size 64 alloc'd
+     at 0x4004318C: __builtin_vec_new (vg_clientfuncs.c:152)
+     by 0x4C21BC15: KLaola::readSBStream(int) const (klaola.cc:314)
+     by 0x4C21C155: KLaola::stream(KLaola::OLENode const *) (klaola.cc:416)
+     by 0x4C21788F: OLEFilter::convert(QCString const &) (olefilter.cc:272)
 
The following was told to me be the KDE 3 developers. I didn't know any of it myself. They also implemented the check itself. diff --git a/coregrind/docs/manual.html b/coregrind/docs/manual.html index db1d28326f..8a24c85cf6 100644 --- a/coregrind/docs/manual.html +++ b/coregrind/docs/manual.html @@ -792,18 +792,19 @@ be told that -- making duplicate frees of the same block easy to spot.

2.6.4  When a block is freed with an inappropriate deallocation function

-For example: +In the following example, a block allocated with new [] +has wrongly been deallocated with free:
   Mismatched free() / delete / delete []
-     at 0x40303847: DeviceContextImpl::~DeviceContextImpl(void)
-     by 0x45149BCB: nsDeviceContextGTK::~nsDeviceContextGTK(void)
-     by 0x4030341A: DeviceContextImpl::Release(void)
-     by 0x460C0CAC: nsBaseWidget::OnDestroy(void)
-     Address 0x41C11A7C is 0 bytes inside a block of size 120 alloc'd
-     at 0x40040BEC: malloc (vg_clientfuncs.c:100)
-     by 0x4516DAAC: ??? (../../gcc-2.95.3/gcc/cp/new1.cc:78)
-     by 0x4515FA11: nsDeviceContextGTKConstructor(nsISupports *, ...
-     by 0x40553ABB: nsGenericFactory::CreateInstance(nsISupports *, ...
+     at 0x40043249: free (vg_clientfuncs.c:171)
+     by 0x4102BB4E: QGArray::~QGArray(void) (tools/qgarray.cpp:149)
+     by 0x4C261C41: PptDoc::~PptDoc(void) (include/qmemarray.h:60)
+     by 0x4C261F0E: PptXml::~PptXml(void) (pptxml.cc:44)
+     Address 0x4BB292A8 is 0 bytes inside a block of size 64 alloc'd
+     at 0x4004318C: __builtin_vec_new (vg_clientfuncs.c:152)
+     by 0x4C21BC15: KLaola::readSBStream(int) const (klaola.cc:314)
+     by 0x4C21C155: KLaola::stream(KLaola::OLENode const *) (klaola.cc:416)
+     by 0x4C21788F: OLEFilter::convert(QCString const &) (olefilter.cc:272)
 
The following was told to me be the KDE 3 developers. I didn't know any of it myself. They also implemented the check itself. diff --git a/coregrind/vg_errcontext.c b/coregrind/vg_errcontext.c index fae6df0987..bf0cc5c394 100644 --- a/coregrind/vg_errcontext.c +++ b/coregrind/vg_errcontext.c @@ -641,7 +641,7 @@ void VG_(record_free_error) ( ThreadState* tst, Addr a ) clear_ErrContext( &ec ); ec.count = 1; ec.next = NULL; - ec.where = VG_(get_ExeContext)( True, tst->m_eip, tst->m_ebp ); + ec.where = VG_(get_ExeContext)( False, tst->m_eip, tst->m_ebp ); ec.ekind = FreeErr; ec.addr = a; ec.tid = tst->tid; @@ -659,7 +659,7 @@ void VG_(record_freemismatch_error) ( ThreadState* tst, Addr a ) clear_ErrContext( &ec ); ec.count = 1; ec.next = NULL; - ec.where = VG_(get_ExeContext)( True, tst->m_eip, tst->m_ebp ); + ec.where = VG_(get_ExeContext)( False, tst->m_eip, tst->m_ebp ); ec.ekind = FreeMismatchErr; ec.addr = a; ec.tid = tst->tid; diff --git a/docs/manual.html b/docs/manual.html index db1d28326f..8a24c85cf6 100644 --- a/docs/manual.html +++ b/docs/manual.html @@ -792,18 +792,19 @@ be told that -- making duplicate frees of the same block easy to spot.

2.6.4  When a block is freed with an inappropriate deallocation function

-For example: +In the following example, a block allocated with new [] +has wrongly been deallocated with free:
   Mismatched free() / delete / delete []
-     at 0x40303847: DeviceContextImpl::~DeviceContextImpl(void)
-     by 0x45149BCB: nsDeviceContextGTK::~nsDeviceContextGTK(void)
-     by 0x4030341A: DeviceContextImpl::Release(void)
-     by 0x460C0CAC: nsBaseWidget::OnDestroy(void)
-     Address 0x41C11A7C is 0 bytes inside a block of size 120 alloc'd
-     at 0x40040BEC: malloc (vg_clientfuncs.c:100)
-     by 0x4516DAAC: ??? (../../gcc-2.95.3/gcc/cp/new1.cc:78)
-     by 0x4515FA11: nsDeviceContextGTKConstructor(nsISupports *, ...
-     by 0x40553ABB: nsGenericFactory::CreateInstance(nsISupports *, ...
+     at 0x40043249: free (vg_clientfuncs.c:171)
+     by 0x4102BB4E: QGArray::~QGArray(void) (tools/qgarray.cpp:149)
+     by 0x4C261C41: PptDoc::~PptDoc(void) (include/qmemarray.h:60)
+     by 0x4C261F0E: PptXml::~PptXml(void) (pptxml.cc:44)
+     Address 0x4BB292A8 is 0 bytes inside a block of size 64 alloc'd
+     at 0x4004318C: __builtin_vec_new (vg_clientfuncs.c:152)
+     by 0x4C21BC15: KLaola::readSBStream(int) const (klaola.cc:314)
+     by 0x4C21C155: KLaola::stream(KLaola::OLENode const *) (klaola.cc:416)
+     by 0x4C21788F: OLEFilter::convert(QCString const &) (olefilter.cc:272)
 
The following was told to me be the KDE 3 developers. I didn't know any of it myself. They also implemented the check itself. diff --git a/memcheck/docs/manual.html b/memcheck/docs/manual.html index db1d28326f..8a24c85cf6 100644 --- a/memcheck/docs/manual.html +++ b/memcheck/docs/manual.html @@ -792,18 +792,19 @@ be told that -- making duplicate frees of the same block easy to spot.

2.6.4  When a block is freed with an inappropriate deallocation function

-For example: +In the following example, a block allocated with new [] +has wrongly been deallocated with free:
   Mismatched free() / delete / delete []
-     at 0x40303847: DeviceContextImpl::~DeviceContextImpl(void)
-     by 0x45149BCB: nsDeviceContextGTK::~nsDeviceContextGTK(void)
-     by 0x4030341A: DeviceContextImpl::Release(void)
-     by 0x460C0CAC: nsBaseWidget::OnDestroy(void)
-     Address 0x41C11A7C is 0 bytes inside a block of size 120 alloc'd
-     at 0x40040BEC: malloc (vg_clientfuncs.c:100)
-     by 0x4516DAAC: ??? (../../gcc-2.95.3/gcc/cp/new1.cc:78)
-     by 0x4515FA11: nsDeviceContextGTKConstructor(nsISupports *, ...
-     by 0x40553ABB: nsGenericFactory::CreateInstance(nsISupports *, ...
+     at 0x40043249: free (vg_clientfuncs.c:171)
+     by 0x4102BB4E: QGArray::~QGArray(void) (tools/qgarray.cpp:149)
+     by 0x4C261C41: PptDoc::~PptDoc(void) (include/qmemarray.h:60)
+     by 0x4C261F0E: PptXml::~PptXml(void) (pptxml.cc:44)
+     Address 0x4BB292A8 is 0 bytes inside a block of size 64 alloc'd
+     at 0x4004318C: __builtin_vec_new (vg_clientfuncs.c:152)
+     by 0x4C21BC15: KLaola::readSBStream(int) const (klaola.cc:314)
+     by 0x4C21C155: KLaola::stream(KLaola::OLENode const *) (klaola.cc:416)
+     by 0x4C21788F: OLEFilter::convert(QCString const &) (olefilter.cc:272)
 
The following was told to me be the KDE 3 developers. I didn't know any of it myself. They also implemented the check itself. diff --git a/vg_errcontext.c b/vg_errcontext.c index fae6df0987..bf0cc5c394 100644 --- a/vg_errcontext.c +++ b/vg_errcontext.c @@ -641,7 +641,7 @@ void VG_(record_free_error) ( ThreadState* tst, Addr a ) clear_ErrContext( &ec ); ec.count = 1; ec.next = NULL; - ec.where = VG_(get_ExeContext)( True, tst->m_eip, tst->m_ebp ); + ec.where = VG_(get_ExeContext)( False, tst->m_eip, tst->m_ebp ); ec.ekind = FreeErr; ec.addr = a; ec.tid = tst->tid; @@ -659,7 +659,7 @@ void VG_(record_freemismatch_error) ( ThreadState* tst, Addr a ) clear_ErrContext( &ec ); ec.count = 1; ec.next = NULL; - ec.where = VG_(get_ExeContext)( True, tst->m_eip, tst->m_ebp ); + ec.where = VG_(get_ExeContext)( False, tst->m_eip, tst->m_ebp ); ec.ekind = FreeMismatchErr; ec.addr = a; ec.tid = tst->tid;