]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Add patch from Nick to get proper backtraces in
authorJulian Seward <jseward@acm.org>
Sun, 6 Jul 2003 00:54:47 +0000 (00:54 +0000)
committerJulian Seward <jseward@acm.org>
Sun, 6 Jul 2003 00:54:47 +0000 (00:54 +0000)
MC_(get_or_set_vbits_for_client).

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

addrcheck/ac_main.c
memcheck/mac_needs.c
memcheck/mac_shared.h
memcheck/mc_clientreqs.c
memcheck/mc_errcontext.c
memcheck/mc_include.h
memcheck/mc_main.c

index fc70ce9361a5f4201e9f001ebb6da1ec0b579c13..c7e9dea14a759668af0dad11853781efc5fcb818 100644 (file)
@@ -762,7 +762,7 @@ static void ac_ACCESS4_SLOWLY ( Addr a )
    if (!MAC_(clo_partial_loads_ok) 
        || ((a & 3) != 0)
        || (!a0ok && !a1ok && !a2ok && !a3ok)) {
-      MAC_(record_address_error)( a, 4, False );
+      MAC_(record_address_error)( /*tst*/NULL, a, 4, False );
       return;
    }
 
@@ -789,7 +789,7 @@ static void ac_ACCESS2_SLOWLY ( Addr a )
 
    /* If an address error has happened, report it. */
    if (aerr) {
-      MAC_(record_address_error)( a, 2, False );
+      MAC_(record_address_error)( /*tst*/NULL, a, 2, False );
    }
 }
 
@@ -803,7 +803,7 @@ static void ac_ACCESS1_SLOWLY ( Addr a )
 
    /* If an address error has happened, report it. */
    if (aerr) {
-      MAC_(record_address_error)( a, 1, False );
+      MAC_(record_address_error)( /*tst*/NULL, a, 1, False );
    }
 }
 
@@ -908,7 +908,7 @@ void ac_fpu_ACCESS_check_SLOWLY ( Addr addr, Int size )
    }
 
    if (aerr) {
-      MAC_(record_address_error)( addr, size, False );
+      MAC_(record_address_error)( /*tst*/NULL, addr, size, False );
    }
 }
 
index 1713bfd789618a8c8befe77ecdadc8d86963ffca..daec93849387c71b16ac47f27d70ad4282242aaf 100644 (file)
@@ -382,9 +382,10 @@ static Bool is_just_below_ESP( Addr esp, Addr aa )
       return False;
 }
 
-/* This one called from generated code. */
+/* This one called from generated code and non-generated code. */
 
-void MAC_(record_address_error) ( Addr a, Int size, Bool isWrite )
+void MAC_(record_address_error) ( ThreadState* tst, Addr a, Int size,
+                                  Bool isWrite )
 {
    MAC_Error err_extra;
    Bool      just_below_esp;
@@ -401,7 +402,7 @@ void MAC_(record_address_error) ( Addr a, Int size, Bool isWrite )
    err_extra.size    = size;
    err_extra.addrinfo.akind     = Undescribed;
    err_extra.addrinfo.maybe_gcc = just_below_esp;
-   VG_(maybe_record_error)( NULL, AddrErr, a, /*s*/NULL, &err_extra );
+   VG_(maybe_record_error)( tst, AddrErr, a, /*s*/NULL, &err_extra );
 }
 
 /* These ones are called from non-generated code */
index 2beb31e0430563023cc3cc1ecbebde48118cdd86..93bedab6d7751f4a4143d55a0175d758e7e1ea2f 100644 (file)
@@ -292,7 +292,8 @@ extern void MAC_(new_block) ( ThreadState* tst, Addr p, UInt size,
 extern void MAC_(handle_free) ( ThreadState* tst, Addr p, UInt rzB,
                                 MAC_AllocKind kind );
 
-extern void MAC_(record_address_error)     ( Addr a, Int size, Bool isWrite );
+extern void MAC_(record_address_error)     ( ThreadState* tst, Addr a,
+                                             Int size, Bool isWrite );
 extern void MAC_(record_core_mem_error)    ( ThreadState* tst, Bool isWrite,
                                              Char* s );
 extern void MAC_(record_param_error)       ( ThreadState* tst, Addr a,   
index d99cfa7f938569aa44315106f7752b257b66dcc6..bc703a4d3e93850324cb3b46e909ca8fbd386aee 100644 (file)
@@ -219,7 +219,7 @@ Bool SK_(handle_client_request) ( ThreadState* tst, UInt* arg, UInt* ret )
             error. */
          /* VG_(printf)("get_vbits %p %p %d\n", arg[1], arg[2], arg[3] ); */
          *ret = MC_(get_or_set_vbits_for_client)
-                   ( arg[1], arg[2], arg[3], False /* get them */ );
+                   ( tst, arg[1], arg[2], arg[3], False /* get them */ );
          break;
 
       case VG_USERREQ__SET_VBITS:
@@ -227,7 +227,7 @@ Bool SK_(handle_client_request) ( ThreadState* tst, UInt* arg, UInt* ret )
             error. */
          /* VG_(printf)("set_vbits %p %p %d\n", arg[1], arg[2], arg[3] ); */
          *ret = MC_(get_or_set_vbits_for_client)
-                   ( arg[1], arg[2], arg[3], True /* set them */ );
+                   ( tst, arg[1], arg[2], arg[3], True /* set them */ );
          break;
 
       default:
index a5f1ea58fbeceae55fb6378b32762d25661a1eed..9eb0ae8b31ecde4a32b0fe87acb36c8befe876ec 100644 (file)
@@ -133,14 +133,14 @@ void SK_(pp_SkinError) ( Error* err )
 
 /* Creates a copy of the `extra' part, updates the copy with address info if
    necessary, and returns the copy. */
-/* This one called from generated code. */
-void MC_(record_value_error) ( Int size )
+/* This one called from generated code and non-generated code. */
+void MC_(record_value_error) ( ThreadState* tst, Int size )
 {
    MAC_Error err_extra;
 
    MAC_(clear_MAC_Error)( &err_extra );
    err_extra.size = size;
-   VG_(maybe_record_error)( NULL, ValueErr, /*addr*/0, /*s*/NULL, &err_extra );
+   VG_(maybe_record_error)( tst, ValueErr, /*addr*/0, /*s*/NULL, &err_extra );
 }
 
 /* These two called from non-generated code */
index b0a98645482126dfe244bf8278bd883e6f5ddd31..63aee187b820c5e554f1c2404ec0fc812f513696 100644 (file)
@@ -144,6 +144,7 @@ extern Bool MC_(check_readable) ( Addr a, UInt len, Addr* bad_addr );
 extern void MC_(detect_memory_leaks) ( void );
 
 extern Int  MC_(get_or_set_vbits_for_client) ( 
+               ThreadState* tst,
                Addr dataV, 
                Addr vbitsV, 
                UInt size, 
@@ -156,7 +157,7 @@ extern void MC_(show_client_block_stats) ( void );
 
 
 /* Functions defined in vg_memcheck_errcontext.c */
-extern void MC_(record_value_error)  ( Int size );
+extern void MC_(record_value_error)  ( ThreadState* tst, Int size );
 extern void MC_(record_user_error)   ( ThreadState* tst, Addr a, Bool isWrite );
 extern void MC_(record_overlap_error)( ThreadState* tst, Char* function );
 
index 38a6ae970b5f04c4e34f7010360561643ebd4ae6..167a2ba82b60882fb03bf9be16390b274dceb8f0 100644 (file)
@@ -938,7 +938,7 @@ static UInt mc_rd_V4_SLOWLY ( Addr a )
    if (!MAC_(clo_partial_loads_ok) 
        || ((a & 3) != 0)
        || (!a0ok && !a1ok && !a2ok && !a3ok)) {
-      MAC_(record_address_error)( a, 4, False );
+      MAC_(record_address_error)( /*tst*/NULL, a, 4, False );
       return (VGM_BYTE_VALID << 24) | (VGM_BYTE_VALID << 16) 
              | (VGM_BYTE_VALID << 8) | VGM_BYTE_VALID;
    }
@@ -981,7 +981,7 @@ static void mc_wr_V4_SLOWLY ( Addr a, UInt vbytes )
 
    /* If an address error has happened, report it. */
    if (aerr)
-      MAC_(record_address_error)( a, 4, True );
+      MAC_(record_address_error)( /*tst*/NULL, a, 4, True );
 }
 
 static UInt mc_rd_V2_SLOWLY ( Addr a )
@@ -1000,7 +1000,7 @@ static UInt mc_rd_V2_SLOWLY ( Addr a )
 
    /* If an address error has happened, report it. */
    if (aerr) {
-      MAC_(record_address_error)( a, 2, False );
+      MAC_(record_address_error)( /*tst*/NULL, a, 2, False );
       vw = (VGM_BYTE_INVALID << 24) | (VGM_BYTE_INVALID << 16) 
            | (VGM_BYTE_VALID << 8) | (VGM_BYTE_VALID);
    }
@@ -1022,7 +1022,7 @@ static void mc_wr_V2_SLOWLY ( Addr a, UInt vbytes )
 
    /* If an address error has happened, report it. */
    if (aerr)
-      MAC_(record_address_error)( a, 2, True );
+      MAC_(record_address_error)( /*tst*/NULL, a, 2, True );
 }
 
 static UInt mc_rd_V1_SLOWLY ( Addr a )
@@ -1039,7 +1039,7 @@ static UInt mc_rd_V1_SLOWLY ( Addr a )
 
    /* If an address error has happened, report it. */
    if (aerr) {
-      MAC_(record_address_error)( a, 1, False );
+      MAC_(record_address_error)( /*tst*/NULL, a, 1, False );
       vw = (VGM_BYTE_INVALID << 24) | (VGM_BYTE_INVALID << 16) 
            | (VGM_BYTE_INVALID << 8) | (VGM_BYTE_VALID);
    }
@@ -1058,7 +1058,7 @@ static void mc_wr_V1_SLOWLY ( Addr a, UInt vbytes )
 
    /* If an address error has happened, report it. */
    if (aerr)
-      MAC_(record_address_error)( a, 1, True );
+      MAC_(record_address_error)( /*tst*/NULL, a, 1, True );
 }
 
 
@@ -1069,22 +1069,22 @@ static void mc_wr_V1_SLOWLY ( Addr a, UInt vbytes )
 
 void MC_(helperc_value_check0_fail) ( void )
 {
-   MC_(record_value_error) ( 0 );
+   MC_(record_value_error) ( /*tst*/NULL, 0 );
 }
 
 void MC_(helperc_value_check1_fail) ( void )
 {
-   MC_(record_value_error) ( 1 );
+   MC_(record_value_error) ( /*tst*/NULL, 1 );
 }
 
 void MC_(helperc_value_check2_fail) ( void )
 {
-   MC_(record_value_error) ( 2 );
+   MC_(record_value_error) ( /*tst*/NULL, 2 );
 }
 
 void MC_(helperc_value_check4_fail) ( void )
 {
-   MC_(record_value_error) ( 4 );
+   MC_(record_value_error) ( /*tst*/NULL, 4 );
 }
 
 
@@ -1290,10 +1290,10 @@ void mc_fpu_read_check_SLOWLY ( Addr addr, Int size )
    }
 
    if (aerr) {
-      MAC_(record_address_error)( addr, size, False );
+      MAC_(record_address_error)( /*tst*/NULL, addr, size, False );
    } else {
      if (verr)
-        MC_(record_value_error)( size );
+        MC_(record_value_error)( /*tst*/NULL, size );
    }
 }
 
@@ -1320,7 +1320,7 @@ void mc_fpu_write_check_SLOWLY ( Addr addr, Int size )
       }
    }
    if (aerr) {
-      MAC_(record_address_error)( addr, size, True );
+      MAC_(record_address_error)( /*tst*/NULL, addr, size, True );
    }
 }
 
@@ -1332,6 +1332,7 @@ void mc_fpu_write_check_SLOWLY ( Addr addr, Int size )
 /* Copy Vbits for src into vbits. Returns: 1 == OK, 2 == alignment
    error, 3 == addressing error. */
 Int MC_(get_or_set_vbits_for_client) ( 
+   ThreadState* tst,
    Addr dataV, 
    Addr vbitsV, 
    UInt size, 
@@ -1344,6 +1345,8 @@ Int MC_(get_or_set_vbits_for_client) (
    UInt* vbits = (UInt*)vbitsV;
    UInt  szW   = size / 4; /* sigh */
    UInt  i;
+   UInt* dataP  = NULL; /* bogus init to keep gcc happy */
+   UInt* vbitsP = NULL; /* ditto */
 
    /* Check alignment of args. */
    if (!(IS_ALIGNED4_ADDR(data) && IS_ALIGNED4_ADDR(vbits)))
@@ -1353,8 +1356,8 @@ Int MC_(get_or_set_vbits_for_client) (
   
    /* Check that arrays are addressible. */
    for (i = 0; i < szW; i++) {
-      UInt* dataP  = &data[i];
-      UInt* vbitsP = &vbits[i];
+      dataP  = &data[i];
+      vbitsP = &vbits[i];
       if (get_abits4_ALIGNED((Addr)dataP) != VGM_NIBBLE_VALID) {
          addressibleD = False;
          break;
@@ -1365,12 +1368,12 @@ Int MC_(get_or_set_vbits_for_client) (
       }
    }
    if (!addressibleD) {
-      MAC_(record_address_error)( dataV, size
+      MAC_(record_address_error)( tst, (Addr)dataP, 4
                                   setting ? True : False );
       return 3;
    }
    if (!addressibleV) {
-      MAC_(record_address_error)( vbitsV, size
+      MAC_(record_address_error)( tst, (Addr)vbitsP, 4
                                   setting ? False : True );
       return 3;
    }
@@ -1380,7 +1383,7 @@ Int MC_(get_or_set_vbits_for_client) (
       /* setting */
       for (i = 0; i < szW; i++) {
          if (get_vbytes4_ALIGNED( (Addr)&vbits[i] ) != VGM_WORD_VALID)
-            MC_(record_value_error)(4);
+            MC_(record_value_error)(tst, 4);
          set_vbytes4_ALIGNED( (Addr)&data[i], vbits[i] );
       }
    } else {