]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Two minor changes:
authorNicholas Nethercote <njn@valgrind.org>
Tue, 28 Jan 2003 19:59:38 +0000 (19:59 +0000)
committerNicholas Nethercote <njn@valgrind.org>
Tue, 28 Jan 2003 19:59:38 +0000 (19:59 +0000)
  - When recording errors, VG_(dup_extra_and_update)() previously was only
    called if the 'extra' field was non-NULL.  Now it's always called.
    This is for two reasons:

      a. The 'extra' field could be holding a non-pointer value that just
         happens to be 0
      b. The skin might want to update the error, even if it doesn't use
         the 'extra' field.

    A pretty minor change that shouldn't upset anybody.

  - Made the ExeContext 'where' field of an error visible to skins, by
    adding VG_(get_error_where)().  This can be useful, eg. for comparing
    errors for equality.

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

coregrind/vg_errcontext.c
coregrind/vg_include.h
coregrind/vg_needs.c

index 49d208fbff41edc40d9bab0541ceb2e6b25d2b38..6ba7343a9115c77bdcecd2cd16b29497b20014e4 100644 (file)
@@ -315,8 +315,7 @@ void VG_(maybe_record_error) ( ThreadState* tst,
    /* OK, we're really going to collect it.  First make a copy,
       because the error context is on the stack and will disappear shortly.
       We can duplicate the main part ourselves, but use
-      SK_(dup_extra_and_update) to duplicate the `extra' part (unless it's
-      NULL).
+      SK_(dup_extra_and_update) to duplicate the `extra' part.
      
       SK_(dup_extra_and_update) can also update the `extra' part.  This is
       for when there are more details to fill in which take time to work out
@@ -326,9 +325,7 @@ void VG_(maybe_record_error) ( ThreadState* tst,
     */
    p = VG_(arena_malloc)(VG_AR_ERRORS, sizeof(Error));
    *p = err;
-   if (NULL != err.extra)
-      p->extra = SK_(dup_extra_and_update)(p);
-
+   p->extra = SK_(dup_extra_and_update)(p);
    p->next = vg_errors;
    p->supp = is_suppressible_error(&err);
    vg_errors = p;
index 509697d9f687937164e4bbd66a11e255ad6b301b..dcd03265cd2b8936f4c7e2fd8903271e19d3b4c1 100644 (file)
@@ -1188,7 +1188,6 @@ struct _Error {
    /* NULL if unsuppressed; or ptr to suppression record. */
    Supp* supp;
    Int count;
-   ExeContext* where;
    ThreadId tid;
    /* These record %EIP, %ESP and %EBP at the error point.  They
       are only used to make GDB-attaching convenient; there is no
@@ -1199,6 +1198,8 @@ struct _Error {
    UInt m_ebp;
 
    /* The skin-specific part */
+   /* Initialised by core */
+   ExeContext* where;
    /* Used by ALL.  Must be in the range (0..) */
    Int ekind;
    /* Used frequently */
index c725f954177e23b6f29d065527c4efe515b550cf..2caea8dfc29c40e5ba363f154f29aa120d0e4467 100644 (file)
@@ -277,6 +277,11 @@ void VG_(set_supp_extra)  ( Supp* su, void* extra )
 /*--------------------------------------------------------------------*/
 /* Errors */
 
+ExeContext* VG_(get_error_where) ( Error* err )
+{
+   return err->ekind;
+}
+
 ErrorKind VG_(get_error_kind) ( Error* err )
 {
    return err->ekind;