First round of Char/HChar fixups for coregrind and memcheck.
Little bit of ripple in tools, too.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13074 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/m_errormgr.c b/coregrind/m_errormgr.c
index 81bbfd9..fe34d01 100644
--- a/coregrind/m_errormgr.c
+++ b/coregrind/m_errormgr.c
@@ -139,7 +139,7 @@
ExeContext* where; // Initialised by core
ErrorKind ekind; // Used by ALL. Must be in the range (0..)
Addr addr; // Used frequently
- Char* string; // Used frequently
+ const HChar* string; // Used frequently
void* extra; // For any tool-specific extras
};
@@ -159,7 +159,7 @@
return err->addr;
}
-Char* VG_(get_error_string) ( Error* err )
+const HChar* VG_(get_error_string) ( Error* err )
{
return err->string;
}
@@ -618,7 +618,7 @@
/* Construct an error */
static
void construct_error ( Error* err, ThreadId tid, ErrorKind ekind, Addr a,
- Char* s, void* extra, ExeContext* where )
+ const HChar* s, void* extra, ExeContext* where )
{
/* DO NOT MAKE unique_counter NON-STATIC */
static UInt unique_counter = 0;
@@ -652,7 +652,7 @@
All detected errors are notified here; this routine decides if/when the
user should see the error. */
void VG_(maybe_record_error) ( ThreadId tid,
- ErrorKind ekind, Addr a, Char* s, void* extra )
+ ErrorKind ekind, Addr a, const HChar* s, void* extra )
{
Error err;
Error* p;
@@ -824,7 +824,7 @@
suppressed. Bool 'print_error' dictates whether to print the error.
Bool 'count_error' dictates whether to count the error in n_errs_found.
*/
-Bool VG_(unique_error) ( ThreadId tid, ErrorKind ekind, Addr a, Char* s,
+Bool VG_(unique_error) ( ThreadId tid, ErrorKind ekind, Addr a, const HChar* s,
void* extra, ExeContext* where, Bool print_error,
Bool allow_db_attach, Bool count_error )
{
diff --git a/coregrind/m_main.c b/coregrind/m_main.c
index 9496428..8af79ba 100644
--- a/coregrind/m_main.c
+++ b/coregrind/m_main.c
@@ -108,7 +108,7 @@
- for the name of the GDB executable
- for the name of vgdb's path prefix
which must be supplied when they are VG_(printf)'d. */
- const HChar* usage1 =
+ const HChar usage1[] =
"usage: valgrind [options] prog-and-args\n"
"\n"
" tool-selection option, with default in [ ]:\n"
@@ -200,7 +200,7 @@
" in libxyzzy.so: --soname-synonyms=somalloc=libxyzzy.so\n"
"\n";
- const HChar* usage2 =
+ const HChar usage2[] =
"\n"
" debugging options for all Valgrind tools:\n"
" -d show verbose debugging output\n"
@@ -257,7 +257,7 @@
" --trace-malloc=no|yes show client malloc details? [no]\n"
"\n";
- const HChar* usage3 =
+ const HChar usage3[] =
"\n"
" Extra options read from ~/.valgrindrc, $VALGRIND_OPTS, ./.valgrindrc\n"
"\n"
diff --git a/coregrind/m_syswrap/priv_syswrap-generic.h b/coregrind/m_syswrap/priv_syswrap-generic.h
index ceefeaf..0eb05be 100644
--- a/coregrind/m_syswrap/priv_syswrap-generic.h
+++ b/coregrind/m_syswrap/priv_syswrap-generic.h
@@ -38,7 +38,7 @@
// address space.
extern
Bool ML_(valid_client_addr)(Addr start, SizeT size, ThreadId tid,
- const Char *syscallname);
+ const HChar *syscallname);
/* Handy small function to help stop wrappers from segfaulting when
presented with bogus client addresses. Is not used for generating
@@ -50,7 +50,8 @@
// Return true if we're allowed to use or create this fd.
extern
-Bool ML_(fd_allowed)(Int fd, const Char *syscallname, ThreadId tid, Bool isNewFD);
+Bool ML_(fd_allowed)(Int fd, const HChar *syscallname, ThreadId tid,
+ Bool isNewFD);
extern void ML_(record_fd_open_named) (ThreadId tid, Int fd);
extern void ML_(record_fd_open_nameless) (ThreadId tid, Int fd);
@@ -74,10 +75,10 @@
extern void
ML_(buf_and_len_pre_check) ( ThreadId tid, Addr buf_p, Addr buflen_p,
- Char* buf_s, Char* buflen_s );
+ const HChar* buf_s, const HChar* buflen_s );
extern void
ML_(buf_and_len_post_check) ( ThreadId tid, SysRes res,
- Addr buf_p, Addr buflen_p, Char* s );
+ Addr buf_p, Addr buflen_p, const HChar* s );
/* PRE and POST for unknown ioctls based on ioctl request encoding */
extern
@@ -235,9 +236,12 @@
extern void ML_(generic_POST_sys_getsockname) ( TId, SR, UW, UW, UW );
extern void ML_(generic_PRE_sys_getpeername) ( TId, UW, UW, UW );
extern void ML_(generic_POST_sys_getpeername) ( TId, SR, UW, UW, UW );
-extern void ML_(generic_PRE_sys_sendmsg) ( TId, Char *, struct vki_msghdr * );
-extern void ML_(generic_PRE_sys_recvmsg) ( TId, Char *, struct vki_msghdr * );
-extern void ML_(generic_POST_sys_recvmsg) ( TId, Char *, struct vki_msghdr *, UInt );
+extern void ML_(generic_PRE_sys_sendmsg) ( TId, const HChar *,
+ struct vki_msghdr * );
+extern void ML_(generic_PRE_sys_recvmsg) ( TId, const HChar *,
+ struct vki_msghdr * );
+extern void ML_(generic_POST_sys_recvmsg) ( TId, const HChar *,
+ struct vki_msghdr *, UInt );
extern void ML_(generic_PRE_sys_semop) ( TId, UW, UW, UW );
extern void ML_(generic_PRE_sys_semtimedop) ( TId, UW, UW, UW, UW );
diff --git a/coregrind/m_syswrap/syswrap-generic.c b/coregrind/m_syswrap/syswrap-generic.c
index 3d45a30..73ab5ff 100644
--- a/coregrind/m_syswrap/syswrap-generic.c
+++ b/coregrind/m_syswrap/syswrap-generic.c
@@ -72,7 +72,7 @@
client or is free or a reservation. */
Bool ML_(valid_client_addr)(Addr start, SizeT size, ThreadId tid,
- const Char *syscallname)
+ const HChar *syscallname)
{
Bool ret;
@@ -592,7 +592,7 @@
void ML_(record_fd_open_named)(ThreadId tid, Int fd)
{
static HChar buf[VKI_PATH_MAX];
- Char* name;
+ HChar* name;
if (VG_(resolve_filename)(fd, buf, VKI_PATH_MAX))
name = buf;
else
@@ -608,7 +608,7 @@
}
static
-Char *unix2name(struct vki_sockaddr_un *sa, UInt len, Char *name)
+HChar *unix2name(struct vki_sockaddr_un *sa, UInt len, HChar *name)
{
if (sa == NULL || len == 0 || sa->sun_path[0] == '\0') {
VG_(sprintf)(name, "<unknown>");
@@ -620,7 +620,7 @@
}
static
-Char *inet2name(struct vki_sockaddr_in *sa, UInt len, Char *name)
+HChar *inet2name(struct vki_sockaddr_in *sa, UInt len, HChar *name)
{
if (sa == NULL || len == 0) {
VG_(sprintf)(name, "<unknown>");
@@ -691,7 +691,7 @@
/* Dump out a summary, and a more detailed list, of open file descriptors. */
-void VG_(show_open_fds) (HChar* when)
+void VG_(show_open_fds) (const HChar* when)
{
OpenFd *i = allocated_fds;
@@ -802,10 +802,11 @@
}
static
-Char *strdupcat ( HChar* cc, const Char *s1, const Char *s2, ArenaId aid )
+HChar *strdupcat ( const HChar* cc, const HChar *s1, const HChar *s2,
+ ArenaId aid )
{
UInt len = VG_(strlen) ( s1 ) + VG_(strlen) ( s2 ) + 1;
- Char *result = VG_(arena_malloc) ( aid, cc, len );
+ HChar *result = VG_(arena_malloc) ( aid, cc, len );
VG_(strcpy) ( result, s1 );
VG_(strcat) ( result, s2 );
return result;
@@ -813,20 +814,20 @@
static
void pre_mem_read_sendmsg ( ThreadId tid, Bool read,
- Char *msg, Addr base, SizeT size )
+ const HChar *msg, Addr base, SizeT size )
{
- Char *outmsg = strdupcat ( "di.syswrap.pmrs.1",
- "sendmsg", msg, VG_AR_CORE );
+ HChar *outmsg = strdupcat ( "di.syswrap.pmrs.1",
+ "sendmsg", msg, VG_AR_CORE );
PRE_MEM_READ( outmsg, base, size );
VG_(arena_free) ( VG_AR_CORE, outmsg );
}
static
void pre_mem_write_recvmsg ( ThreadId tid, Bool read,
- Char *msg, Addr base, SizeT size )
+ const HChar *msg, Addr base, SizeT size )
{
- Char *outmsg = strdupcat ( "di.syswrap.pmwr.1",
- "recvmsg", msg, VG_AR_CORE );
+ HChar *outmsg = strdupcat ( "di.syswrap.pmwr.1",
+ "recvmsg", msg, VG_AR_CORE );
if ( read )
PRE_MEM_READ( outmsg, base, size );
else
@@ -836,7 +837,7 @@
static
void post_mem_write_recvmsg ( ThreadId tid, Bool read,
- Char *fieldName, Addr base, SizeT size )
+ const HChar *fieldName, Addr base, SizeT size )
{
if ( !read )
POST_MEM_WRITE( base, size );
@@ -845,13 +846,13 @@
static
void msghdr_foreachfield (
ThreadId tid,
- Char *name,
+ const HChar *name,
struct vki_msghdr *msg,
UInt length,
- void (*foreach_func)( ThreadId, Bool, Char *, Addr, SizeT )
+ void (*foreach_func)( ThreadId, Bool, const HChar *, Addr, SizeT )
)
{
- Char *fieldName;
+ HChar *fieldName;
if ( !msg )
return;
@@ -928,10 +929,10 @@
/* GrP kernel ignores sa_len (at least on Darwin); this checks the rest */
static
void pre_mem_read_sockaddr ( ThreadId tid,
- Char *description,
+ const HChar *description,
struct vki_sockaddr *sa, UInt salen )
{
- Char *outmsg;
+ HChar *outmsg;
struct vki_sockaddr_un* sun = (struct vki_sockaddr_un *)sa;
struct vki_sockaddr_in* sin = (struct vki_sockaddr_in *)sa;
struct vki_sockaddr_in6* sin6 = (struct vki_sockaddr_in6 *)sa;
@@ -985,7 +986,7 @@
}
/* Dereference a pointer to a UInt. */
-static UInt deref_UInt ( ThreadId tid, Addr a, Char* s )
+static UInt deref_UInt ( ThreadId tid, Addr a, const HChar* s )
{
UInt* a_p = (UInt*)a;
PRE_MEM_READ( s, (Addr)a_p, sizeof(UInt) );
@@ -996,7 +997,7 @@
}
void ML_(buf_and_len_pre_check) ( ThreadId tid, Addr buf_p, Addr buflen_p,
- Char* buf_s, Char* buflen_s )
+ const HChar* buf_s, const HChar* buflen_s )
{
if (VG_(tdict).track_pre_mem_write) {
UInt buflen_in = deref_UInt( tid, buflen_p, buflen_s);
@@ -1008,7 +1009,7 @@
}
void ML_(buf_and_len_post_check) ( ThreadId tid, SysRes res,
- Addr buf_p, Addr buflen_p, Char* s )
+ Addr buf_p, Addr buflen_p, const HChar* s )
{
if (!sr_isError(res) && VG_(tdict).track_post_mem_write) {
UInt buflen_out = deref_UInt( tid, buflen_p, s);
@@ -1156,7 +1157,8 @@
*/
/* Return true if we're allowed to use or create this fd */
-Bool ML_(fd_allowed)(Int fd, const Char *syscallname, ThreadId tid, Bool isNewFd)
+Bool ML_(fd_allowed)(Int fd, const HChar *syscallname, ThreadId tid,
+ Bool isNewFd)
{
Bool allowed = True;
@@ -1507,7 +1509,8 @@
/* ------ */
void
-ML_(generic_PRE_sys_sendmsg) ( ThreadId tid, Char *name, struct vki_msghdr *msg )
+ML_(generic_PRE_sys_sendmsg) ( ThreadId tid, const HChar *name,
+ struct vki_msghdr *msg )
{
msghdr_foreachfield ( tid, name, msg, ~0, pre_mem_read_sendmsg );
}
@@ -1515,13 +1518,15 @@
/* ------ */
void
-ML_(generic_PRE_sys_recvmsg) ( ThreadId tid, Char *name, struct vki_msghdr *msg )
+ML_(generic_PRE_sys_recvmsg) ( ThreadId tid, const HChar *name,
+ struct vki_msghdr *msg )
{
msghdr_foreachfield ( tid, name, msg, ~0, pre_mem_write_recvmsg );
}
void
-ML_(generic_POST_sys_recvmsg) ( ThreadId tid, Char *name, struct vki_msghdr *msg, UInt length )
+ML_(generic_POST_sys_recvmsg) ( ThreadId tid, const HChar *name,
+ struct vki_msghdr *msg, UInt length )
{
msghdr_foreachfield( tid, name, msg, length, post_mem_write_recvmsg );
check_cmsg_for_fds( tid, msg );
@@ -2482,7 +2487,7 @@
}
// Pre_read a char** argument.
-static void pre_argv_envp(Addr a, ThreadId tid, Char* s1, Char* s2)
+static void pre_argv_envp(Addr a, ThreadId tid, const HChar* s1, const HChar* s2)
{
while (True) {
Addr a_deref;
@@ -2582,7 +2587,7 @@
// ok, etc. We allow setuid executables to run only in the case when
// we are not simulating them, that is, they to be run natively.
setuid_allowed = trace_this_child ? False : True;
- res = VG_(pre_exec_check)((const Char*)ARG1, NULL, setuid_allowed);
+ res = VG_(pre_exec_check)((const HChar *)ARG1, NULL, setuid_allowed);
if (sr_isError(res)) {
SET_STATUS_Failure( sr_Err(res) );
return;
@@ -4217,4 +4222,3 @@
/*--------------------------------------------------------------------*/
/*--- end ---*/
/*--------------------------------------------------------------------*/
-
diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c
index 0802090..133f48a 100644
--- a/coregrind/m_syswrap/syswrap-linux.c
+++ b/coregrind/m_syswrap/syswrap-linux.c
@@ -3684,7 +3684,7 @@
PRE(sys_sendmmsg)
{
struct vki_mmsghdr *mmsg = (struct vki_mmsghdr *)ARG2;
- Char name[32];
+ HChar name[32];
UInt i;
*flags |= SfMayBlock;
PRINT("sys_sendmmsg ( %ld, %#lx, %ld, %ld )",ARG1,ARG2,ARG3,ARG4);
@@ -3712,7 +3712,7 @@
PRE(sys_recvmmsg)
{
struct vki_mmsghdr *mmsg = (struct vki_mmsghdr *)ARG2;
- Char name[32];
+ HChar name[32];
UInt i;
*flags |= SfMayBlock;
PRINT("sys_recvmmsg ( %ld, %#lx, %ld, %ld, %#lx )",ARG1,ARG2,ARG3,ARG4,ARG5);
@@ -3733,7 +3733,7 @@
{
if (RES > 0) {
struct vki_mmsghdr *mmsg = (struct vki_mmsghdr *)ARG2;
- Char name[32];
+ HChar name[32];
UInt i;
for (i = 0; i < RES; i++) {
VG_(sprintf)(name, "mmsg[%u].msg_hdr", i);
diff --git a/coregrind/m_tooliface.c b/coregrind/m_tooliface.c
index 70c0814..1b9522c 100644
--- a/coregrind/m_tooliface.c
+++ b/coregrind/m_tooliface.c
@@ -233,7 +233,7 @@
Bool (*recog) (Char*, Supp*),
Bool (*read_extra) (Int, Char**, SizeT*, Supp*),
Bool (*matches) (Error*, Supp*),
- Char* (*name) (Error*),
+ const HChar* (*name) (Error*),
Bool (*get_xtra_si)(Error*,/*OUT*/Char*,Int)
)
{
@@ -395,13 +395,13 @@
DEF0(track_ban_mem_stack, Addr, SizeT)
-DEF0(track_pre_mem_read, CorePart, ThreadId, Char*, Addr, SizeT)
-DEF0(track_pre_mem_read_asciiz, CorePart, ThreadId, Char*, Addr)
-DEF0(track_pre_mem_write, CorePart, ThreadId, Char*, Addr, SizeT)
+DEF0(track_pre_mem_read, CorePart, ThreadId, const HChar*, Addr, SizeT)
+DEF0(track_pre_mem_read_asciiz, CorePart, ThreadId, const HChar*, Addr)
+DEF0(track_pre_mem_write, CorePart, ThreadId, const HChar*, Addr, SizeT)
DEF0(track_post_mem_write, CorePart, ThreadId, Addr, SizeT)
-DEF0(track_pre_reg_read, CorePart, ThreadId, Char*, PtrdiffT, SizeT)
-DEF0(track_post_reg_write, CorePart, ThreadId, PtrdiffT, SizeT)
+DEF0(track_pre_reg_read, CorePart, ThreadId, const HChar*, PtrdiffT, SizeT)
+DEF0(track_post_reg_write, CorePart, ThreadId, PtrdiffT, SizeT)
DEF0(track_post_reg_write_clientcall_return, ThreadId, PtrdiffT, SizeT, Addr)
diff --git a/coregrind/pub_core_syswrap.h b/coregrind/pub_core_syswrap.h
index b3056eb..02cc9b7 100644
--- a/coregrind/pub_core_syswrap.h
+++ b/coregrind/pub_core_syswrap.h
@@ -63,7 +63,7 @@
/* fd leakage calls. */
extern void VG_(init_preopened_fds) ( void );
-extern void VG_(show_open_fds) ( HChar* when );
+extern void VG_(show_open_fds) ( const HChar* when );
// When the final thread is done, where shall I call to shutdown the
// system cleanly? Is set once at startup (in m_main) and never
diff --git a/coregrind/pub_core_tooliface.h b/coregrind/pub_core_tooliface.h
index 1daa772..05d62a7 100644
--- a/coregrind/pub_core_tooliface.h
+++ b/coregrind/pub_core_tooliface.h
@@ -124,7 +124,7 @@
Bool (*tool_recognised_suppression) (Char*, Supp*);
Bool (*tool_read_extra_suppression_info) (Int, Char**, SizeT*, Supp*);
Bool (*tool_error_matches_suppression) (Error*, Supp*);
- Char* (*tool_get_error_name) (Error*);
+ const HChar* (*tool_get_error_name) (Error*);
Bool (*tool_get_extra_suppression_info) (Error*,/*OUT*/Char*,Int);
// VG_(needs).superblock_discards
@@ -212,13 +212,13 @@
void (*track_ban_mem_stack)(Addr, SizeT);
- void (*track_pre_mem_read) (CorePart, ThreadId, Char*, Addr, SizeT);
- void (*track_pre_mem_read_asciiz)(CorePart, ThreadId, Char*, Addr);
- void (*track_pre_mem_write) (CorePart, ThreadId, Char*, Addr, SizeT);
+ void (*track_pre_mem_read) (CorePart, ThreadId, const HChar*, Addr, SizeT);
+ void (*track_pre_mem_read_asciiz)(CorePart, ThreadId, const HChar*, Addr);
+ void (*track_pre_mem_write) (CorePart, ThreadId, const HChar*, Addr, SizeT);
void (*track_post_mem_write) (CorePart, ThreadId, Addr, SizeT);
- void (*track_pre_reg_read) (CorePart, ThreadId, Char*, PtrdiffT, SizeT);
- void (*track_post_reg_write)(CorePart, ThreadId, PtrdiffT, SizeT);
+ void (*track_pre_reg_read) (CorePart, ThreadId, const HChar*, PtrdiffT, SizeT);
+ void (*track_post_reg_write)(CorePart, ThreadId, PtrdiffT, SizeT);
void (*track_post_reg_write_clientcall_return)(ThreadId, PtrdiffT, SizeT,
Addr);
diff --git a/drd/drd_error.c b/drd/drd_error.c
index 1447e36..85304d0 100644
--- a/drd/drd_error.c
+++ b/drd/drd_error.c
@@ -43,7 +43,7 @@
/* Local function declarations. */
-static Char* drd_get_error_name(Error* e);
+static const HChar* drd_get_error_name(Error* e);
/* Local variables. */
@@ -569,7 +569,7 @@
return VG_(get_supp_kind)(supp) == VG_(get_error_kind)(e);
}
-static Char* drd_get_error_name(Error* e)
+static const HChar* drd_get_error_name(Error* e)
{
switch (VG_(get_error_kind)(e))
{
diff --git a/drd/drd_main.c b/drd/drd_main.c
index 7b3570e..624c5f7 100644
--- a/drd/drd_main.c
+++ b/drd/drd_main.c
@@ -262,7 +262,7 @@
static void drd_pre_mem_read(const CorePart part,
const ThreadId tid,
- Char* const s,
+ const HChar* const s,
const Addr a,
const SizeT size)
{
@@ -274,7 +274,7 @@
static void drd_pre_mem_read_asciiz(const CorePart part,
const ThreadId tid,
- Char* const s,
+ const HChar* const s,
const Addr a)
{
const char* p = (void*)a;
diff --git a/exp-dhat/dh_main.c b/exp-dhat/dh_main.c
index 933daa7..139f807 100644
--- a/exp-dhat/dh_main.c
+++ b/exp-dhat/dh_main.c
@@ -727,7 +727,7 @@
// boundary and so we can treat it just as one giant
// read or write.
static
-void dh_handle_noninsn_read ( CorePart part, ThreadId tid, Char* s,
+void dh_handle_noninsn_read ( CorePart part, ThreadId tid, const HChar* s,
Addr base, SizeT size )
{
switch (part) {
diff --git a/exp-sgcheck/pc_common.c b/exp-sgcheck/pc_common.c
index c8769f8..7f8db6c 100644
--- a/exp-sgcheck/pc_common.c
+++ b/exp-sgcheck/pc_common.c
@@ -544,7 +544,7 @@
Addr hi = xe->XE.SysParam.hi;
Seg* seglo = xe->XE.SysParam.seglo;
Seg* seghi = xe->XE.SysParam.seghi;
- Char* s = VG_(get_error_string) (err);
+ const HChar* s = VG_(get_error_string) (err);
HChar* what;
tl_assert(BOTTOM != seglo && BOTTOM != seghi);
@@ -764,7 +764,7 @@
}
}
-HChar* pc_get_error_name ( Error* err )
+const HChar* pc_get_error_name ( Error* err )
{
XError *xe = (XError*)VG_(get_error_extra)(err);
tl_assert(xe);
@@ -784,7 +784,7 @@
tl_assert(buf);
tl_assert(nBuf >= 16); // stay sane
if (XE_SysParam == ekind) {
- Char* errstr = VG_(get_error_string)(err);
+ const HChar* errstr = VG_(get_error_string)(err);
tl_assert(errstr);
VG_(snprintf)(buf, nBuf-1, "%s", errstr);
return True;
diff --git a/exp-sgcheck/pc_common.h b/exp-sgcheck/pc_common.h
index e1c8c0b..86335e1 100644
--- a/exp-sgcheck/pc_common.h
+++ b/exp-sgcheck/pc_common.h
@@ -55,7 +55,7 @@
Bool pc_read_extra_suppression_info ( Int fd, Char** bufpp,
SizeT* nBufp, Supp* su );
Bool pc_error_matches_suppression (Error* err, Supp* su);
-HChar* pc_get_error_name ( Error* err );
+const HChar* pc_get_error_name ( Error* err );
Bool pc_get_extra_suppression_info ( Error* err,
/*OUT*/Char* buf, Int nBuf );
diff --git a/helgrind/hg_errors.c b/helgrind/hg_errors.c
index 527671c..bcf89c3 100644
--- a/helgrind/hg_errors.c
+++ b/helgrind/hg_errors.c
@@ -1333,7 +1333,7 @@
} /* switch (VG_(get_error_kind)(err)) */
}
-HChar* HG_(get_error_name) ( Error* err )
+const HChar* HG_(get_error_name) ( Error* err )
{
switch (VG_(get_error_kind)(err)) {
case XE_Race: return "Race";
diff --git a/helgrind/hg_errors.h b/helgrind/hg_errors.h
index 747a437..c391582 100644
--- a/helgrind/hg_errors.h
+++ b/helgrind/hg_errors.h
@@ -43,7 +43,7 @@
Bool HG_(read_extra_suppression_info) ( Int fd, Char** bufpp, SizeT* nBufp,
Supp* su );
Bool HG_(error_matches_suppression) ( Error* err, Supp* su );
-HChar* HG_(get_error_name) ( Error* err );
+const HChar* HG_(get_error_name) ( Error* err );
Bool HG_(get_extra_suppression_info) ( Error* err,
/*OUT*/Char* buf, Int nBuf );
diff --git a/helgrind/hg_main.c b/helgrind/hg_main.c
index b2a3283..b4ea174 100644
--- a/helgrind/hg_main.c
+++ b/helgrind/hg_main.c
@@ -1701,7 +1701,7 @@
}
static
-void evh__pre_mem_read ( CorePart part, ThreadId tid, Char* s,
+void evh__pre_mem_read ( CorePart part, ThreadId tid, const HChar* s,
Addr a, SizeT size) {
if (SHOW_EVENTS >= 2
|| (SHOW_EVENTS >= 1 && size != 1))
@@ -1714,7 +1714,7 @@
static
void evh__pre_mem_read_asciiz ( CorePart part, ThreadId tid,
- Char* s, Addr a ) {
+ const HChar* s, Addr a ) {
Int len;
if (SHOW_EVENTS >= 1)
VG_(printf)("evh__pre_mem_asciiz(ctid=%d, \"%s\", %p)\n",
@@ -1732,7 +1732,7 @@
}
static
-void evh__pre_mem_write ( CorePart part, ThreadId tid, Char* s,
+void evh__pre_mem_write ( CorePart part, ThreadId tid, const HChar* s,
Addr a, SizeT size ) {
if (SHOW_EVENTS >= 1)
VG_(printf)("evh__pre_mem_write(ctid=%d, \"%s\", %p, %lu)\n",
diff --git a/include/pub_tool_errormgr.h b/include/pub_tool_errormgr.h
index c36487b..4d6af06 100644
--- a/include/pub_tool_errormgr.h
+++ b/include/pub_tool_errormgr.h
@@ -56,11 +56,11 @@
/* 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 );
-Char* VG_(get_error_string) ( Error* err );
-void* VG_(get_error_extra) ( Error* err );
+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 );
/* 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
@@ -73,7 +73,7 @@
If no 'a', 's' or 'extra' of interest needs to be recorded, just use
NULL for them. */
extern void VG_(maybe_record_error) ( ThreadId tid, ErrorKind ekind,
- Addr a, Char* s, void* extra );
+ Addr a, const HChar* s, void* extra );
/* Similar to VG_(maybe_record_error)(), except this one doesn't record the
error -- useful for errors that can only happen once. The errors can be
@@ -83,7 +83,7 @@
be suppressed without possibly printing it. 'count_error' dictates
whether to add the error in the error total count (another mild hack). */
extern Bool VG_(unique_error) ( ThreadId tid, ErrorKind ekind,
- Addr a, Char* s, void* extra,
+ Addr a, const HChar* s, void* extra,
ExeContext* where, Bool print_error,
Bool allow_GDB_attach, Bool count_error );
diff --git a/include/pub_tool_tooliface.h b/include/pub_tool_tooliface.h
index a322181..aa23a0d 100644
--- a/include/pub_tool_tooliface.h
+++ b/include/pub_tool_tooliface.h
@@ -331,7 +331,7 @@
// 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().
- Char* (*get_error_name)(Error* err),
+ const HChar* (*get_error_name)(Error* err),
// This should print into buf[0..nBuf-1] any extra info for the
// error, for --gen-suppressions, but not including any leading
@@ -585,18 +585,18 @@
/* These ones occur around syscalls, signal handling, etc */
void VG_(track_pre_mem_read) (void(*f)(CorePart part, ThreadId tid,
- Char* s, Addr a, SizeT size));
+ const HChar* s, Addr a, SizeT size));
void VG_(track_pre_mem_read_asciiz)(void(*f)(CorePart part, ThreadId tid,
- Char* s, Addr a));
+ const HChar* s, Addr a));
void VG_(track_pre_mem_write) (void(*f)(CorePart part, ThreadId tid,
- Char* s, Addr a, SizeT size));
+ const HChar* s, Addr a, SizeT size));
void VG_(track_post_mem_write) (void(*f)(CorePart part, ThreadId tid,
Addr a, SizeT size));
/* Register events. Use VG_(set_shadow_state_area)() to set the shadow regs
for these events. */
void VG_(track_pre_reg_read) (void(*f)(CorePart part, ThreadId tid,
- Char* s, PtrdiffT guest_state_offset,
+ const HChar* s, PtrdiffT guest_state_offset,
SizeT size));
void VG_(track_post_reg_write)(void(*f)(CorePart part, ThreadId tid,
PtrdiffT guest_state_offset,
diff --git a/memcheck/mc_errors.c b/memcheck/mc_errors.c
index 2c5ffe0..dd8e0e4 100644
--- a/memcheck/mc_errors.c
+++ b/memcheck/mc_errors.c
@@ -890,12 +890,12 @@
/* --- Called from non-generated code --- */
/* This is for memory errors in signal-related memory. */
-void MC_(record_core_mem_error) ( ThreadId tid, Char* msg )
+void MC_(record_core_mem_error) ( ThreadId tid, const HChar* msg )
{
VG_(maybe_record_error)( tid, Err_CoreMem, /*addr*/0, msg, /*extra*/NULL );
}
-void MC_(record_regparam_error) ( ThreadId tid, Char* msg, UInt otag )
+void MC_(record_regparam_error) ( ThreadId tid, const HChar* msg, UInt otag )
{
MC_Error extra;
tl_assert(VG_INVALID_THREADID != tid);
@@ -907,7 +907,7 @@
}
void MC_(record_memparam_error) ( ThreadId tid, Addr a,
- Bool isAddrErr, Char* msg, UInt otag )
+ Bool isAddrErr, const HChar* msg, UInt otag )
{
MC_Error extra;
tl_assert(VG_INVALID_THREADID != tid);
@@ -963,7 +963,7 @@
VG_(maybe_record_error)( tid, Err_IllegalMempool, a, /*s*/NULL, &extra );
}
-void MC_(record_overlap_error) ( ThreadId tid, Char* function,
+void MC_(record_overlap_error) ( ThreadId tid, const HChar* function,
Addr src, Addr dst, SizeT szB )
{
MC_Error extra;
@@ -1025,7 +1025,7 @@
switch (VG_(get_error_kind)(e1)) {
case Err_CoreMem: {
- Char *e1s, *e2s;
+ const HChar *e1s, *e2s;
e1s = VG_(get_error_string)(e1);
e2s = VG_(get_error_string)(e2);
if (e1s == e2s) return True;
@@ -1518,7 +1518,7 @@
}
}
-HChar* MC_(get_error_name) ( Error* err )
+const HChar* MC_(get_error_name) ( Error* err )
{
switch (VG_(get_error_kind)(err)) {
case Err_RegParam: return "Param";
@@ -1565,7 +1565,7 @@
tl_assert(buf);
tl_assert(nBuf >= 16); // stay sane
if (Err_RegParam == ekind || Err_MemParam == ekind) {
- Char* errstr = VG_(get_error_string)(err);
+ const HChar* errstr = VG_(get_error_string)(err);
tl_assert(errstr);
VG_(snprintf)(buf, nBuf-1, "%s", errstr);
return True;
diff --git a/memcheck/mc_include.h b/memcheck/mc_include.h
index f425307..1e1ebee 100644
--- a/memcheck/mc_include.h
+++ b/memcheck/mc_include.h
@@ -382,7 +382,7 @@
Bool MC_(get_extra_suppression_info) ( Error* err,
/*OUT*/Char* buf, Int nBuf );
-HChar* MC_(get_error_name) ( Error* err );
+const HChar* MC_(get_error_name) ( Error* err );
/* Recording of errors */
void MC_(record_address_error) ( ThreadId tid, Addr a, Int szB,
@@ -395,12 +395,12 @@
void MC_(record_illegal_mempool_error) ( ThreadId tid, Addr a );
void MC_(record_freemismatch_error) ( ThreadId tid, MC_Chunk* mc );
-void MC_(record_overlap_error) ( ThreadId tid, Char* function,
+void MC_(record_overlap_error) ( ThreadId tid, const HChar* function,
Addr src, Addr dst, SizeT szB );
-void MC_(record_core_mem_error) ( ThreadId tid, Char* msg );
-void MC_(record_regparam_error) ( ThreadId tid, Char* msg, UInt otag );
+void MC_(record_core_mem_error) ( ThreadId tid, const HChar* msg );
+void MC_(record_regparam_error) ( ThreadId tid, const HChar* msg, UInt otag );
void MC_(record_memparam_error) ( ThreadId tid, Addr a,
- Bool isAddrErr, Char* msg, UInt otag );
+ Bool isAddrErr, const HChar* msg, UInt otag );
void MC_(record_user_error) ( ThreadId tid, Addr a,
Bool isAddrErr, UInt otag );
diff --git a/memcheck/mc_main.c b/memcheck/mc_main.c
index 83eb6c9..2d3eb95 100644
--- a/memcheck/mc_main.c
+++ b/memcheck/mc_main.c
@@ -3723,7 +3723,7 @@
/*------------------------------------------------------------*/
static
-void check_mem_is_addressable ( CorePart part, ThreadId tid, Char* s,
+void check_mem_is_addressable ( CorePart part, ThreadId tid, const HChar* s,
Addr base, SizeT size )
{
Addr bad_addr;
@@ -3747,7 +3747,7 @@
}
static
-void check_mem_is_defined ( CorePart part, ThreadId tid, Char* s,
+void check_mem_is_defined ( CorePart part, ThreadId tid, const HChar* s,
Addr base, SizeT size )
{
UInt otag = 0;
@@ -3781,7 +3781,7 @@
static
void check_mem_is_defined_asciiz ( CorePart part, ThreadId tid,
- Char* s, Addr str )
+ const HChar* s, Addr str )
{
MC_ReadResult res;
Addr bad_addr = 0; // shut GCC up
@@ -3962,7 +3962,7 @@
[offset, offset+len). If any part of that is undefined, record
a parameter error.
*/
-static void mc_pre_reg_read ( CorePart part, ThreadId tid, Char* s,
+static void mc_pre_reg_read ( CorePart part, ThreadId tid, const HChar* s,
PtrdiffT offset, SizeT size)
{
Int i;