diff options
author | florian <florian@a5019735-40e9-0310-863c-91ae7b9d1cf9> | 2014-10-20 19:02:38 +0000 |
---|---|---|
committer | florian <florian@a5019735-40e9-0310-863c-91ae7b9d1cf9> | 2014-10-20 19:02:38 +0000 |
commit | 8e3fbb5cd8276a7d07d5712bc05f9b3376d81a6a (patch) | |
tree | efdd048909966f37ff7b1799c3a8c27c2f46c802 | |
parent | 2fa8a5f811144bcf23a1445c30087dfced107ff4 (diff) | |
download | valgrind-8e3fbb5cd8276a7d07d5712bc05f9b3376d81a6a.tar.gz |
Constify the tool interface.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14642 a5019735-40e9-0310-863c-91ae7b9d1cf9
-rw-r--r-- | coregrind/m_errormgr.c | 16 | ||||
-rw-r--r-- | coregrind/m_tooliface.c | 18 | ||||
-rw-r--r-- | coregrind/pub_core_tooliface.h | 18 | ||||
-rw-r--r-- | drd/drd_error.c | 25 | ||||
-rw-r--r-- | exp-sgcheck/pc_common.c | 21 | ||||
-rw-r--r-- | exp-sgcheck/pc_common.h | 18 | ||||
-rw-r--r-- | helgrind/hg_errors.c | 18 | ||||
-rw-r--r-- | helgrind/hg_errors.h | 18 | ||||
-rw-r--r-- | include/pub_tool_errormgr.h | 16 | ||||
-rw-r--r-- | include/pub_tool_tooliface.h | 18 | ||||
-rw-r--r-- | memcheck/mc_errors.c | 18 | ||||
-rw-r--r-- | memcheck/mc_include.h | 18 |
12 files changed, 113 insertions, 109 deletions
diff --git a/coregrind/m_errormgr.c b/coregrind/m_errormgr.c index c2f844c53..6cbc31e90 100644 --- a/coregrind/m_errormgr.c +++ b/coregrind/m_errormgr.c @@ -147,27 +147,27 @@ struct _Error { }; -ExeContext* VG_(get_error_where) ( Error* err ) +ExeContext* VG_(get_error_where) ( const Error* err ) { return err->where; } -ErrorKind VG_(get_error_kind) ( Error* err ) +ErrorKind VG_(get_error_kind) ( const Error* err ) { return err->ekind; } -Addr VG_(get_error_address) ( Error* err ) +Addr VG_(get_error_address) ( const Error* err ) { return err->addr; } -const HChar* VG_(get_error_string) ( Error* err ) +const HChar* VG_(get_error_string) ( const Error* err ) { return err->string; } -void* VG_(get_error_extra) ( Error* err ) +void* VG_(get_error_extra) ( const Error* err ) { return err->extra; } @@ -246,17 +246,17 @@ struct _Supp { void* extra; // Anything else -- use is optional. NULL by default. }; -SuppKind VG_(get_supp_kind) ( Supp* su ) +SuppKind VG_(get_supp_kind) ( const Supp* su ) { return su->skind; } -HChar* VG_(get_supp_string) ( Supp* su ) +HChar* VG_(get_supp_string) ( const Supp* su ) { return su->string; } -void* VG_(get_supp_extra) ( Supp* su ) +void* VG_(get_supp_extra) ( const Supp* su ) { return su->extra; } diff --git a/coregrind/m_tooliface.c b/coregrind/m_tooliface.c index e96a9a136..3fd8f821d 100644 --- a/coregrind/m_tooliface.c +++ b/coregrind/m_tooliface.c @@ -227,18 +227,18 @@ void VG_(needs_superblock_discards)( } void VG_(needs_tool_errors)( - Bool (*eq) (VgRes, Error*, Error*), - void (*before_pp) (Error*), - void (*pp) (Error*), + Bool (*eq) (VgRes, const Error*, const Error*), + void (*before_pp) (const Error*), + void (*pp) (const Error*), Bool show_TIDs, - UInt (*update) (Error*), + UInt (*update) (const Error*), Bool (*recog) (const HChar*, Supp*), Bool (*read_extra) (Int, HChar**, SizeT*, Int*, Supp*), - Bool (*matches) (Error*, Supp*), - const HChar* (*name) (Error*), - SizeT (*get_xtra_si)(Error*,/*OUT*/HChar*,Int), - SizeT (*print_xtra_su)(Supp*,/*OUT*/HChar*,Int), - void (*update_xtra_su)(Error*, Supp*) + Bool (*matches) (const Error*, const Supp*), + const HChar* (*name) (const Error*), + SizeT (*get_xtra_si)(const Error*,/*OUT*/HChar*,Int), + SizeT (*print_xtra_su)(const Supp*,/*OUT*/HChar*,Int), + void (*update_xtra_su)(const Error*, const Supp*) ) { VG_(needs).tool_errors = True; diff --git a/coregrind/pub_core_tooliface.h b/coregrind/pub_core_tooliface.h index 585170be0..9b7df351e 100644 --- a/coregrind/pub_core_tooliface.h +++ b/coregrind/pub_core_tooliface.h @@ -118,19 +118,19 @@ typedef struct { // (none) // VG_(needs).tool_errors - Bool (*tool_eq_Error) (VgRes, Error*, Error*); - void (*tool_before_pp_Error) (Error*); - void (*tool_pp_Error) (Error*); + Bool (*tool_eq_Error) (VgRes, const Error*, const Error*); + void (*tool_before_pp_Error) (const Error*); + void (*tool_pp_Error) (const Error*); Bool tool_show_ThreadIDs_for_errors; - UInt (*tool_update_extra) (Error*); + UInt (*tool_update_extra) (const Error*); Bool (*tool_recognised_suppression) (const HChar*, Supp*); Bool (*tool_read_extra_suppression_info) (Int, HChar**, SizeT*, Int*, Supp*); - Bool (*tool_error_matches_suppression) (Error*, Supp*); - const HChar* (*tool_get_error_name) (Error*); - SizeT (*tool_get_extra_suppression_info) (Error*,/*OUT*/HChar*,Int); - SizeT (*tool_print_extra_suppression_use) (Supp*,/*OUT*/HChar*,Int); - void (*tool_update_extra_suppression_use) (Error*, Supp*); + Bool (*tool_error_matches_suppression) (const Error*, const Supp*); + const HChar* (*tool_get_error_name) (const Error*); + SizeT (*tool_get_extra_suppression_info) (const Error*,/*OUT*/HChar*,Int); + SizeT (*tool_print_extra_suppression_use) (const Supp*,/*OUT*/HChar*,Int); + void (*tool_update_extra_suppression_use) (const Error*, const Supp*); // VG_(needs).superblock_discards void (*tool_discard_superblock_info)(Addr64, VexGuestExtents); diff --git a/drd/drd_error.c b/drd/drd_error.c index 1d8f0e35c..e3df0b59a 100644 --- a/drd/drd_error.c +++ b/drd/drd_error.c @@ -43,7 +43,7 @@ /* Local function declarations. */ -static const HChar* drd_get_error_name(Error* e); +static const HChar* drd_get_error_name(const Error* e); /* Local variables. */ @@ -151,7 +151,8 @@ static void first_observed(const Addr obj) } static -void drd_report_data_race(Error* const err, const DataRaceErrInfo* const dri) +void drd_report_data_race(const Error* const err, + const DataRaceErrInfo* const dri) { const Bool xml = VG_(clo_xml); const HChar* const what_prefix = xml ? " <what>" : ""; @@ -254,7 +255,8 @@ void drd_report_data_race(Error* const err, const DataRaceErrInfo* const dri) * if the error kind of e1 and e2 matches and if the ExeContext's of e1 and * e2 also match. */ -static Bool drd_compare_error_contexts(VgRes res, Error* e1, Error* e2) +static Bool drd_compare_error_contexts(VgRes res, const Error* e1, + const Error* e2) { tl_assert(VG_(get_error_kind)(e1) == VG_(get_error_kind)(e2)); @@ -282,7 +284,7 @@ static Bool drd_compare_error_contexts(VgRes res, Error* e1, Error* e2) * Called by the core just before an error message will be printed. Used by * DRD to print the thread number as a preamble. */ -static void drd_tool_error_before_pp(Error* const e) +static void drd_tool_error_before_pp(const Error* const e) { static DrdThreadId s_last_tid_printed = 1; DrdThreadId* err_extra; @@ -296,7 +298,7 @@ static void drd_tool_error_before_pp(Error* const e) } /** Report an error to the user. */ -static void drd_tool_error_pp(Error* const e) +static void drd_tool_error_pp(const Error* const e) { const Bool xml = VG_(clo_xml); const HChar* const what_prefix = xml ? " <what>" : ""; @@ -460,7 +462,7 @@ static void drd_tool_error_pp(Error* const e) } } -static UInt drd_tool_error_update_extra(Error* e) +static UInt drd_tool_error_update_extra(const Error* e) { switch (VG_(get_error_kind)(e)) { @@ -563,12 +565,13 @@ Bool drd_read_extra_suppression_info(Int fd, HChar** bufpp, * Determine whether or not the types of the given error message and the * given suppression match. */ -static Bool drd_error_matches_suppression(Error* const e, Supp* const supp) +static Bool drd_error_matches_suppression(const Error* const e, + const Supp* const supp) { return VG_(get_supp_kind)(supp) == VG_(get_error_kind)(e); } -static const HChar* drd_get_error_name(Error* e) +static const HChar* drd_get_error_name(const Error* e) { switch (VG_(get_error_kind)(e)) { @@ -600,7 +603,7 @@ static const HChar* drd_get_error_name(Error* e) * define any 'extra' suppression information. */ static -SizeT drd_get_extra_suppression_info(Error* e, +SizeT drd_get_extra_suppression_info(const Error* e, /*OUT*/HChar* buf, Int nBuf) { tl_assert(nBuf >= 1); @@ -609,7 +612,7 @@ SizeT drd_get_extra_suppression_info(Error* e, } static -SizeT drd_print_extra_suppression_use(Supp* su, +SizeT drd_print_extra_suppression_use(const Supp* su, /*OUT*/HChar* buf, Int nBuf) { tl_assert(nBuf >= 1); @@ -618,7 +621,7 @@ SizeT drd_print_extra_suppression_use(Supp* su, } static -void drd_update_extra_suppresion_use(Error* e, Supp* supp) +void drd_update_extra_suppresion_use(const Error* e, const Supp* supp) { return; } diff --git a/exp-sgcheck/pc_common.c b/exp-sgcheck/pc_common.c index 27dd2f217..042a86077 100644 --- a/exp-sgcheck/pc_common.c +++ b/exp-sgcheck/pc_common.c @@ -216,7 +216,7 @@ void h_record_sysparam_error( ThreadId tid, CorePart part, const HChar* s, } -Bool pc_eq_Error ( VgRes res, Error* e1, Error* e2 ) +Bool pc_eq_Error ( VgRes res, const Error* e1, const Error* e2 ) { XError *xe1, *xe2; tl_assert(VG_(get_error_kind)(e1) == VG_(get_error_kind)(e2)); @@ -262,7 +262,7 @@ Bool pc_eq_Error ( VgRes res, Error* e1, Error* e2 ) look at it any print any preamble you want" function. Which, in Ptrcheck, we don't use. Hence a no-op. */ -void pc_before_pp_Error ( Error* err ) { +void pc_before_pp_Error ( const Error* err ) { } /* Do a printf-style operation on either the XML or normal output @@ -302,7 +302,7 @@ static Word Word__abs ( Word w ) { return w < 0 ? -w : w; } -void pc_pp_Error ( Error* err ) +void pc_pp_Error ( const Error* err ) { const Bool xml = VG_(clo_xml); /* a shorthand, that's all */ @@ -647,7 +647,7 @@ void pc_pp_Error ( Error* err ) } -UInt pc_update_Error_extra ( Error* err ) +UInt pc_update_Error_extra ( const Error* err ) { XError *xe = (XError*)VG_(get_error_extra)(err); tl_assert(xe); @@ -736,7 +736,8 @@ Bool pc_is_recognised_suppression ( const HChar* name, Supp *su ) } Bool pc_read_extra_suppression_info ( Int fd, HChar** bufpp, - SizeT* nBufp, Int* lineno, Supp* su ) + SizeT* nBufp, Int* lineno, + Supp* su ) { Bool eof; if (VG_(get_supp_kind)(su) == XS_SysParam) { @@ -747,7 +748,7 @@ Bool pc_read_extra_suppression_info ( Int fd, HChar** bufpp, return True; } -Bool pc_error_matches_suppression (Error* err, Supp* su) +Bool pc_error_matches_suppression (const Error* err, const Supp* su) { ErrorKind ekind = VG_(get_error_kind)(err); switch (VG_(get_supp_kind)(su)) { @@ -764,7 +765,7 @@ Bool pc_error_matches_suppression (Error* err, Supp* su) } } -const HChar* pc_get_error_name ( Error* err ) +const HChar* pc_get_error_name ( const Error* err ) { XError *xe = (XError*)VG_(get_error_extra)(err); tl_assert(xe); @@ -777,7 +778,7 @@ const HChar* pc_get_error_name ( Error* err ) } } -SizeT pc_get_extra_suppression_info ( Error* err, +SizeT pc_get_extra_suppression_info ( const Error* err, /*OUT*/HChar* buf, Int nBuf ) { ErrorKind ekind = VG_(get_error_kind )(err); @@ -794,7 +795,7 @@ SizeT pc_get_extra_suppression_info ( Error* err, } } -SizeT pc_print_extra_suppression_use ( Supp* su, +SizeT pc_print_extra_suppression_use ( const Supp* su, /*OUT*/HChar* buf, Int nBuf ) { tl_assert(nBuf >= 1); @@ -802,7 +803,7 @@ SizeT pc_print_extra_suppression_use ( Supp* su, return 0; } -void pc_update_extra_suppression_use (Error* err, Supp* su) +void pc_update_extra_suppression_use (const Error* err, const Supp* su) { return; } diff --git a/exp-sgcheck/pc_common.h b/exp-sgcheck/pc_common.h index f0d3a86dd..932e850dc 100644 --- a/exp-sgcheck/pc_common.h +++ b/exp-sgcheck/pc_common.h @@ -47,20 +47,20 @@ void h_record_arith_error( Seg* seg1, Seg* seg2, HChar* opname ); void h_record_sysparam_error( ThreadId tid, CorePart part, const HChar* s, Addr lo, Addr hi, Seg* seglo, Seg* seghi ); -Bool pc_eq_Error ( VgRes res, Error* e1, Error* e2 ); -void pc_before_pp_Error ( Error* err ); -void pc_pp_Error ( Error* err ); -UInt pc_update_Error_extra ( Error* err ); +Bool pc_eq_Error ( VgRes res, const Error* e1, const Error* e2 ); +void pc_before_pp_Error ( const Error* err ); +void pc_pp_Error ( const Error* err ); +UInt pc_update_Error_extra ( const Error* err ); Bool pc_is_recognised_suppression ( const HChar* name, Supp *su ); Bool pc_read_extra_suppression_info ( Int fd, HChar** bufpp, SizeT* nBufp, Int* lineno, Supp* su ); -Bool pc_error_matches_suppression (Error* err, Supp* su); -const HChar* pc_get_error_name ( Error* err ); -SizeT pc_get_extra_suppression_info ( Error* err, +Bool pc_error_matches_suppression (const Error* err, const Supp* su); +const HChar* pc_get_error_name ( const Error* err ); +SizeT pc_get_extra_suppression_info ( const Error* err, /*OUT*/HChar* buf, Int nBuf ); -SizeT pc_print_extra_suppression_use ( Supp* su, +SizeT pc_print_extra_suppression_use ( const Supp* su, /*OUT*/HChar* buf, Int nBuf ); -void pc_update_extra_suppression_use (Error* err, Supp* su); +void pc_update_extra_suppression_use (const Error* err, const Supp* su); extern Bool h_clo_partial_loads_ok; /* extern Bool h_clo_lossage_check; */ diff --git a/helgrind/hg_errors.c b/helgrind/hg_errors.c index fc33bedc2..0e96d7e76 100644 --- a/helgrind/hg_errors.c +++ b/helgrind/hg_errors.c @@ -371,7 +371,7 @@ typedef /* Updates the copy with address info if necessary. */ -UInt HG_(update_extra) ( Error* err ) +UInt HG_(update_extra) ( const Error* err ) { XError* xe = (XError*)VG_(get_error_extra)(err); tl_assert(xe); @@ -637,7 +637,7 @@ void HG_(record_error_Misc) ( Thread* thr, const HChar* errstr ) HG_(record_error_Misc_w_aux)(thr, errstr, NULL, NULL); } -Bool HG_(eq_Error) ( VgRes not_used, Error* e1, Error* e2 ) +Bool HG_(eq_Error) ( VgRes not_used, const Error* e1, const Error* e2 ) { XError *xe1, *xe2; @@ -843,7 +843,7 @@ static void show_LockP_summary_textmode ( Lock** locks, const HChar* pre ) announce any previously un-announced threads in the upcoming error message. */ -void HG_(before_pp_Error) ( Error* err ) +void HG_(before_pp_Error) ( const Error* err ) { XError* xe; tl_assert(err); @@ -893,7 +893,7 @@ void HG_(before_pp_Error) ( Error* err ) } } -void HG_(pp_Error) ( Error* err ) +void HG_(pp_Error) ( const Error* err ) { const Bool xml = VG_(clo_xml); /* a shorthand, that's all */ @@ -1252,7 +1252,7 @@ void HG_(pp_Error) ( Error* err ) } /* switch (VG_(get_error_kind)(err)) */ } -const HChar* HG_(get_error_name) ( Error* err ) +const HChar* HG_(get_error_name) ( const Error* err ) { switch (VG_(get_error_kind)(err)) { case XE_Race: return "Race"; @@ -1293,7 +1293,7 @@ Bool HG_(read_extra_suppression_info) ( Int fd, HChar** bufpp, SizeT* nBufp, return True; } -Bool HG_(error_matches_suppression) ( Error* err, Supp* su ) +Bool HG_(error_matches_suppression) ( const Error* err, const Supp* su ) { switch (VG_(get_supp_kind)(su)) { case XS_Race: return VG_(get_error_kind)(err) == XE_Race; @@ -1308,7 +1308,7 @@ Bool HG_(error_matches_suppression) ( Error* err, Supp* su ) } } -SizeT HG_(get_extra_suppression_info) ( Error* err, +SizeT HG_(get_extra_suppression_info) ( const Error* err, /*OUT*/HChar* buf, Int nBuf ) { tl_assert(nBuf >= 1); @@ -1317,7 +1317,7 @@ SizeT HG_(get_extra_suppression_info) ( Error* err, return 0; } -SizeT HG_(print_extra_suppression_use) ( Supp* su, +SizeT HG_(print_extra_suppression_use) ( const Supp* su, /*OUT*/HChar* buf, Int nBuf ) { tl_assert(nBuf >= 1); @@ -1326,7 +1326,7 @@ SizeT HG_(print_extra_suppression_use) ( Supp* su, return 0; } -void HG_(update_extra_suppression_use) ( Error* err, Supp* su ) +void HG_(update_extra_suppression_use) ( const Error* err, const Supp* su ) { /* Do nothing */ return; diff --git a/helgrind/hg_errors.h b/helgrind/hg_errors.h index 76f214593..e3d864317 100644 --- a/helgrind/hg_errors.h +++ b/helgrind/hg_errors.h @@ -35,20 +35,20 @@ /* The standard bundle of error management functions that we are required to present to the core/tool interface at startup. */ -Bool HG_(eq_Error) ( VgRes not_used, Error* e1, Error* e2 ); -void HG_(before_pp_Error) ( Error* err ); -void HG_(pp_Error) ( Error* err ); -UInt HG_(update_extra) ( Error* err ); +Bool HG_(eq_Error) ( VgRes not_used, const Error* e1, const Error* e2 ); +void HG_(before_pp_Error) ( const Error* err ); +void HG_(pp_Error) ( const Error* err ); +UInt HG_(update_extra) ( const Error* err ); Bool HG_(recognised_suppression) ( const HChar* name, Supp *su ); Bool HG_(read_extra_suppression_info) ( Int fd, HChar** bufpp, SizeT* nBufp, Int* lineno, Supp* su ); -Bool HG_(error_matches_suppression) ( Error* err, Supp* su ); -const HChar* HG_(get_error_name) ( Error* err ); -SizeT HG_(get_extra_suppression_info) ( Error* err, +Bool HG_(error_matches_suppression) ( const Error* err, const Supp* su ); +const HChar* HG_(get_error_name) ( const Error* err ); +SizeT HG_(get_extra_suppression_info) ( const Error* err, /*OUT*/HChar* buf, Int nBuf ); -SizeT HG_(print_extra_suppression_use) ( Supp* su, +SizeT HG_(print_extra_suppression_use) ( const Supp* su, /*OUT*/HChar* buf, Int nBuf ); -void HG_(update_extra_suppression_use) ( Error* err, Supp* su ); +void HG_(update_extra_suppression_use) ( const Error* err, const Supp* su ); /* Functions for recording various kinds of errors. */ void HG_(record_error_Race) ( Thread* thr, diff --git a/include/pub_tool_errormgr.h b/include/pub_tool_errormgr.h index 427c0f076..ad1f6b06b 100644 --- a/include/pub_tool_errormgr.h +++ b/include/pub_tool_errormgr.h @@ -56,11 +56,11 @@ typedef /* Useful in VG_(tdict).tool_error_matches_suppression(), * VG_(tdict).tool_pp_Error(), etc */ -ExeContext* VG_(get_error_where) ( Error* err ); -ErrorKind VG_(get_error_kind) ( Error* err ); -Addr VG_(get_error_address) ( Error* err ); -const HChar* VG_(get_error_string) ( Error* err ); -void* VG_(get_error_extra) ( Error* err ); +ExeContext* VG_(get_error_where) ( const Error* err ); +ErrorKind VG_(get_error_kind) ( const Error* err ); +Addr VG_(get_error_address) ( const Error* err ); +const HChar* VG_(get_error_string) ( const Error* err ); +void* VG_(get_error_extra) ( const Error* err ); /* Call this when an error occurs. It will be recorded if it hasn't been seen before. If it has, the existing error record will have its count @@ -127,9 +127,9 @@ typedef Supp; /* Useful in VG_(tdict).tool_error_matches_suppression() */ -SuppKind VG_(get_supp_kind) ( Supp* su ); -HChar* VG_(get_supp_string) ( Supp* su ); -void* VG_(get_supp_extra) ( Supp* su ); +SuppKind VG_(get_supp_kind) ( const Supp* su ); +HChar* VG_(get_supp_string) ( const Supp* su ); +void* VG_(get_supp_extra) ( const Supp* su ); /* Must be used in VG_(recognised_suppression)() */ void VG_(set_supp_kind) ( Supp* su, SuppKind suppkind ); diff --git a/include/pub_tool_tooliface.h b/include/pub_tool_tooliface.h index ad503b00e..6f84ca4e7 100644 --- a/include/pub_tool_tooliface.h +++ b/include/pub_tool_tooliface.h @@ -284,7 +284,7 @@ extern void VG_(needs_tool_errors) ( // passed to VG_(eq_ExeContext)() if the ExeContexts are considered. Other // than that, probably don't worry about it unless you have lots of very // similar errors occurring. - Bool (*eq_Error)(VgRes res, Error* e1, Error* e2), + Bool (*eq_Error)(VgRes res, const Error* e1, const Error* e2), // We give tools a chance to have a look at errors // just before they are printed. That is, before_pp_Error is @@ -294,10 +294,10 @@ extern void VG_(needs_tool_errors) ( // is printed. This functionality was added to allow Helgrind to // print thread-announcement messages immediately before the // errors that refer to them. - void (*before_pp_Error)(Error* err), + void (*before_pp_Error)(const Error* err), // Print error context. - void (*pp_Error)(Error* err), + void (*pp_Error)(const Error* err), // Should the core indicate which ThreadId each error comes from? Bool show_ThreadIDs_for_errors, @@ -309,7 +309,7 @@ extern void VG_(needs_tool_errors) ( // Yuk. // Return value: must be the size of the `extra' part in bytes -- used by // the core to make a copy. - UInt (*update_extra)(Error* err), + UInt (*update_extra)(const Error* err), // Return value indicates recognition. If recognised, must set skind using // VG_(set_supp_kind)(). @@ -326,12 +326,12 @@ extern void VG_(needs_tool_errors) ( // This should just check the kinds match and maybe some stuff in the // `string' and `extra' field if appropriate (using VG_(get_supp_*)() to // get the relevant suppression parts). - Bool (*error_matches_suppression)(Error* err, Supp* su), + Bool (*error_matches_suppression)(const Error* err, const Supp* su), // This should return the suppression name, for --gen-suppressions, or NULL // if that error type cannot be suppressed. This is the inverse of // VG_(tdict).tool_recognised_suppression(). - const HChar* (*get_error_name)(Error* err), + const HChar* (*get_error_name)(const Error* err), // This should print into buf[0..nBuf-1] any extra info for the // error, for --gen-suppressions, but not including any leading @@ -340,13 +340,13 @@ extern void VG_(needs_tool_errors) ( // including the terminating null character the function shall // return the value that strlen would return for the string. // If the buffer is too small the function shall return nBuf. - SizeT (*print_extra_suppression_info)(Error* err, + SizeT (*print_extra_suppression_info)(const Error* err, /*OUT*/HChar* buf, Int nBuf), // This is similar to print_extra_suppression_info, but is used // to print information such as additional statistical counters // as part of the used suppression list produced by -v. - SizeT (*print_extra_suppression_use)(Supp* su, + SizeT (*print_extra_suppression_use)(const Supp* su, /*OUT*/HChar* buf, Int nBuf), // Called by error mgr once it has been established that err @@ -354,7 +354,7 @@ extern void VG_(needs_tool_errors) ( // can be used to update suppression extra information such as // some statistical counters that will be printed by // print_extra_suppression_use. - void (*update_extra_suppression_use)(Error* err, Supp* su) + void (*update_extra_suppression_use)(const Error* err, const Supp* su) ); /* Is information kept by the tool about specific instructions or diff --git a/memcheck/mc_errors.c b/memcheck/mc_errors.c index 1f031c623..3303ee1e0 100644 --- a/memcheck/mc_errors.c +++ b/memcheck/mc_errors.c @@ -200,7 +200,7 @@ struct _MC_Error { look at it any print any preamble you want" function. Which, in Memcheck, we don't use. Hence a no-op. */ -void MC_(before_pp_Error) ( Error* err ) { +void MC_(before_pp_Error) ( const Error* err ) { } /* Do a printf-style operation on either the XML or normal output @@ -410,7 +410,7 @@ void MC_(pp_LossRecord)(UInt n_this_record, UInt n_total_records, pp_LossRecord (n_this_record, n_total_records, l, /* xml */ False); } -void MC_(pp_Error) ( Error* err ) +void MC_(pp_Error) ( const Error* err ) { const Bool xml = VG_(clo_xml); /* a shorthand */ MC_Error* extra = VG_(get_error_extra)(err); @@ -931,7 +931,7 @@ void MC_(record_user_error) ( ThreadId tid, Addr a, /* Compare error contexts, to detect duplicates. Note that if they are otherwise the same, the faulting addrs and associated rwoffsets are allowed to be different. */ -Bool MC_(eq_Error) ( VgRes res, Error* e1, Error* e2 ) +Bool MC_(eq_Error) ( VgRes res, const Error* e1, const Error* e2 ) { MC_Error* extra1 = VG_(get_error_extra)(e1); MC_Error* extra2 = VG_(get_error_extra)(e2); @@ -1100,7 +1100,7 @@ static void update_origin ( /*OUT*/ExeContext** origin_ec, } /* Updates the copy with address info if necessary (but not for all errors). */ -UInt MC_(update_Error_extra)( Error* err ) +UInt MC_(update_Error_extra)( const Error* err ) { MC_Error* extra = VG_(get_error_extra)(err); @@ -1386,7 +1386,7 @@ Bool MC_(read_extra_suppression_info) ( Int fd, HChar** bufpp, return True; } -Bool MC_(error_matches_suppression) ( Error* err, Supp* su ) +Bool MC_(error_matches_suppression) ( const Error* err, const Supp* su ) { Int su_szB; MC_Error* extra = VG_(get_error_extra)(err); @@ -1470,7 +1470,7 @@ Bool MC_(error_matches_suppression) ( Error* err, Supp* su ) } } -const HChar* MC_(get_error_name) ( Error* err ) +const HChar* MC_(get_error_name) ( const Error* err ) { switch (VG_(get_error_kind)(err)) { case Err_RegParam: return "Param"; @@ -1511,7 +1511,7 @@ const HChar* MC_(get_error_name) ( Error* err ) } } -SizeT MC_(get_extra_suppression_info) ( Error* err, +SizeT MC_(get_extra_suppression_info) ( const Error* err, /*OUT*/HChar* buf, Int nBuf ) { ErrorKind ekind = VG_(get_error_kind )(err); @@ -1537,7 +1537,7 @@ SizeT MC_(get_extra_suppression_info) ( Error* err, } } -SizeT MC_(print_extra_suppression_use) ( Supp *su, +SizeT MC_(print_extra_suppression_use) ( const Supp *su, /*OUT*/HChar *buf, Int nBuf ) { tl_assert(nBuf >= 1); @@ -1558,7 +1558,7 @@ SizeT MC_(print_extra_suppression_use) ( Supp *su, return 0; } -void MC_(update_extra_suppression_use) ( Error* err, Supp* su) +void MC_(update_extra_suppression_use) ( const Error* err, const Supp* su) { if (VG_(get_supp_kind)(su) == LeakSupp) { MC_LeakSuppExtra *lse = (MC_LeakSuppExtra*) VG_(get_supp_extra) (su); diff --git a/memcheck/mc_include.h b/memcheck/mc_include.h index 51a36c2dc..f50a07940 100644 --- a/memcheck/mc_include.h +++ b/memcheck/mc_include.h @@ -393,25 +393,25 @@ extern Bool MC_(any_value_errors); /* Standard functions for error and suppressions as required by the core/tool iface */ -Bool MC_(eq_Error) ( VgRes res, Error* e1, Error* e2 ); -void MC_(before_pp_Error) ( Error* err ); -void MC_(pp_Error) ( Error* err ); -UInt MC_(update_Error_extra) ( Error* err ); +Bool MC_(eq_Error) ( VgRes res, const Error* e1, const Error* e2 ); +void MC_(before_pp_Error) ( const Error* err ); +void MC_(pp_Error) ( const Error* err ); +UInt MC_(update_Error_extra) ( const Error* err ); Bool MC_(is_recognised_suppression) ( const HChar* name, Supp* su ); Bool MC_(read_extra_suppression_info) ( Int fd, HChar** buf, SizeT* nBuf, Int* lineno, Supp *su ); -Bool MC_(error_matches_suppression) ( Error* err, Supp* su ); +Bool MC_(error_matches_suppression) ( const Error* err, const Supp* su ); -SizeT MC_(get_extra_suppression_info) ( Error* err, +SizeT MC_(get_extra_suppression_info) ( const Error* err, /*OUT*/HChar* buf, Int nBuf ); -SizeT MC_(print_extra_suppression_use) ( Supp* su, +SizeT MC_(print_extra_suppression_use) ( const Supp* su, /*OUT*/HChar* buf, Int nBuf ); -void MC_(update_extra_suppression_use) ( Error* err, Supp* su ); +void MC_(update_extra_suppression_use) ( const Error* err, const Supp* su ); -const HChar* MC_(get_error_name) ( Error* err ); +const HChar* MC_(get_error_name) ( const Error* err ); /* Recording of errors */ void MC_(record_address_error) ( ThreadId tid, Addr a, Int szB, |