More Char/HChar fixes and constification.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13088 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/m_aspacemgr/aspacemgr-common.c b/coregrind/m_aspacemgr/aspacemgr-common.c
index 07b6303..45d7d08 100644
--- a/coregrind/m_aspacemgr/aspacemgr-common.c
+++ b/coregrind/m_aspacemgr/aspacemgr-common.c
@@ -64,14 +64,14 @@
aspacem_assert(2+2 == 5);
}
-void ML_(am_barf) ( HChar* what )
+void ML_(am_barf) ( const HChar* what )
{
VG_(debugLog)(0, "aspacem", "Valgrind: FATAL: %s\n", what);
VG_(debugLog)(0, "aspacem", "Exiting now.\n");
ML_(am_exit)(1);
}
-void ML_(am_barf_toolow) ( HChar* what )
+void ML_(am_barf_toolow) ( const HChar* what )
{
VG_(debugLog)(0, "aspacem",
"Valgrind: FATAL: %s is too low.\n", what);
@@ -81,9 +81,9 @@
}
void ML_(am_assert_fail)( const HChar* expr,
- const Char* file,
+ const HChar* file,
Int line,
- const Char* fn )
+ const HChar* fn )
{
VG_(debugLog)(0, "aspacem",
"Valgrind: FATAL: aspacem assertion failed:\n");
@@ -115,7 +115,7 @@
UInt local_vsprintf ( HChar* buf, const HChar *format, va_list vargs )
{
Int ret;
- Char *aspacem_sprintf_ptr = buf;
+ HChar *aspacem_sprintf_ptr = buf;
ret = VG_(debugLog_vprintf)
( local_add_to_aspacem_sprintf_buf,
@@ -240,7 +240,7 @@
/* --- Pertaining to files --- */
-SysRes ML_(am_open) ( const Char* pathname, Int flags, Int mode )
+SysRes ML_(am_open) ( const HChar* pathname, Int flags, Int mode )
{
SysRes res = VG_(do_syscall3)(__NR_open, (UWord)pathname, flags, mode);
return res;
diff --git a/coregrind/m_aspacemgr/aspacemgr-linux.c b/coregrind/m_aspacemgr/aspacemgr-linux.c
index b56da6a..77d9d5f 100644
--- a/coregrind/m_aspacemgr/aspacemgr-linux.c
+++ b/coregrind/m_aspacemgr/aspacemgr-linux.c
@@ -334,7 +334,7 @@
static void parse_procselfmaps (
void (*record_mapping)( Addr addr, SizeT len, UInt prot,
ULong dev, ULong ino, Off64T offset,
- const UChar* filename ),
+ const HChar* filename ),
void (*record_gap)( Addr addr, SizeT len )
);
@@ -419,7 +419,7 @@
/*--- ---*/
/*-----------------------------------------------------------------*/
-static HChar* show_SegKind ( SegKind sk )
+static const HChar* show_SegKind ( SegKind sk )
{
switch (sk) {
case SkFree: return " ";
@@ -433,7 +433,7 @@
}
}
-static HChar* show_ShrinkMode ( ShrinkMode sm )
+static const HChar* show_ShrinkMode ( ShrinkMode sm )
{
switch (sm) {
case SmLower: return "SmLower";
@@ -445,7 +445,7 @@
static void show_len_concisely ( /*OUT*/HChar* buf, Addr start, Addr end )
{
- HChar* fmt;
+ const HChar* fmt;
ULong len = ((ULong)end) - ((ULong)start) + 1;
if (len < 10*1000*1000ULL) {
@@ -477,7 +477,7 @@
show_nsegment_full ( Int logLevel, Int segNo, NSegment* seg )
{
HChar len_buf[20];
- HChar* name = "(none)";
+ const HChar* name = "(none)";
if (seg->fnIdx >= 0 && seg->fnIdx < segnames_used
&& segnames[seg->fnIdx].inUse
@@ -570,7 +570,7 @@
}
/* Print out the segment array (debugging only!). */
-void VG_(am_show_nsegments) ( Int logLevel, HChar* who )
+void VG_(am_show_nsegments) ( Int logLevel, const HChar* who )
{
Int i;
VG_(debugLog)(logLevel, "aspacem",
@@ -862,7 +862,7 @@
static void sync_check_mapping_callback ( Addr addr, SizeT len, UInt prot,
ULong dev, ULong ino, Off64T offset,
- const UChar* filename )
+ const HChar* filename )
{
Int iLo, iHi, i;
Bool sloppyXcheck;
@@ -990,7 +990,7 @@
prot & VKI_PROT_READ ? 'r' : '-',
prot & VKI_PROT_WRITE ? 'w' : '-',
prot & VKI_PROT_EXEC ? 'x' : '-',
- dev, ino, offset, filename ? (HChar*)filename : "(none)" );
+ dev, ino, offset, filename ? filename : "(none)" );
return;
}
@@ -1535,7 +1535,7 @@
static void read_maps_callback ( Addr addr, SizeT len, UInt prot,
ULong dev, ULong ino, Off64T offset,
- const UChar* filename )
+ const HChar* filename )
{
NSegment seg;
init_nsegment( &seg );
@@ -3098,14 +3098,14 @@
#define M_PROCMAP_BUF 100000
/* static ... to keep it out of the stack frame. */
-static Char procmap_buf[M_PROCMAP_BUF];
+static HChar procmap_buf[M_PROCMAP_BUF];
/* Records length of /proc/self/maps read into procmap_buf. */
static Int buf_n_tot;
/* Helper fns. */
-static Int hexdigit ( Char c )
+static Int hexdigit ( HChar c )
{
if (c >= '0' && c <= '9') return (Int)(c - '0');
if (c >= 'a' && c <= 'f') return 10 + (Int)(c - 'a');
@@ -3113,20 +3113,20 @@
return -1;
}
-static Int decdigit ( Char c )
+static Int decdigit ( HChar c )
{
if (c >= '0' && c <= '9') return (Int)(c - '0');
return -1;
}
-static Int readchar ( const Char* buf, Char* ch )
+static Int readchar ( const HChar* buf, HChar* ch )
{
if (*buf == 0) return 0;
*ch = *buf;
return 1;
}
-static Int readhex ( const Char* buf, UWord* val )
+static Int readhex ( const HChar* buf, UWord* val )
{
/* Read a word-sized hex number. */
Int n = 0;
@@ -3138,7 +3138,7 @@
return n;
}
-static Int readhex64 ( const Char* buf, ULong* val )
+static Int readhex64 ( const HChar* buf, ULong* val )
{
/* Read a potentially 64-bit hex number. */
Int n = 0;
@@ -3150,7 +3150,7 @@
return n;
}
-static Int readdec64 ( const Char* buf, ULong* val )
+static Int readdec64 ( const HChar* buf, ULong* val )
{
Int n = 0;
*val = 0;
@@ -3219,14 +3219,14 @@
static void parse_procselfmaps (
void (*record_mapping)( Addr addr, SizeT len, UInt prot,
ULong dev, ULong ino, Off64T offset,
- const UChar* filename ),
+ const HChar* filename ),
void (*record_gap)( Addr addr, SizeT len )
)
{
Int i, j, i_eol;
Addr start, endPlusOne, gapStart;
- UChar* filename;
- UChar rr, ww, xx, pp, ch, tmp;
+ HChar* filename;
+ HChar rr, ww, xx, pp, ch, tmp;
UInt prot;
UWord maj, min;
ULong foffset, dev, ino;
@@ -3428,7 +3428,7 @@
static void parse_procselfmaps (
void (*record_mapping)( Addr addr, SizeT len, UInt prot,
ULong dev, ULong ino, Off64T offset,
- const UChar* filename ),
+ const HChar* filename ),
void (*record_gap)( Addr addr, SizeT len )
)
{
@@ -3486,7 +3486,7 @@
static void add_mapping_callback(Addr addr, SizeT len, UInt prot,
ULong dev, ULong ino, Off64T offset,
- const UChar *filename)
+ const HChar *filename)
{
// derived from sync_check_mapping_callback()
diff --git a/coregrind/m_aspacemgr/priv_aspacemgr.h b/coregrind/m_aspacemgr/priv_aspacemgr.h
index daa2d8c..cb48bdc 100644
--- a/coregrind/m_aspacemgr/priv_aspacemgr.h
+++ b/coregrind/m_aspacemgr/priv_aspacemgr.h
@@ -65,14 +65,14 @@
__attribute__ ((noreturn))
extern void ML_(am_exit) ( Int status );
-extern void ML_(am_barf) ( HChar* what );
-extern void ML_(am_barf_toolow) ( HChar* what );
+extern void ML_(am_barf) ( const HChar* what );
+extern void ML_(am_barf_toolow) ( const HChar* what );
__attribute__ ((noreturn))
extern void ML_(am_assert_fail) ( const HChar* expr,
- const Char* file,
+ const HChar* file,
Int line,
- const Char* fn );
+ const HChar* fn );
#define aspacem_assert(expr) \
((void) ((expr) ? 0 : \
@@ -105,7 +105,7 @@
/* There is also VG_(do_mmap_NO_NOTIFY), but that's not declared
here (obviously). */
-extern SysRes ML_(am_open) ( const Char* pathname, Int flags, Int mode );
+extern SysRes ML_(am_open) ( const HChar* pathname, Int flags, Int mode );
extern void ML_(am_close) ( Int fd );
extern Int ML_(am_read) ( Int fd, void* buf, Int count);
extern Int ML_(am_readlink) ( HChar* path, HChar* buf, UInt bufsiz );
diff --git a/coregrind/m_coredump/coredump-elf.c b/coregrind/m_coredump/coredump-elf.c
index 42a1965..1f8f0c1 100644
--- a/coregrind/m_coredump/coredump-elf.c
+++ b/coregrind/m_coredump/coredump-elf.c
@@ -150,7 +150,7 @@
struct note {
struct note *next;
ESZ(Nhdr) note;
- Char name[0];
+ HChar name[0];
};
static UInt note_size(const struct note *n)
@@ -160,7 +160,7 @@
}
#if !defined(VGPV_arm_linux_android) && !defined(VGPV_x86_linux_android)
-static void add_note(struct note **list, const Char *name, UInt type,
+static void add_note(struct note **list, const HChar *name, UInt type,
const void *data, UInt datasz)
{
Int namelen = VG_(strlen)(name)+1;
@@ -191,7 +191,7 @@
static void fill_prpsinfo(const ThreadState *tst,
struct vki_elf_prpsinfo *prpsinfo)
{
- static Char name[VKI_PATH_MAX];
+ static HChar name[VKI_PATH_MAX];
VG_(memset)(prpsinfo, 0, sizeof(*prpsinfo));
@@ -219,7 +219,7 @@
prpsinfo->pr_gid = 0;
if (VG_(resolve_filename)(VG_(cl_exec_fd), name, VKI_PATH_MAX)) {
- Char *n = name+VG_(strlen)(name)-1;
+ HChar *n = name+VG_(strlen)(name)-1;
while (n > name && *n != '/')
n--;
@@ -395,7 +395,7 @@
ThreadArchState* arch = (ThreadArchState*)&tst->arch;
#if defined(VGP_x86_linux)
-//:: static void fill_fpu(vki_elf_fpregset_t *fpu, const Char *from)
+//:: static void fill_fpu(vki_elf_fpregset_t *fpu, const HChar *from)
//:: {
//:: if (VG_(have_ssestate)) {
//:: UShort *to;
@@ -413,7 +413,7 @@
//:: VG_(memcpy)(fpu, from, sizeof(*fpu));
//:: }
-//:: fill_fpu(fpu, (const Char *)&arch->m_sse);
+//:: fill_fpu(fpu, (const HChar *)&arch->m_sse);
#elif defined(VGP_amd64_linux)
//:: fpu->cwd = ?;
@@ -504,9 +504,9 @@
static
void make_elf_coredump(ThreadId tid, const vki_siginfo_t *si, UInt max_size)
{
- Char* buf = NULL;
- Char *basename = "vgcore";
- Char *coreext = "";
+ HChar* buf = NULL;
+ const HChar *basename = "vgcore";
+ const HChar *coreext = "";
Int seq = 0;
Int core_fd;
NSegment const * seg;
diff --git a/coregrind/m_debugger.c b/coregrind/m_debugger.c
index 4fc636a..ede0fbc 100644
--- a/coregrind/m_debugger.c
+++ b/coregrind/m_debugger.c
@@ -379,11 +379,11 @@
VG_(kill)(pid, VKI_SIGSTOP) == 0 &&
VG_(ptrace)(VKI_PTRACE_DETACH, pid, NULL, 0) == 0)
{
- Char pidbuf[15];
- Char file[50];
- Char buf[N_BUF];
- Char *bufptr;
- Char *cmdptr;
+ HChar pidbuf[15];
+ HChar file[50];
+ HChar buf[N_BUF];
+ HChar *bufptr;
+ HChar *cmdptr;
VG_(sprintf)(pidbuf, "%d", pid);
VG_(sprintf)(file, "/proc/%d/fd/%d", pid, VG_(cl_exec_fd));
diff --git a/coregrind/m_debuglog.c b/coregrind/m_debuglog.c
index f817b59..4baffc7 100644
--- a/coregrind/m_debuglog.c
+++ b/coregrind/m_debuglog.c
@@ -71,7 +71,7 @@
#if defined(VGP_x86_linux)
-static UInt local_sys_write_stderr ( HChar* buf, Int n )
+static UInt local_sys_write_stderr ( const HChar* buf, Int n )
{
Int result;
@@ -104,7 +104,7 @@
#elif defined(VGP_amd64_linux)
__attribute__((noinline))
-static UInt local_sys_write_stderr ( HChar* buf, Int n )
+static UInt local_sys_write_stderr ( const HChar* buf, Int n )
{
volatile Long block[2];
block[0] = (Long)buf;
@@ -147,7 +147,7 @@
#elif defined(VGP_ppc32_linux)
-static UInt local_sys_write_stderr ( HChar* buf, Int n )
+static UInt local_sys_write_stderr ( const HChar* buf, Int n )
{
volatile Int block[2];
block[0] = (Int)buf;
@@ -190,7 +190,7 @@
#elif defined(VGP_ppc64_linux)
-static UInt local_sys_write_stderr ( HChar* buf, Int n )
+static UInt local_sys_write_stderr ( const HChar* buf, Int n )
{
volatile Long block[2];
block[0] = (Long)buf;
@@ -233,7 +233,7 @@
#elif defined(VGP_arm_linux)
-static UInt local_sys_write_stderr ( HChar* buf, Int n )
+static UInt local_sys_write_stderr ( const HChar* buf, Int n )
{
volatile Int block[2];
block[0] = (Int)buf;
@@ -274,7 +274,7 @@
asm code. Both macros give the same results for Unix-class syscalls (which
these all are, as identified by the use of 'int 0x80'). */
__attribute__((noinline))
-static UInt local_sys_write_stderr ( HChar* buf, Int n )
+static UInt local_sys_write_stderr ( const HChar* buf, Int n )
{
UInt __res;
__asm__ volatile (
@@ -316,7 +316,7 @@
#elif defined(VGP_amd64_darwin)
__attribute__((noinline))
-static UInt local_sys_write_stderr ( HChar* buf, Int n )
+static UInt local_sys_write_stderr ( const HChar* buf, Int n )
{
UInt __res;
__asm__ volatile (
@@ -350,12 +350,12 @@
}
#elif defined(VGP_s390x_linux)
-static UInt local_sys_write_stderr ( HChar* buf, Int n )
+static UInt local_sys_write_stderr ( const HChar* buf, Int n )
{
- register Int r2 asm("2") = 2; /* file descriptor STDERR */
- register HChar* r3 asm("3") = buf;
- register ULong r4 asm("4") = n;
- register ULong r2_res asm("2");
+ register Int r2 asm("2") = 2; /* file descriptor STDERR */
+ register const HChar* r3 asm("3") = buf;
+ register ULong r4 asm("4") = n;
+ register ULong r2_res asm("2");
ULong __res;
__asm__ __volatile__ (
@@ -391,7 +391,7 @@
}
#elif defined(VGP_mips32_linux)
-static UInt local_sys_write_stderr ( HChar* buf, Int n )
+static UInt local_sys_write_stderr ( const HChar* buf, Int n )
{
volatile Int block[2];
block[0] = (Int)buf;
@@ -453,7 +453,7 @@
/* Emit buf[0 .. n-1] to stderr. Unfortunately platform-specific.
*/
-static void emit ( HChar* buf, Int n )
+static void emit ( const HChar* buf, Int n )
{
if (n >= 1)
(void)local_sys_write_stderr(buf, n);
@@ -489,7 +489,7 @@
void* send_arg2,
Int flags,
Int width,
- HChar* str,
+ const HChar* str,
Bool capitalise )
{
# define MAYBE_TOUPPER(ch) (capitalise ? local_toupper(ch) : (ch))
@@ -535,12 +535,12 @@
static
UInt myvprintf_str_XML_simplistic ( void(*send)(HChar,void*),
void* send_arg2,
- HChar* str )
+ const HChar* str )
{
UInt ret = 0;
Int i;
Int len = local_strlen(str);
- HChar* alt;
+ const HChar* alt;
for (i = 0; i < len; i++) {
switch (str[i]) {
@@ -585,7 +585,7 @@
Int ind = 0;
Int i, nc = 0;
Bool neg = False;
- HChar* digits = capitalised ? "0123456789ABCDEF" : "0123456789abcdef";
+ const HChar* digits = capitalised ? "0123456789ABCDEF" : "0123456789abcdef";
UInt ret = 0;
if (base < 2 || base > 16)
@@ -762,15 +762,15 @@
i++;
/* %pS, like %s but escaping chars for XML safety */
/* Note: simplistic; ignores field width and flags */
- char *str = va_arg (vargs, char *);
- if (str == (char*) 0)
+ HChar *str = va_arg (vargs, HChar *);
+ if (str == NULL)
str = "(null)";
ret += myvprintf_str_XML_simplistic(send, send_arg2, str);
} else if (format[i+1] == 's') {
i++;
/* %ps, synonym for %s with --xml=no / %pS with --xml=yes */
- char *str = va_arg (vargs, char *);
- if (str == (char*) 0)
+ HChar *str = va_arg (vargs, HChar *);
+ if (str == NULL)
str = "(null)";
if (clo_xml)
ret += myvprintf_str_XML_simplistic(send, send_arg2, str);
@@ -806,8 +806,8 @@
send(va_arg (vargs, int), send_arg2);
break;
case 's': case 'S': { /* %s */
- char *str = va_arg (vargs, char *);
- if (str == (char*) 0) str = "(null)";
+ HChar *str = va_arg (vargs, HChar *);
+ if (str == NULL) str = "(null)";
ret += myvprintf_str(send, send_arg2,
flags, width, str, format[i]=='S');
break;
@@ -849,7 +849,7 @@
/* Module startup. */
/* EXPORTED */
-void VG_(debugLog_startup) ( Int level, HChar* who )
+void VG_(debugLog_startup) ( Int level, const HChar* who )
{
if (level < 0) level = 0;
if (level > 10) level = 10;
@@ -925,7 +925,7 @@
(void)myvprintf_str ( add_to_buf, &buf, 0, 1, ":", False );
(void)myvprintf_int64 ( add_to_buf, &buf, 0, 10, 1, False, (ULong)level );
(void)myvprintf_str ( add_to_buf, &buf, 0, 1, ":", False );
- (void)myvprintf_str ( add_to_buf, &buf, 0, 8, (HChar*)modulename, False );
+ (void)myvprintf_str ( add_to_buf, &buf, 0, 8, modulename, False );
(void)myvprintf_str ( add_to_buf, &buf, 0, indent, "", False );
va_start(vargs,format);
diff --git a/coregrind/m_errormgr.c b/coregrind/m_errormgr.c
index fe34d01..84bf891 100644
--- a/coregrind/m_errormgr.c
+++ b/coregrind/m_errormgr.c
@@ -348,7 +348,7 @@
{
Char xtra[256]; /* assumed big enough (is overrun-safe) */
Bool anyXtra;
- Char* name;
+ const HChar* name;
ExeContext* ec;
XArray* /* HChar */ text;
diff --git a/coregrind/m_gdbserver/server.c b/coregrind/m_gdbserver/server.c
index 64db90d..736bd91 100644
--- a/coregrind/m_gdbserver/server.c
+++ b/coregrind/m_gdbserver/server.c
@@ -27,6 +27,7 @@
#include "pub_core_translate.h"
#include "pub_core_mallocfree.h"
#include "pub_core_initimg.h"
+#include "pub_core_syswrap.h" // VG_(show_open_fds)
unsigned long cont_thread;
unsigned long general_thread;
diff --git a/coregrind/m_hashtable.c b/coregrind/m_hashtable.c
index 96b8902..abf1df0 100644
--- a/coregrind/m_hashtable.c
+++ b/coregrind/m_hashtable.c
@@ -47,7 +47,7 @@
UInt iterChain; // next chain to be traversed by the iterator
VgHashNode** chains; // expanding array of hash chains
Bool iterOK; // table safe to iterate over?
- HChar* name; // name of table (for debugging only)
+ const HChar* name; // name of table (for debugging only)
};
#define N_HASH_PRIMES 20
@@ -64,7 +64,7 @@
/*--- Functions ---*/
/*--------------------------------------------------------------------*/
-VgHashTable VG_(HT_construct) ( HChar* name )
+VgHashTable VG_(HT_construct) ( const HChar* name )
{
/* Initialises to zero, ie. all entries NULL */
SizeT n_chains = primes[0];
diff --git a/coregrind/m_libcassert.c b/coregrind/m_libcassert.c
index 93d333d..8e555f1 100644
--- a/coregrind/m_libcassert.c
+++ b/coregrind/m_libcassert.c
@@ -271,7 +271,7 @@
Int line, const HChar* fn, const HChar* format, ... )
{
va_list vargs;
- Char buf[256];
+ HChar buf[256];
const HChar* component;
const HChar* bugs_to;
diff --git a/coregrind/m_libcfile.c b/coregrind/m_libcfile.c
index 51e8de8..4f76c83 100644
--- a/coregrind/m_libcfile.c
+++ b/coregrind/m_libcfile.c
@@ -919,7 +919,7 @@
# endif
}
-Int VG_(write_socket)( Int sd, void *msg, Int count )
+Int VG_(write_socket)( Int sd, const void *msg, Int count )
{
/* This is actually send(). */
diff --git a/coregrind/m_libcprint.c b/coregrind/m_libcprint.c
index 8f0b520..b4a6c2b 100644
--- a/coregrind/m_libcprint.c
+++ b/coregrind/m_libcprint.c
@@ -57,7 +57,7 @@
/* Do the low-level send of a message to the logging sink. */
static
-void send_bytes_to_logging_sink ( OutputSink* sink, Char* msg, Int nbytes )
+void send_bytes_to_logging_sink ( OutputSink* sink, const HChar* msg, Int nbytes )
{
if (sink->is_socket) {
Int rc = VG_(write_socket)( sink->fd, msg, nbytes );
@@ -179,7 +179,7 @@
*(*b)++ = c;
}
-UInt VG_(vsprintf) ( Char* buf, const HChar *format, va_list vargs )
+UInt VG_(vsprintf) ( HChar* buf, const HChar *format, va_list vargs )
{
Int ret;
HChar* sprintf_ptr = buf;
@@ -193,7 +193,7 @@
return ret;
}
-UInt VG_(sprintf) ( Char* buf, const HChar *format, ... )
+UInt VG_(sprintf) ( HChar* buf, const HChar *format, ... )
{
UInt ret;
va_list vargs;
@@ -226,7 +226,7 @@
}
}
-UInt VG_(vsnprintf) ( Char* buf, Int size, const HChar *format, va_list vargs )
+UInt VG_(vsnprintf) ( HChar* buf, Int size, const HChar *format, va_list vargs )
{
snprintf_buf_t b;
b.buf = buf;
@@ -239,7 +239,7 @@
return b.buf_used;
}
-UInt VG_(snprintf) ( Char* buf, Int size, const HChar *format, ... )
+UInt VG_(snprintf) ( HChar* buf, Int size, const HChar *format, ... )
{
UInt ret;
va_list vargs;
@@ -267,11 +267,11 @@
// Percentify n/m with d decimal places. Includes the '%' symbol at the end.
// Right justifies in 'buf'.
-void VG_(percentify)(ULong n, ULong m, UInt d, Int n_buf, char buf[])
+void VG_(percentify)(ULong n, ULong m, UInt d, Int n_buf, HChar buf[])
{
Int i, len, space;
ULong p1;
- Char fmt[32];
+ HChar fmt[32];
if (m == 0) {
// Have to generate the format string in order to be flexible about
diff --git a/coregrind/m_main.c b/coregrind/m_main.c
index 8af79ba..6658a70 100644
--- a/coregrind/m_main.c
+++ b/coregrind/m_main.c
@@ -1415,7 +1415,7 @@
void show_BB_profile ( BBProfEntry tops[], UInt n_tops, ULong score_total )
{
ULong score_cumul, score_here;
- Char buf_cumul[10], buf_here[10];
+ HChar buf_cumul[10], buf_here[10];
Char name[64];
Int r;
diff --git a/coregrind/m_scheduler/scheduler.c b/coregrind/m_scheduler/scheduler.c
index 75f28b2..24ff106 100644
--- a/coregrind/m_scheduler/scheduler.c
+++ b/coregrind/m_scheduler/scheduler.c
@@ -172,7 +172,7 @@
------------------------------------------------------------------ */
static
-void print_sched_event ( ThreadId tid, Char* what )
+void print_sched_event ( ThreadId tid, const HChar* what )
{
VG_(message)(Vg_DebugMsg, " SCHED[%d]: %s\n", tid, what );
}
@@ -253,7 +253,7 @@
When this returns, we'll actually be running.
*/
-void VG_(acquire_BigLock)(ThreadId tid, HChar* who)
+void VG_(acquire_BigLock)(ThreadId tid, const HChar* who)
{
ThreadState *tst;
@@ -301,7 +301,8 @@
but it may mean that we remain in a Runnable state and we're just
yielding the CPU to another thread).
*/
-void VG_(release_BigLock)(ThreadId tid, ThreadStatus sleepstate, HChar* who)
+void VG_(release_BigLock)(ThreadId tid, ThreadStatus sleepstate,
+ const HChar* who)
{
ThreadState *tst = VG_(get_ThreadState)(tid);
@@ -316,7 +317,7 @@
VG_(running_tid) = VG_INVALID_THREADID;
if (VG_(clo_trace_sched)) {
- Char buf[200];
+ HChar buf[200];
vg_assert(VG_(strlen)(who) <= 200-100);
VG_(sprintf)(buf, "releasing lock (%s) -> %s",
who, VG_(name_of_ThreadStatus)(sleepstate));
@@ -341,13 +342,13 @@
}
/* See pub_core_scheduler.h for description */
-void VG_(acquire_BigLock_LL) ( HChar* who )
+void VG_(acquire_BigLock_LL) ( const HChar* who )
{
ML_(acquire_sched_lock)(the_BigLock);
}
/* See pub_core_scheduler.h for description */
-void VG_(release_BigLock_LL) ( HChar* who )
+void VG_(release_BigLock_LL) ( const HChar* who )
{
ML_(release_sched_lock)(the_BigLock);
}
@@ -1830,7 +1831,7 @@
case VG_USERREQ__MAP_IP_TO_SRCLOC: {
Addr ip = arg[1];
- UChar* buf64 = (UChar*)arg[2];
+ HChar* buf64 = (HChar*)arg[2];
VG_(memset)(buf64, 0, 64);
UInt linenum = 0;
@@ -1907,8 +1908,8 @@
if (!whined && VG_(clo_verbosity) > 2) {
// Allow for requests in core, but defined by tools, which
// have 0 and 0 in their two high bytes.
- Char c1 = (arg[0] >> 24) & 0xff;
- Char c2 = (arg[0] >> 16) & 0xff;
+ HChar c1 = (arg[0] >> 24) & 0xff;
+ HChar c2 = (arg[0] >> 16) & 0xff;
if (c1 == 0) c1 = '_';
if (c2 == 0) c2 = '_';
VG_(message)(Vg_UserMsg, "Warning:\n"
diff --git a/coregrind/m_tooliface.c b/coregrind/m_tooliface.c
index 1b9522c..b9229ca 100644
--- a/coregrind/m_tooliface.c
+++ b/coregrind/m_tooliface.c
@@ -234,7 +234,7 @@
Bool (*read_extra) (Int, Char**, SizeT*, Supp*),
Bool (*matches) (Error*, Supp*),
const HChar* (*name) (Error*),
- Bool (*get_xtra_si)(Error*,/*OUT*/Char*,Int)
+ Bool (*get_xtra_si)(Error*,/*OUT*/HChar*,Int)
)
{
VG_(needs).tool_errors = True;
diff --git a/coregrind/m_translate.c b/coregrind/m_translate.c
index 016d931..db53b46 100644
--- a/coregrind/m_translate.c
+++ b/coregrind/m_translate.c
@@ -73,7 +73,7 @@
void VG_(print_translation_stats) ( void )
{
- Char buf[7];
+ HChar buf[7];
UInt n_SP_updates = n_SP_updates_fast + n_SP_updates_generic_known
+ n_SP_updates_generic_unknown;
VG_(percentify)(n_SP_updates_fast, n_SP_updates, 1, 6, buf);
diff --git a/coregrind/m_vkiscnums.c b/coregrind/m_vkiscnums.c
index dbd1f84..f7fddcb 100644
--- a/coregrind/m_vkiscnums.c
+++ b/coregrind/m_vkiscnums.c
@@ -46,13 +46,13 @@
#if defined(VGO_linux)
//---------------------------------------------------------------------------
-Char* VG_(sysnum_string)(Word sysnum, SizeT n_buf, Char* buf)
+HChar* VG_(sysnum_string)(Word sysnum, SizeT n_buf, HChar* buf)
{
VG_(snprintf)(buf, n_buf, "%3ld", sysnum);
return buf;
}
-Char* VG_(sysnum_string_extra)(Word sysnum, SizeT n_buf, Char* buf)
+HChar* VG_(sysnum_string_extra)(Word sysnum, SizeT n_buf, HChar* buf)
{
return VG_(sysnum_string)(sysnum, n_buf, buf);
}
@@ -61,9 +61,9 @@
#elif defined(VGO_darwin)
//---------------------------------------------------------------------------
-Char* VG_(sysnum_string)(Word sysnum, SizeT n_buf, Char* buf)
+HChar* VG_(sysnum_string)(Word sysnum, SizeT n_buf, HChar* buf)
{
- Char* classname = NULL;
+ const HChar* classname = NULL;
switch (VG_DARWIN_SYSNO_CLASS(sysnum)) {
case VG_DARWIN_SYSCALL_CLASS_MACH: classname = "mach"; break;
case VG_DARWIN_SYSCALL_CLASS_UNIX: classname = "unix"; break;
@@ -76,7 +76,7 @@
return buf;
}
-Char* VG_(sysnum_string_extra)(Word sysnum, SizeT n_buf, Char* buf)
+HChar* VG_(sysnum_string_extra)(Word sysnum, SizeT n_buf, HChar* buf)
{
return VG_(sysnum_string)(sysnum, n_buf, buf);
}
diff --git a/coregrind/pub_core_aspacemgr.h b/coregrind/pub_core_aspacemgr.h
index 45cac3c..0ed1c4a 100644
--- a/coregrind/pub_core_aspacemgr.h
+++ b/coregrind/pub_core_aspacemgr.h
@@ -98,7 +98,7 @@
extern ULong VG_(am_get_anonsize_total)( void );
/* Show the segment array on the debug log, at given loglevel. */
-extern void VG_(am_show_nsegments) ( Int logLevel, HChar* who );
+extern void VG_(am_show_nsegments) ( Int logLevel, const HChar* who );
/* Get the filename corresponding to this segment, if known and if it
has one. The returned name's storage cannot be assumed to be
diff --git a/coregrind/pub_core_debuglog.h b/coregrind/pub_core_debuglog.h
index 6b2a5a3..c49f8ae 100644
--- a/coregrind/pub_core_debuglog.h
+++ b/coregrind/pub_core_debuglog.h
@@ -56,7 +56,7 @@
/* Module startup. */
extern
-void VG_(debugLog_startup) ( Int level, HChar* who );
+void VG_(debugLog_startup) ( Int level, const HChar* who );
/* Whether %ps should escape XML metacharacters. */
diff --git a/coregrind/pub_core_libcfile.h b/coregrind/pub_core_libcfile.h
index 265b280..8e7c20b 100644
--- a/coregrind/pub_core_libcfile.h
+++ b/coregrind/pub_core_libcfile.h
@@ -65,7 +65,7 @@
extern Int VG_(socket) ( Int domain, Int type, Int protocol );
-extern Int VG_(write_socket)( Int sd, void *msg, Int count );
+extern Int VG_(write_socket)( Int sd, const void *msg, Int count );
extern Int VG_(getsockname) ( Int sd, struct vki_sockaddr *name, Int *namelen );
extern Int VG_(getpeername) ( Int sd, struct vki_sockaddr *name, Int *namelen );
extern Int VG_(getsockopt) ( Int sd, Int level, Int optname,
diff --git a/coregrind/pub_core_scheduler.h b/coregrind/pub_core_scheduler.h
index 8104562..60d8c87 100644
--- a/coregrind/pub_core_scheduler.h
+++ b/coregrind/pub_core_scheduler.h
@@ -57,12 +57,12 @@
thread state to VgTs_Runnable, and the thread will attempt to take
the CPU lock. By the time it returns, tid will be the running
thread. */
-extern void VG_(acquire_BigLock) ( ThreadId tid, HChar* who );
+extern void VG_(acquire_BigLock) ( ThreadId tid, const HChar* who );
/* Simple version, which simply acquires the lock, but does not mess
with the guest state in the same way as the non _LL version
does. */
-extern void VG_(acquire_BigLock_LL) ( HChar* who );
+extern void VG_(acquire_BigLock_LL) ( const HChar* who );
/* Set a thread into a sleeping state. Before the call, the thread
must be runnable, and holding the CPU lock. When this call
@@ -73,10 +73,10 @@
the caller's responsibility to actually block until the thread is
ready to run again. */
extern void VG_(release_BigLock) ( ThreadId tid,
- ThreadStatus state, HChar* who );
+ ThreadStatus state, const HChar* who );
/* Matching function to acquire_BigLock_LL. */
-extern void VG_(release_BigLock_LL) ( HChar* who );
+extern void VG_(release_BigLock_LL) ( const HChar* who );
/* Whether the specified thread owns the big lock. */
extern Bool VG_(owns_BigLock_LL) ( ThreadId tid );
diff --git a/coregrind/pub_core_tooliface.h b/coregrind/pub_core_tooliface.h
index 05d62a7..10a6a75 100644
--- a/coregrind/pub_core_tooliface.h
+++ b/coregrind/pub_core_tooliface.h
@@ -125,7 +125,7 @@
Bool (*tool_read_extra_suppression_info) (Int, Char**, SizeT*, Supp*);
Bool (*tool_error_matches_suppression) (Error*, Supp*);
const HChar* (*tool_get_error_name) (Error*);
- Bool (*tool_get_extra_suppression_info) (Error*,/*OUT*/Char*,Int);
+ Bool (*tool_get_extra_suppression_info) (Error*,/*OUT*/HChar*,Int);
// VG_(needs).superblock_discards
void (*tool_discard_superblock_info)(Addr64, VexGuestExtents);