]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
VG_(record_free_error) / VG_(record_freemismatch_error) are called
authorJulian Seward <jseward@acm.org>
Fri, 19 Apr 2002 15:43:37 +0000 (15:43 +0000)
committerJulian Seward <jseward@acm.org>
Fri, 19 Apr 2002 15:43:37 +0000 (15:43 +0000)
by the scheduler, not by generated code.  So pass in the relevant
ThreadState*; don't get it from VG_(get_current_tid)().

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@101

coregrind/vg_clientmalloc.c
coregrind/vg_errcontext.c
coregrind/vg_include.h
vg_clientmalloc.c
vg_errcontext.c
vg_include.h

index b1848405aa0f3c0c10728c1c8f7f88f148a4ad03..607c633b989d00e97862962f99a4dbf3392007b7 100644 (file)
@@ -334,14 +334,14 @@ void VG_(client_free) ( ThreadState* tst, void* ptrV, VgAllocKind kind )
    }
 
    if (sc == NULL) {
-      VG_(record_free_error) ( (Addr)ptrV );
+      VG_(record_free_error) ( tst, (Addr)ptrV );
       VGP_POPCC;
       return;
    }
 
    /* check if its a matching free() / delete / delete [] */
    if (kind != sc->allockind)
-      VG_(record_freemismatch_error) ( (Addr) ptrV );
+      VG_(record_freemismatch_error) ( tst, (Addr) ptrV );
 
    /* Remove the shadow chunk from the mallocd list. */
    remove_from_malloclist ( ml_no, sc );
@@ -440,7 +440,7 @@ void* VG_(client_realloc) ( ThreadState* tst, void* ptrV, UInt size_new )
    }
   
    if (sc == NULL) {
-      VG_(record_free_error) ( (Addr)ptrV );
+      VG_(record_free_error) ( tst, (Addr)ptrV );
       /* Perhaps we should keep going regardless. */
       VGP_POPCC;
       return NULL;
@@ -448,7 +448,7 @@ void* VG_(client_realloc) ( ThreadState* tst, void* ptrV, UInt size_new )
 
    if (sc->allockind != Vg_AllocMalloc) {
       /* can not realloc a range that was allocated with new or new [] */
-      VG_(record_freemismatch_error) ( (Addr)ptrV );
+      VG_(record_freemismatch_error) ( tst, (Addr)ptrV );
       /* but keep going anyway */
    }
 
index aa883d5bc2eef2125da5a993fc6274ca6cab8f82..3f44821456014c8f9eee26a98dea78e32b817efc 100644 (file)
@@ -546,7 +546,7 @@ static void VG_(maybe_add_context) ( ErrContext* ec )
 /*--- Exported fns                                         ---*/
 /*------------------------------------------------------------*/
 
-/* These are all called from generated code, so that the %EIP/%EBP
+/* These two are called from generated code, so that the %EIP/%EBP
    values that we need in order to create proper error messages are
    picked up out of VG_(baseBlock) rather than from the thread table
    (vg_threads in vg_scheduler.c). */
@@ -589,41 +589,39 @@ void VG_(record_address_error) ( Addr a, Int size, Bool isWrite )
    VG_(maybe_add_context) ( &ec );
 }
 
-void VG_(record_free_error) ( Addr a )
+
+/* These five are called not from generated code but in response to
+   requests passed back to the scheduler.  So we pick up %EIP/%EBP
+   values from the stored thread state, not from VG_(baseBlock).  */
+
+void VG_(record_free_error) ( ThreadState* tst, Addr a )
 {
    ErrContext ec;
    clear_ErrContext( &ec );
    ec.count   = 1;
    ec.next    = NULL;
-   ec.where   = VG_(get_ExeContext)( True, VG_(baseBlock)[VGOFF_(m_eip)], 
-                                           VG_(baseBlock)[VGOFF_(m_ebp)] );
+   ec.where   = VG_(get_ExeContext)( True, tst->m_eip, tst->m_ebp );
    ec.ekind   = FreeErr;
    ec.addr    = a;
-   ec.tid     = VG_(get_current_tid)();
+   ec.tid     = tst->tid;
    VG_(describe_addr) ( a, &ec.addrinfo );
    VG_(maybe_add_context) ( &ec );
 }
 
-void VG_(record_freemismatch_error) ( Addr a )
+void VG_(record_freemismatch_error) ( ThreadState* tst, Addr a )
 {
    ErrContext ec;
    clear_ErrContext( &ec );
    ec.count   = 1;
    ec.next    = NULL;
-   ec.where   = VG_(get_ExeContext)( True, VG_(baseBlock)[VGOFF_(m_eip)], 
-                                           VG_(baseBlock)[VGOFF_(m_ebp)] );
+   ec.where   = VG_(get_ExeContext)( True, tst->m_eip, tst->m_ebp );
    ec.ekind   = FreeMismatchErr;
    ec.addr    = a;
-   ec.tid     = VG_(get_current_tid)();
+   ec.tid     = tst->tid;
    VG_(describe_addr) ( a, &ec.addrinfo );
    VG_(maybe_add_context) ( &ec );
 }
 
-
-/* These three are called not from generated code but in response to
-   requests passed back to the scheduler.  So we pick up %EIP/%EBP
-   values from the stored thread state, not from VG_(baseBlock).  */
-
 void VG_(record_jump_error) ( ThreadState* tst, Addr a )
 {
    ErrContext ec;
index 3f9a10ce12d0bae2763274a352b6aa512e927383..1c72ac0d0595cdcc196bd4dd6f1a94352ad54992 100644 (file)
@@ -1061,8 +1061,8 @@ extern Bool VG_(eq_ExeContext_all) ( ExeContext* e1, ExeContext* e2 );
 extern void VG_(load_suppressions)    ( void );
 extern void VG_(show_all_errors)      ( void );
 extern void VG_(record_value_error)   ( Int size );
-extern void VG_(record_free_error)    ( Addr a );
-extern void VG_(record_freemismatch_error)    ( Addr a );
+extern void VG_(record_free_error)    ( ThreadState* tst, Addr a );
+extern void VG_(record_freemismatch_error)    ( ThreadState* tst, Addr a );
 extern void VG_(record_address_error) ( Addr a, Int size, 
                                         Bool isWrite );
 
index b1848405aa0f3c0c10728c1c8f7f88f148a4ad03..607c633b989d00e97862962f99a4dbf3392007b7 100644 (file)
@@ -334,14 +334,14 @@ void VG_(client_free) ( ThreadState* tst, void* ptrV, VgAllocKind kind )
    }
 
    if (sc == NULL) {
-      VG_(record_free_error) ( (Addr)ptrV );
+      VG_(record_free_error) ( tst, (Addr)ptrV );
       VGP_POPCC;
       return;
    }
 
    /* check if its a matching free() / delete / delete [] */
    if (kind != sc->allockind)
-      VG_(record_freemismatch_error) ( (Addr) ptrV );
+      VG_(record_freemismatch_error) ( tst, (Addr) ptrV );
 
    /* Remove the shadow chunk from the mallocd list. */
    remove_from_malloclist ( ml_no, sc );
@@ -440,7 +440,7 @@ void* VG_(client_realloc) ( ThreadState* tst, void* ptrV, UInt size_new )
    }
   
    if (sc == NULL) {
-      VG_(record_free_error) ( (Addr)ptrV );
+      VG_(record_free_error) ( tst, (Addr)ptrV );
       /* Perhaps we should keep going regardless. */
       VGP_POPCC;
       return NULL;
@@ -448,7 +448,7 @@ void* VG_(client_realloc) ( ThreadState* tst, void* ptrV, UInt size_new )
 
    if (sc->allockind != Vg_AllocMalloc) {
       /* can not realloc a range that was allocated with new or new [] */
-      VG_(record_freemismatch_error) ( (Addr)ptrV );
+      VG_(record_freemismatch_error) ( tst, (Addr)ptrV );
       /* but keep going anyway */
    }
 
index aa883d5bc2eef2125da5a993fc6274ca6cab8f82..3f44821456014c8f9eee26a98dea78e32b817efc 100644 (file)
@@ -546,7 +546,7 @@ static void VG_(maybe_add_context) ( ErrContext* ec )
 /*--- Exported fns                                         ---*/
 /*------------------------------------------------------------*/
 
-/* These are all called from generated code, so that the %EIP/%EBP
+/* These two are called from generated code, so that the %EIP/%EBP
    values that we need in order to create proper error messages are
    picked up out of VG_(baseBlock) rather than from the thread table
    (vg_threads in vg_scheduler.c). */
@@ -589,41 +589,39 @@ void VG_(record_address_error) ( Addr a, Int size, Bool isWrite )
    VG_(maybe_add_context) ( &ec );
 }
 
-void VG_(record_free_error) ( Addr a )
+
+/* These five are called not from generated code but in response to
+   requests passed back to the scheduler.  So we pick up %EIP/%EBP
+   values from the stored thread state, not from VG_(baseBlock).  */
+
+void VG_(record_free_error) ( ThreadState* tst, Addr a )
 {
    ErrContext ec;
    clear_ErrContext( &ec );
    ec.count   = 1;
    ec.next    = NULL;
-   ec.where   = VG_(get_ExeContext)( True, VG_(baseBlock)[VGOFF_(m_eip)], 
-                                           VG_(baseBlock)[VGOFF_(m_ebp)] );
+   ec.where   = VG_(get_ExeContext)( True, tst->m_eip, tst->m_ebp );
    ec.ekind   = FreeErr;
    ec.addr    = a;
-   ec.tid     = VG_(get_current_tid)();
+   ec.tid     = tst->tid;
    VG_(describe_addr) ( a, &ec.addrinfo );
    VG_(maybe_add_context) ( &ec );
 }
 
-void VG_(record_freemismatch_error) ( Addr a )
+void VG_(record_freemismatch_error) ( ThreadState* tst, Addr a )
 {
    ErrContext ec;
    clear_ErrContext( &ec );
    ec.count   = 1;
    ec.next    = NULL;
-   ec.where   = VG_(get_ExeContext)( True, VG_(baseBlock)[VGOFF_(m_eip)], 
-                                           VG_(baseBlock)[VGOFF_(m_ebp)] );
+   ec.where   = VG_(get_ExeContext)( True, tst->m_eip, tst->m_ebp );
    ec.ekind   = FreeMismatchErr;
    ec.addr    = a;
-   ec.tid     = VG_(get_current_tid)();
+   ec.tid     = tst->tid;
    VG_(describe_addr) ( a, &ec.addrinfo );
    VG_(maybe_add_context) ( &ec );
 }
 
-
-/* These three are called not from generated code but in response to
-   requests passed back to the scheduler.  So we pick up %EIP/%EBP
-   values from the stored thread state, not from VG_(baseBlock).  */
-
 void VG_(record_jump_error) ( ThreadState* tst, Addr a )
 {
    ErrContext ec;
index 3f9a10ce12d0bae2763274a352b6aa512e927383..1c72ac0d0595cdcc196bd4dd6f1a94352ad54992 100644 (file)
@@ -1061,8 +1061,8 @@ extern Bool VG_(eq_ExeContext_all) ( ExeContext* e1, ExeContext* e2 );
 extern void VG_(load_suppressions)    ( void );
 extern void VG_(show_all_errors)      ( void );
 extern void VG_(record_value_error)   ( Int size );
-extern void VG_(record_free_error)    ( Addr a );
-extern void VG_(record_freemismatch_error)    ( Addr a );
+extern void VG_(record_free_error)    ( ThreadState* tst, Addr a );
+extern void VG_(record_freemismatch_error)    ( ThreadState* tst, Addr a );
 extern void VG_(record_address_error) ( Addr a, Int size, 
                                         Bool isWrite );