if (state_machine_regs.is_stmt) {
if (state_machine_regs.last_address)
- VG_(addLineInfo) (
+ ML_(addLineInfo) (
si,
(Char*)index_WordArray(filenames,
state_machine_regs.last_file),
case DW_LNE_define_file:
name = data;
- addto_WordArray( filenames, (Word)VG_(addStr)(si,name,-1) );
+ addto_WordArray( filenames, (Word)ML_(addStr)(si,name,-1) );
data += VG_(strlen) ((char *) data) + 1;
read_leb128 (data, & bytes_read, 0);
data += bytes_read;
addto_WordArray( &filenames, (Word)NULL );
if (ui->compdir)
- addto_WordArray( &dirnames, (Word)VG_(addStr)(si, ui->compdir, -1) );
+ addto_WordArray( &dirnames, (Word)ML_(addStr)(si, ui->compdir, -1) );
else
- addto_WordArray( &dirnames, (Word)VG_(addStr)(si, ".", -1) );
+ addto_WordArray( &dirnames, (Word)ML_(addStr)(si, ".", -1) );
addto_WordArray( &fnidx2dir, (Word)0 ); /* compilation dir */
info.li_length = * ((UInt *)(external->li_length));
if (info.li_length == 0xffffffff) {
- VG_(symerr)("64-bit DWARF line info is not supported yet.");
+ ML_(symerr)("64-bit DWARF line info is not supported yet.");
goto out;
}
if (info.li_length + sizeof (external->li_length) > noLargerThan) {
- VG_(symerr)("DWARF line info appears to be corrupt "
+ ML_(symerr)("DWARF line info appears to be corrupt "
"- the section is too small");
goto out;
}
/* Check its version number. */
info.li_version = * ((UShort *) (external->li_version));
if (info.li_version != 2) {
- VG_(symerr)("Only DWARF version 2 line info "
+ ML_(symerr)("Only DWARF version 2 line info "
"is currently supported.");
goto out;
}
VG_(strcat)(buf, "/");
VG_(strcat)(buf, data);
vg_assert(VG_(strlen)(buf) < NBUF);
- addto_WordArray( &dirnames, (Word)VG_(addStr)(si,buf,-1) );
+ addto_WordArray( &dirnames, (Word)ML_(addStr)(si,buf,-1) );
if (0) VG_(printf)("rel path %s\n", buf);
} else {
/* just use 'data'. */
- addto_WordArray( &dirnames, (Word)VG_(addStr)(si,data,-1) );
+ addto_WordArray( &dirnames, (Word)ML_(addStr)(si,data,-1) );
if (0) VG_(printf)("abs path %s\n", data);
}
# undef NBUF
}
if (*data != 0) {
- VG_(symerr)("can't find NUL at end of DWARF2 directory table");
+ ML_(symerr)("can't find NUL at end of DWARF2 directory table");
goto out;
}
data ++;
read_leb128 (data, & bytes_read, 0);
data += bytes_read;
- addto_WordArray( &filenames, (Word)VG_(addStr)(si,name,-1) );
+ addto_WordArray( &filenames, (Word)ML_(addStr)(si,name,-1) );
addto_WordArray( &fnidx2dir, (Word)diridx );
if (0) VG_(printf)("file %s diridx %d\n", name, diridx );
}
if (*data != 0) {
- VG_(symerr)("can't find NUL at end of DWARF2 file name table");
+ ML_(symerr)("can't find NUL at end of DWARF2 file name table");
goto out;
}
data ++;
if (state_machine_regs.is_stmt) {
/* only add a statement if there was a previous boundary */
if (state_machine_regs.last_address)
- VG_(addLineInfo)(
+ ML_(addLineInfo)(
si,
(Char*)index_WordArray( &filenames,
state_machine_regs.last_file ),
if (state_machine_regs.is_stmt) {
/* only add a statement if there was a previous boundary */
if (state_machine_regs.last_address)
- VG_(addLineInfo)(
+ ML_(addLineInfo)(
si,
(Char*)index_WordArray( &filenames,
state_machine_regs.last_file ),
* Inputs: given .debug_xxx sections
* Output: update si to contain all the dwarf2 debug infos
*/
-void VG_(read_debuginfo_dwarf2)
+void ML_(read_debuginfo_dwarf2)
( SegInfo* si,
UChar* debuginfo, Int debug_info_sz, /* .debug_info */
UChar* debugabbrev, /* .debug_abbrev */
blklen = *((UInt*)block); /* This block length */
if ( block + blklen + 4 > end ) {
- VG_(symerr)( "Last block truncated in .debug_info; ignoring" );
+ ML_(symerr)( "Last block truncated in .debug_info; ignoring" );
return;
}
ver = *((UShort*)(block + 4)); /* version should be 2 */
if ( ver != 2 ) {
- VG_(symerr)( "Ignoring non-dwarf2 block in .debug_info" );
+ ML_(symerr)( "Ignoring non-dwarf2 block in .debug_info" );
continue;
}
/* end of enums taken from gdb-6.0 sources */
-void VG_(read_debuginfo_dwarf1) (
+void ML_(read_debuginfo_dwarf1) (
SegInfo* si,
UChar* dwarf1d, Int dwarf1d_sz,
UChar* dwarf1l, Int dwarf1l_sz )
UChar* ptr;
UInt prev_line, prev_delta;
- curr_filenm = VG_(addStr) ( si, src_filename, -1 );
+ curr_filenm = ML_(addStr) ( si, src_filename, -1 );
prev_line = prev_delta = 0;
ptr = dwarf1l + stmt_list;
if (delta > 0 && prev_line > 0) {
if (0) VG_(printf) (" %d %d-%d\n",
prev_line, prev_delta, delta-1);
- VG_(addLineInfo) ( si, curr_filenm, NULL,
+ ML_(addLineInfo) ( si, curr_filenm, NULL,
base + prev_delta, base + delta,
prev_line, 0 );
}
/* ------------ Deal with summary-info records ------------ */
-void VG_(ppCfiSI) ( CfiSI* si )
+void ML_(ppCfiSI) ( CfiSI* si )
{
# define SHOW_HOW(_how, _off) \
do { \
if (loc_prev != ctx->loc && si) {
summ_ok = summarise_context ( &cfisi, loc_prev, ctx );
if (summ_ok) {
- VG_(addCfiSI)(si, &cfisi);
+ ML_(addCfiSI)(si, &cfisi);
if (VG_(clo_trace_cfi))
- VG_(ppCfiSI)(&cfisi);
+ ML_(ppCfiSI)(&cfisi);
}
}
}
if (si) {
summ_ok = summarise_context ( &cfisi, loc_prev, ctx );
if (summ_ok) {
- VG_(addCfiSI)(si, &cfisi);
+ ML_(addCfiSI)(si, &cfisi);
if (VG_(clo_trace_cfi))
- VG_(ppCfiSI)(&cfisi);
+ ML_(ppCfiSI)(&cfisi);
}
}
}
static CIE the_CIEs[N_CIEs];
-void VG_(read_callframe_info_dwarf2)
+void ML_(read_callframe_info_dwarf2)
( /*OUT*/SegInfo* si,
UChar* ehframe, Int ehframe_sz, Addr ehframe_addr )
{
}
CfiSI;
-extern void VG_(ppCfiSI) ( CfiSI* );
+extern void ML_(ppCfiSI) ( CfiSI* );
/* A structure which contains information pertaining to one mapped
};
extern
-Char *VG_(addStr) ( SegInfo* si, Char* str, Int len );
+Char *ML_(addStr) ( SegInfo* si, Char* str, Int len );
extern
-void VG_(addScopeInfo) ( SegInfo* si, Addr this, Addr next, Scope *scope);
+void ML_(addScopeInfo) ( SegInfo* si, Addr this, Addr next, Scope *scope);
extern
-void VG_(addLineInfo) ( SegInfo* si,
+void ML_(addLineInfo) ( SegInfo* si,
Char* filename,
Char* dirname, /* NULL is allowable */
Addr this, Addr next, Int lineno, Int entry);
extern
-void VG_(addCfiSI) ( SegInfo* si, CfiSI* cfisi );
+void ML_(addCfiSI) ( SegInfo* si, CfiSI* cfisi );
/* Non-fatal -- use vg_panic if terminal. */
extern
-void VG_(symerr) ( Char* msg );
+void ML_(symerr) ( Char* msg );
/* --------------------
Stabs reader
-------------------- */
extern
-void VG_(read_debuginfo_stabs) ( SegInfo* si,
+void ML_(read_debuginfo_stabs) ( SegInfo* si,
UChar* stabC, Int stab_sz,
UChar* stabstr, Int stabstr_sz );
DWARF2 reader
-------------------- */
extern
-void VG_(read_debuginfo_dwarf2)
+void ML_(read_debuginfo_dwarf2)
( SegInfo* si,
UChar* debuginfo, Int debug_info_sz, /* .debug_info */
UChar* debugabbrev, /* .debug_abbrev */
DWARF1 reader
-------------------- */
extern
-void VG_(read_debuginfo_dwarf1) ( SegInfo* si,
+void ML_(read_debuginfo_dwarf1) ( SegInfo* si,
UChar* dwarf1d, Int dwarf1d_sz,
UChar* dwarf1l, Int dwarf1l_sz );
CFI reader
-------------------- */
extern
-void VG_(read_callframe_info_dwarf2)
+void ML_(read_callframe_info_dwarf2)
( /*OUT*/SegInfo* si, UChar* ehframe, Int ehframe_sz, Addr ehframe_addr );
unresolved symbols. If type is not a typedef, then this is just
returns type.
*/
-SymType *VG_(st_basetype)(SymType *type, Bool resolve);
+SymType *ML_(st_basetype)(SymType *type, Bool resolve);
-void VG_(st_setname)(SymType *ty, Char *name);
+void ML_(st_setname)(SymType *ty, Char *name);
typedef void (SymResolver)(SymType *, void *);
/* Create an unresolved type */
-SymType *VG_(st_mkunresolved)(SymType *, SymResolver *resolve, void *data);
+SymType *ML_(st_mkunresolved)(SymType *, SymResolver *resolve, void *data);
/* update an unresolved type's data */
-void VG_(st_unresolved_setdata)(SymType *, SymResolver *resolve, void *data);
+void ML_(st_unresolved_setdata)(SymType *, SymResolver *resolve, void *data);
-Bool VG_(st_isresolved)(SymType *);
-UInt VG_(st_sizeof)(SymType *);
+Bool ML_(st_isresolved)(SymType *);
+UInt ML_(st_sizeof)(SymType *);
/* Unknown type (unparsable) */
-SymType *VG_(st_mkunknown)(SymType *);
+SymType *ML_(st_mkunknown)(SymType *);
-SymType *VG_(st_mkvoid)(SymType *);
+SymType *ML_(st_mkvoid)(SymType *);
-SymType *VG_(st_mkint)(SymType *, UInt size, Bool isSigned);
-SymType *VG_(st_mkbool)(SymType *, UInt size);
-SymType *VG_(st_mkchar)(SymType *, Bool isSigned);
-SymType *VG_(st_mkfloat)(SymType *, UInt size);
-SymType *VG_(st_mkdouble)(SymType *, UInt size);
+SymType *ML_(st_mkint)(SymType *, UInt size, Bool isSigned);
+SymType *ML_(st_mkbool)(SymType *, UInt size);
+SymType *ML_(st_mkchar)(SymType *, Bool isSigned);
+SymType *ML_(st_mkfloat)(SymType *, UInt size);
+SymType *ML_(st_mkdouble)(SymType *, UInt size);
-SymType *VG_(st_mkpointer)(SymType *, SymType *);
-SymType *VG_(st_mkrange)(SymType *, SymType *, Int min, Int max);
+SymType *ML_(st_mkpointer)(SymType *, SymType *);
+SymType *ML_(st_mkrange)(SymType *, SymType *, Int min, Int max);
-SymType *VG_(st_mkstruct)(SymType *, UInt size, UInt nfields);
-SymType *VG_(st_mkunion)(SymType *, UInt size, UInt nfields);
-void VG_(st_addfield)(SymType *, Char *name, SymType *, UInt off, UInt size);
+SymType *ML_(st_mkstruct)(SymType *, UInt size, UInt nfields);
+SymType *ML_(st_mkunion)(SymType *, UInt size, UInt nfields);
+void ML_(st_addfield)(SymType *, Char *name, SymType *, UInt off, UInt size);
-SymType *VG_(st_mkenum)(SymType *, UInt ntags);
-SymType *VG_(st_addtag)(SymType *, Char *name, Int val);
+SymType *ML_(st_mkenum)(SymType *, UInt ntags);
+SymType *ML_(st_addtag)(SymType *, Char *name, Int val);
-SymType *VG_(st_mkarray)(SymType *, SymType *idxtype, SymType *artype);
+SymType *ML_(st_mkarray)(SymType *, SymType *idxtype, SymType *artype);
-SymType *VG_(st_mktypedef)(SymType *, Char *name, SymType *type);
+SymType *ML_(st_mktypedef)(SymType *, Char *name, SymType *type);
-Bool VG_(st_isstruct)(SymType *);
-Bool VG_(st_isunion)(SymType *);
-Bool VG_(st_isenum)(SymType *);
+Bool ML_(st_isstruct)(SymType *);
+Bool ML_(st_isunion)(SymType *);
+Bool ML_(st_isenum)(SymType *);
/* ------------------------------------------------------------
Interface with symtab.c
Variable *container;
};
-Variable *VG_(get_scope_variables)(ThreadId tid);
+Variable *ML_(get_scope_variables)(ThreadId tid);
#endif // __PRIV_SYMTYPES_H
sl = VG_(arena_malloc)(VG_AR_SYMTAB, sizeof(*sl));
if (isstruct)
- ty = VG_(st_mkstruct)(def, 0, 0);
+ ty = ML_(st_mkstruct)(def, 0, 0);
else
- ty = VG_(st_mkunion)(def, 0, 0);
+ ty = ML_(st_mkunion)(def, 0, 0);
- VG_(st_setname)(ty, name);
+ ML_(st_setname)(ty, name);
sl->isstruct = isstruct;
sl->type = ty;
sl->name = name;
VG_(printf)("defining %s ref for %s %p -> %p\n",
isstruct ? "struct" : "union", name, ref, def);
- def = VG_(st_mktypedef)(ref, name, VG_(st_basetype)(def, False));
+ def = ML_(st_mktypedef)(ref, name, ML_(st_basetype)(def, False));
}
- VG_(st_setname)(def, name);
+ ML_(st_setname)(def, name);
return def;
}
{
static const Bool debug = False || stabs_debug;
Char *str = (Char *)data;
- vg_assert(!VG_(st_isresolved)(st));
+ vg_assert(!ML_(st_isresolved)(st));
if (debug)
VG_(printf)("stab_resolve: failing to do anything useful with symtype %p=%s\n",
}
if (stabtype->type == NULL) {
- stabtype->type = VG_(st_mkunresolved)(def, stab_resolve, NULL);
+ stabtype->type = ML_(st_mkunresolved)(def, stab_resolve, NULL);
if (debug)
VG_(printf)("making (%d,%d) %p unresolved\n", file, sym, stabtype->type);
}
/* a type definition */
p++;
- if (VG_(st_isresolved)(symtype)) {
+ if (ML_(st_isresolved)(symtype)) {
/* a redefinition; clear the old type out */
StabType *stabtype = getStabType(tab, file, sym);
- symtype = stabtype->type = VG_(st_mkunresolved)(NULL, stab_resolve, NULL);
+ symtype = stabtype->type = ML_(st_mkunresolved)(NULL, stab_resolve, NULL);
if (debug)
VG_(printf)("creating new type %p for definition (%d,%d)\n",
symtype, file, sym);
} else
- VG_(st_unresolved_setdata)(symtype, stab_resolve, p);
+ ML_(st_unresolved_setdata)(symtype, stab_resolve, p);
if (debug)
VG_(printf)("defining type %p (%d,%d) = %s\n", symtype, file, sym, p);
vg_assert(stabtype->type != NULL);
if (0) {
/* XXX bogus */
- vg_assert(!VG_(st_isresolved)(stabtype->type));
+ vg_assert(!ML_(st_isresolved)(stabtype->type));
VG_(arena_free)(VG_AR_SYMTAB, stabtype->type); /* XXX proper free method? */
}
stabtype->type = type;
- } else if (!VG_(st_isresolved)(type)) {
+ } else if (!ML_(st_isresolved)(type)) {
/* If type is defined in terms of itself, and is
therefore not resolved, it is void */
if (debug)
VG_(printf)("type %p is defined in terms of self - making void\n", type);
- type = VG_(st_mkvoid)(type);
+ type = ML_(st_mkvoid)(type);
}
} else {
/* just a type reference */
type = symtype;
- if ((0 || debug) && !VG_(st_isresolved)(type))
+ if ((0 || debug) && !ML_(st_isresolved)(type))
VG_(printf)("type %p (%d,%d) is unresolved\n", type, file, sym);
- if ((0 || debug) && VG_(st_isresolved)(type))
+ if ((0 || debug) && ML_(st_isresolved)(type))
VG_(printf)("reference (%d,%d) -> %p\n", file, sym, type);
}
break;
p--;
n = atoi(&p, 0);
switch(n) {
- case -1: type = VG_(st_mkint)(def, 4, True); break;
- case -2: type = VG_(st_mkint)(def, 1, True); break;
- case -3: type = VG_(st_mkint)(def, 2, True); break;
- case -4: type = VG_(st_mkint)(def, 4, True); break;
- case -5: type = VG_(st_mkint)(def, 1, False); break;
- case -6: type = VG_(st_mkint)(def, 1, True); break;
- case -7: type = VG_(st_mkint)(def, 2, False); break;
- case -8: type = VG_(st_mkint)(def, 4, False); break;
- case -9: type = VG_(st_mkint)(def, 4, False); break;
- case -10: type = VG_(st_mkint)(def, 4, False); break;
- case -11: type = VG_(st_mkvoid)(def); break;
- case -12: type = VG_(st_mkfloat)(def, 4); break;
- case -13: type = VG_(st_mkfloat)(def, 8); break;
- case -15: type = VG_(st_mkint)(def, 4, True); break;
- case -16: type = VG_(st_mkbool)(def, 4); break;
- case -17: type = VG_(st_mkfloat)(def, 4); break;
- case -18: type = VG_(st_mkfloat)(def, 8); break;
- case -20: type = VG_(st_mkint)(def, 1, False); break;
- case -21: type = VG_(st_mkint)(def, 1, False); break;
- case -22: type = VG_(st_mkint)(def, 2, False); break;
- case -23: type = VG_(st_mkint)(def, 4, False); break;
- case -24: type = VG_(st_mkint)(def, 4, False); break;
- case -27: type = VG_(st_mkint)(def, 1, True); break;
- case -28: type = VG_(st_mkint)(def, 2, True); break;
- case -29: type = VG_(st_mkint)(def, 4, True); break;
- case -31: type = VG_(st_mkint)(def, 8, True); break;
- case -32: type = VG_(st_mkint)(def, 8, False); break;
- case -33: type = VG_(st_mkint)(def, 8, False); break;
- case -34: type = VG_(st_mkint)(def, 8, True); break;
+ case -1: type = ML_(st_mkint)(def, 4, True); break;
+ case -2: type = ML_(st_mkint)(def, 1, True); break;
+ case -3: type = ML_(st_mkint)(def, 2, True); break;
+ case -4: type = ML_(st_mkint)(def, 4, True); break;
+ case -5: type = ML_(st_mkint)(def, 1, False); break;
+ case -6: type = ML_(st_mkint)(def, 1, True); break;
+ case -7: type = ML_(st_mkint)(def, 2, False); break;
+ case -8: type = ML_(st_mkint)(def, 4, False); break;
+ case -9: type = ML_(st_mkint)(def, 4, False); break;
+ case -10: type = ML_(st_mkint)(def, 4, False); break;
+ case -11: type = ML_(st_mkvoid)(def); break;
+ case -12: type = ML_(st_mkfloat)(def, 4); break;
+ case -13: type = ML_(st_mkfloat)(def, 8); break;
+ case -15: type = ML_(st_mkint)(def, 4, True); break;
+ case -16: type = ML_(st_mkbool)(def, 4); break;
+ case -17: type = ML_(st_mkfloat)(def, 4); break;
+ case -18: type = ML_(st_mkfloat)(def, 8); break;
+ case -20: type = ML_(st_mkint)(def, 1, False); break;
+ case -21: type = ML_(st_mkint)(def, 1, False); break;
+ case -22: type = ML_(st_mkint)(def, 2, False); break;
+ case -23: type = ML_(st_mkint)(def, 4, False); break;
+ case -24: type = ML_(st_mkint)(def, 4, False); break;
+ case -27: type = ML_(st_mkint)(def, 1, True); break;
+ case -28: type = ML_(st_mkint)(def, 2, True); break;
+ case -29: type = ML_(st_mkint)(def, 4, True); break;
+ case -31: type = ML_(st_mkint)(def, 8, True); break;
+ case -32: type = ML_(st_mkint)(def, 8, False); break;
+ case -33: type = ML_(st_mkint)(def, 8, False); break;
+ case -34: type = ML_(st_mkint)(def, 8, True); break;
default:
VG_(printf)(" @@ unrecognized negative type %d\n", n);
case 't': { /* typedef: 't' TYPE */
SymType *td = stabtype_parser(si, NULL, &p);
- type = VG_(st_mktypedef)(def, NULL, td);
+ type = ML_(st_mktypedef)(def, NULL, td);
break;
}
bytes = atoi(&p, 0);
EXPECT(';', "FP-TYPE bytes");
- type = VG_(st_mkfloat)(def, bytes);
+ type = ML_(st_mkfloat)(def, bytes);
break;
}
if (rtype == def) {
if (debug)
VG_(printf)("type %p is subrange of self - making int\n", def);
- type = VG_(st_mkint)(def, sizeof(int), False);
+ type = ML_(st_mkint)(def, sizeof(int), False);
} else if (min > max && max == 0) {
if (debug)
VG_(printf)("type %p has backwards range %d - %d: making float\n",
def, min, max);
- type = VG_(st_mkfloat)(def, min);
+ type = ML_(st_mkfloat)(def, min);
} else
- type = VG_(st_mkrange)(def, rtype, min, max);
+ type = ML_(st_mkrange)(def, rtype, min, max);
- vg_assert(VG_(st_isresolved)(type));
+ vg_assert(ML_(st_isresolved)(type));
break;
}
case '*': { /* pointer */
/* ('*' | '&') TYPE */
type = stabtype_parser(si, NULL, &p);
- type = VG_(st_mkpointer)(def, type);
+ type = ML_(st_mkpointer)(def, type);
break;
}
p = templ_name(name);
EXPECT(':', "struct/union/enum ref");
- name = VG_(addStr)(si, name, p-1-name);
+ name = ML_(addStr)(si, name, p-1-name);
switch (kind) {
case 's': /* struct */
break;
case 'e': /* enum */
- type = VG_(st_mkenum)(def, 0);
+ type = ML_(st_mkenum)(def, 0);
break;
default:
typeinfo = stabtype_parser(si, NULL, &p);
- type = VG_(st_mkarray)(def, typeinfo, VG_(st_mkint)(NULL, 1, True));
+ type = ML_(st_mkarray)(def, typeinfo, ML_(st_mkint)(NULL, 1, True));
break;
}
idxtype = stabtype_parser(si, NULL, &p);
artype = stabtype_parser(si, NULL, &p);
- type = VG_(st_mkarray)(def, idxtype, artype);
+ type = ML_(st_mkarray)(def, idxtype, artype);
break;
}
case 'e': { /* enum */
/* 'e' ( NAME ':' N ',' )* ';' */
- type = VG_(st_mkenum)(def, 0);
+ type = ML_(st_mkenum)(def, 0);
/* don't really care about tags; just skip them */
while(*p != ';') {
Bool method = False;
size = atou(&p, 0);
- type = (t == 's' ? VG_(st_mkstruct) : VG_(st_mkunion))(def, size, 0);
+ type = (t == 's' ? ML_(st_mkstruct) : ML_(st_mkunion))(def, size, 0);
if (*p == '!') {
/* base classes */
appear as "operator==::" */
end = SKIPPAST(end, '.', "op$ name");
}
- name = VG_(addStr)(si, p, end-p);
+ name = ML_(addStr)(si, p, end-p);
p = end+2;
} else {
- name = VG_(addStr)(si, p, end-p);
+ name = ML_(addStr)(si, p, end-p);
p = end+1;
}
}
if (fieldty != NULL)
- VG_(st_addfield)(type, name, fieldty, off, sz);
+ ML_(st_addfield)(type, name, fieldty, off, sz);
EXPECT(';', "struct field end");
}
case 'f': /* function */
/* 'f' TYPE */
- type = VG_(st_mkvoid)(def); /* approximate functions as void */
+ type = ML_(st_mkvoid)(def); /* approximate functions as void */
stabtype_parser(si, NULL, &p);
break;
CLASS-TYPE ',' RET-TYPE ',' ( ARG-TYPE ( ',' ARG-TYPE )* )? )
';'
*/
- type = VG_(st_mkvoid)(def); /* methods are really void */
+ type = ML_(st_mkvoid)(def); /* methods are really void */
if (*p == '#') {
p++; /* skip '#' */
case '@': /* pointer to member */
/* '@' CLASS-TYPE ',' MEMBER-TYPE */
- type = VG_(st_mkint)(def, sizeof(int), False); /* make it an int for our use */
+ type = ML_(st_mkint)(def, sizeof(int), False); /* make it an int for our use */
stabtype_parser(si, NULL, &p); /* CLASS-TYPE */
EXPECT(',', "member-pointer CLASS-TYPE");
if (*ty != ':') {
/* no type info */
- sym->type = VG_(st_mkvoid)(NULL);
+ sym->type = ML_(st_mkvoid)(NULL);
} else {
ty++; /* skip ':' */
out:
sym->type = stabtype_parser(si, NULL, &ty);
- base = VG_(st_basetype)(sym->type, False);
- if (isStruct && (VG_(st_isstruct)(base) || VG_(st_isunion)(base))) {
- Char *sname = VG_(addStr)(si, name, len);
- structDef(si->stab_typetab, base, VG_(st_isstruct)(base), sname);
+ base = ML_(st_basetype)(sym->type, False);
+ if (isStruct && (ML_(st_isstruct)(base) || ML_(st_isunion)(base))) {
+ Char *sname = ML_(addStr)(si, name, len);
+ structDef(si->stab_typetab, base, ML_(st_isstruct)(base), sname);
}
if (isTypedef) {
- Char *tname = VG_(addStr)(si, name, len);
+ Char *tname = ML_(addStr)(si, name, len);
vg_assert(sym->type != base);
if (debug)
VG_(printf)(" typedef %p \"%s\"\n", sym->type, tname);
- VG_(st_setname)(sym->type, tname);
- VG_(st_setname)(base, tname);
+ ML_(st_setname)(sym->type, tname);
+ ML_(st_setname)(base, tname);
}
}
*namep = ty;
if (isStruct || isTypedef) {
return True; /* skip */
} else {
- sym->name = VG_(addStr)(si, name, len);
+ sym->name = ML_(addStr)(si, name, len);
return False; /* don't skip */
}
}
/* Read stabs-format debug info. This is all rather horrible because
stabs is a underspecified, kludgy hack.
*/
-void VG_(read_debuginfo_stabs) ( SegInfo* si,
+void ML_(read_debuginfo_stabs) ( SegInfo* si,
UChar* stabC, Int stab_sz,
UChar* stabstr, Int stabstr_sz )
{
Finding the instruction address range covered by an N_SLINE is
complicated; see the N_SLINE case below.
*/
- file.name = VG_(addStr)(si,"???", -1);
+ file.name = ML_(addStr)(si,"???", -1);
n_stab_entries = stab_sz/(int)sizeof(struct nlist);
if (buf != NULL) {
i--; /* overstepped */
- string = VG_(addStr)(si, buf, idx);
+ string = ML_(addStr)(si, buf, idx);
VG_(arena_free)(VG_AR_SYMTAB, buf);
if (contdebug)
VG_(printf)("made composite: \"%s\"\n", string);
if (line.addr != 0) {
/* finish off previous line */
- VG_(addLineInfo)(si, file.name, NULL, line.addr,
+ ML_(addLineInfo)(si, file.name, NULL, line.addr,
addr, line.no + line.ovf * LINENO_OVERFLOW, i);
}
line.jump = True;
if (len > 0 && nm[len-1] != '/') {
- file.name = VG_(addStr)(si, nm, -1);
+ file.name = ML_(addStr)(si, nm, -1);
if (debug)
VG_(printf)("new source: %s\n", file.name);
if (st->n_type == N_SO) {
clearStabFiles(tab);
}
} else if (len == 0)
- file.name = VG_(addStr)(si, "?1\0", -1);
+ file.name = ML_(addStr)(si, "?1\0", -1);
if (func.start != 0)
line.jump = True;
if (line.addr != 0) {
/* there was a previous */
- VG_(addLineInfo)(si, file.name, NULL, line.addr,
+ ML_(addLineInfo)(si, file.name, NULL, line.addr,
addr, line.no + line.ovf * LINENO_OVERFLOW, i);
}
if (scope.addr != 0) {
/* finish any previous scope range */
- VG_(addScopeInfo)(si, scope.addr, addr, scope.scope);
+ ML_(addScopeInfo)(si, scope.addr, addr, scope.scope);
}
/* tidy up arg scope */
}
if (line.addr) {
- VG_(addLineInfo)(si, file.name, NULL, line.addr,
+ ML_(addLineInfo)(si, file.name, NULL, line.addr,
addr, line.no + line.ovf * LINENO_OVERFLOW, i);
line.addr = 0;
}
if (scope.addr) {
/* finish any previous scope range */
- VG_(addScopeInfo)(si, scope.addr, addr, scope.scope);
+ ML_(addScopeInfo)(si, scope.addr, addr, scope.scope);
}
if (newfunc) {
Scope *sc;
if (scope.addr) {
/* finish any previous scope range */
- VG_(addScopeInfo)(si, scope.addr, addr, scope.scope);
+ ML_(addScopeInfo)(si, scope.addr, addr, scope.scope);
}
sc = addSymsToScope(NULL, scope.symlist, scope.nsyms, scope.scope);
if (scope.addr) {
/* end previous range */
- VG_(addScopeInfo)(si, scope.addr, addr, scope.scope);
+ ML_(addScopeInfo)(si, scope.addr, addr, scope.scope);
}
scope.addr = addr;
}
vg_assert(scope.addr != 0);
- VG_(addScopeInfo)(si, scope.addr, addr, scope.scope);
+ ML_(addScopeInfo)(si, scope.addr, addr, scope.scope);
/* XXX LEAK: free scope if it or any of its inner scopes was
never added to a scope range */
pointers are stable.
*/
-Char *VG_(addStr) ( SegInfo* si, Char* str, Int len )
+Char* ML_(addStr) ( SegInfo* si, Char* str, Int len )
{
struct strchunk *chunk;
Int space_needed;
/* Top-level place to call to add a source-location mapping entry. */
-void VG_(addLineInfo) ( SegInfo* si,
+void ML_(addLineInfo) ( SegInfo* si,
Char* filename,
Char* dirname, /* NULL == directory is unknown */
Addr this,
/* Top-level place to call to add a source-location mapping entry. */
-void VG_(addScopeInfo) ( SegInfo* si,
+void ML_(addScopeInfo) ( SegInfo* si,
Addr this,
Addr next,
Scope *scope)
/* Top-level place to call to add a CFI summary record. The supplied
CfiSI is copied. */
-void VG_(addCfiSI) ( SegInfo* si, CfiSI* cfisi )
+void ML_(addCfiSI) ( SegInfo* si, CfiSI* cfisi )
{
static const Bool debug = False;
if (debug) {
VG_(printf)("adding CfiSI: ");
- VG_(ppCfiSI)(cfisi);
+ ML_(ppCfiSI)(cfisi);
}
vg_assert(cfisi->len > 0 && cfisi->len < 2000000);
);
}
if (VG_(clo_trace_cfi))
- VG_(ppCfiSI)(cfisi);
+ ML_(ppCfiSI)(cfisi);
}
return;
}
/*------------------------------------------------------------*/
/* Non-fatal -- use vg_panic if terminal. */
-void VG_(symerr) ( Char* msg )
+void ML_(symerr) ( Char* msg )
{
if (VG_(clo_verbosity) > 1)
VG_(message)(Vg_DebugMsg,"%s", msg );
Char buf[80];
vg_assert(VG_(strlen)(tab_name) < 40);
VG_(sprintf)(buf, " object doesn't have a %s", tab_name);
- VG_(symerr)(buf);
+ ML_(symerr)(buf);
return;
}
if ( is_interesting_symbol(si, sym, sym_name, sym_addr) ) {
vg_assert(sym->st_name != 0);
vg_assert(sym_name[0] != 0);
- name = VG_(addStr) ( si, sym_name, -1 );
+ name = ML_(addStr) ( si, sym_name, -1 );
vg_assert(name != NULL);
/*
i = VG_(stat)(si->filename, &stat_buf);
if (i != 0) {
- VG_(symerr)("Can't stat .so/.exe (to determine its size)?!");
+ ML_(symerr)("Can't stat .so/.exe (to determine its size)?!");
return False;
}
n_oimage = stat_buf.st_size;
fd = VG_(open)(si->filename, VKI_O_RDONLY, 0);
if (fd < 0) {
- VG_(symerr)("Can't open .so/.exe to read symbols?!");
+ ML_(symerr)("Can't open .so/.exe to read symbols?!");
return False;
}
ok &= VG_(is_object_file)(ehdr);
if (!ok) {
- VG_(symerr)("Invalid ELF header, or missing stringtab/sectiontab.");
+ ML_(symerr)("Invalid ELF header, or missing stringtab/sectiontab.");
goto out;
}
bss memory. Also computes correct symbol offset value for this
ELF file. */
if (ehdr->e_phoff + ehdr->e_phnum*sizeof(ElfXX_Phdr) > n_oimage) {
- VG_(symerr)("ELF program header is beyond image end?!");
+ ML_(symerr)("ELF program header is beyond image end?!");
goto out;
}
{
}
if (o_phdr->p_vaddr < prev_addr) {
- VG_(symerr)("ELF Phdrs are out of order!?");
+ ML_(symerr)("ELF Phdrs are out of order!?");
goto out;
}
prev_addr = o_phdr->p_vaddr;
ehdr->e_shoff, ehdr->e_shnum, sizeof(ElfXX_Shdr), n_oimage );
if (ehdr->e_shoff + ehdr->e_shnum*sizeof(ElfXX_Shdr) > n_oimage) {
- VG_(symerr)("ELF section header is beyond image end?!");
+ ML_(symerr)("ELF section header is beyond image end?!");
goto out;
}
TRACE_SYMTAB( "%18s: %p .. %p\n", \
sec_name, sec_data, sec_data + sec_size - 1); \
if ( shdr[i].sh_offset + sec_size > n_oimage ) { \
- VG_(symerr)(" section beyond image end?!"); \
+ ML_(symerr)(" section beyond image end?!"); \
goto out; \
} \
}
TRACE_SYMTAB( "%18s: %p .. %p\n", \
sec_name, sec_data, sec_data + sec_size - 1); \
if ( shdr[i].sh_offset + sec_size > n_dimage ) { \
- VG_(symerr)(" section beyond image end?!"); \
+ ML_(symerr)(" section beyond image end?!"); \
goto out; \
} \
}
/* Read .eh_frame (call-frame-info) if any */
if (ehframe) {
- VG_(read_callframe_info_dwarf2) ( si, ehframe, ehframe_sz, ehframe_addr );
+ ML_(read_callframe_info_dwarf2) ( si, ehframe, ehframe_sz, ehframe_addr );
}
/* Read the stabs and/or dwarf2 debug information, if any. It
# if !defined(VGP_amd64_linux)
if (stab != NULL && stabstr != NULL) {
has_debuginfo = True;
- VG_(read_debuginfo_stabs) ( si, stab, stab_sz,
+ ML_(read_debuginfo_stabs) ( si, stab, stab_sz,
stabstr, stabstr_sz );
}
# endif
if (debug_line) {
has_debuginfo = True;
- VG_(read_debuginfo_dwarf2) ( si,
+ ML_(read_debuginfo_dwarf2) ( si,
debug_info, debug_info_sz,
debug_abbv,
debug_line, debug_line_sz,
}
if (dwarf1d && dwarf1l) {
has_debuginfo = True;
- VG_(read_debuginfo_dwarf1) ( si, dwarf1d, dwarf1d_sz,
+ ML_(read_debuginfo_dwarf1) ( si, dwarf1d, dwarf1d_sz,
dwarf1l, dwarf1l_sz );
}
if (!has_debuginfo) {
- VG_(symerr)(" object doesn't have any line number info");
+ ML_(symerr)(" object doesn't have any line number info");
goto out;
}
}
/* Get a list of all variables in scope, working out from the directly
current one */
-Variable *VG_(get_scope_variables)(ThreadId tid)
+Variable* ML_(get_scope_variables)(ThreadId tid)
{
static const Bool debug = False;
Variable *list, *end;
v->next = NULL;
v->distance = distance;
- v->type = VG_(st_basetype)(sym->type, False);
+ v->type = ML_(st_basetype)(sym->type, False);
v->name = VG_(arena_strdup)(VG_AR_SYMTAB, sym->name);
v->container = NULL;
- v->size = VG_(st_sizeof)(sym->type);
+ v->size = ML_(st_sizeof)(sym->type);
if (debug && 0)
VG_(printf)("sym->name=%s sym->kind=%d offset=%d\n", sym->name, sym->kind, sym->u.offset);
if (0) {
VG_(printf)("found cfisi: ");
- VG_(ppCfiSI)(cfisi);
+ ML_(ppCfiSI)(cfisi);
}
ipPrev = spPrev = fpPrev = 0;
};
-Bool VG_(st_isstruct)(SymType *ty)
+Bool ML_(st_isstruct)(SymType *ty)
{
return ty->kind == TyStruct;
}
-Bool VG_(st_isunion)(SymType *ty)
+Bool ML_(st_isunion)(SymType *ty)
{
return ty->kind == TyUnion;
}
-Bool VG_(st_isenum)(SymType *ty)
+Bool ML_(st_isenum)(SymType *ty)
{
return ty->kind == TyEnum;
}
st->kind = TyError;
}
-SymType *VG_(st_mkunresolved)(SymType *st, SymResolver *resolver, void *data)
+SymType *ML_(st_mkunresolved)(SymType *st, SymResolver *resolver, void *data)
{
st = alloc(st);
return st;
}
-void VG_(st_unresolved_setdata)(SymType *st, SymResolver *resolver, void *data)
+void ML_(st_unresolved_setdata)(SymType *st, SymResolver *resolver, void *data)
{
if (st->kind != TyUnresolved)
return;
st->u.t_unresolved.data = data;
}
-Bool VG_(st_isresolved)(SymType *st)
+Bool ML_(st_isresolved)(SymType *st)
{
return st->kind != TyUnresolved;
}
-void VG_(st_setname)(SymType *st, Char *name)
+void ML_(st_setname)(SymType *st, Char *name)
{
if (st->name != NULL)
st->name = name;
}
-SymType *VG_(st_mkvoid)(SymType *st)
+SymType *ML_(st_mkvoid)(SymType *st)
{
st = alloc(st);
return st;
}
-SymType *VG_(st_mkint)(SymType *st, UInt size, Bool isSigned)
+SymType *ML_(st_mkint)(SymType *st, UInt size, Bool isSigned)
{
st = alloc(st);
return st;
}
-SymType *VG_(st_mkfloat)(SymType *st, UInt size)
+SymType *ML_(st_mkfloat)(SymType *st, UInt size)
{
st = alloc(st);
return st;
}
-SymType *VG_(st_mkbool)(SymType *st, UInt size)
+SymType *ML_(st_mkbool)(SymType *st, UInt size)
{
st = alloc(st);
}
-SymType *VG_(st_mkpointer)(SymType *st, SymType *ptr)
+SymType *ML_(st_mkpointer)(SymType *st, SymType *ptr)
{
st = alloc(st);
return st;
}
-SymType *VG_(st_mkrange)(SymType *st, SymType *ty, Int min, Int max)
+SymType *ML_(st_mkrange)(SymType *st, SymType *ty, Int min, Int max)
{
st = alloc(st);
return st;
}
-SymType *VG_(st_mkstruct)(SymType *st, UInt size, UInt nfields)
+SymType *ML_(st_mkstruct)(SymType *st, UInt size, UInt nfields)
{
st = alloc(st);
return st;
}
-SymType *VG_(st_mkunion)(SymType *st, UInt size, UInt nfields)
+SymType *ML_(st_mkunion)(SymType *st, UInt size, UInt nfields)
{
st = alloc(st);
return st;
}
-void VG_(st_addfield)(SymType *st, Char *name, SymType *type, UInt off, UInt size)
+void ML_(st_addfield)(SymType *st, Char *name, SymType *type, UInt off, UInt size)
{
StField *f;
}
-SymType *VG_(st_mkenum)(SymType *st, UInt ntags)
+SymType *ML_(st_mkenum)(SymType *st, UInt ntags)
{
st = alloc(st);
return st;
}
-SymType *VG_(st_mkarray)(SymType *st, SymType *idxtype, SymType *type)
+SymType *ML_(st_mkarray)(SymType *st, SymType *idxtype, SymType *type)
{
st = alloc(st);
return st;
}
-SymType *VG_(st_mktypedef)(SymType *st, Char *name, SymType *type)
+SymType *ML_(st_mktypedef)(SymType *st, Char *name, SymType *type)
{
st = alloc(st);
}
-SymType *VG_(st_basetype)(SymType *type, Bool do_resolve)
+SymType *ML_(st_basetype)(SymType *type, Bool do_resolve)
{
while (type->kind == TyTypedef || (do_resolve && type->kind == TyUnresolved)) {
if (do_resolve)
return type;
}
-UInt VG_(st_sizeof)(SymType *ty)
+UInt ML_(st_sizeof)(SymType *ty)
{
return ty->size;
}
keeplist = NULL;
eip = VG_(get_IP)(tid);
- list = VG_(get_scope_variables)(tid);
+ list = ML_(get_scope_variables)(tid);
if (memaccount) {
Variable *v;
v->name = VG_(arena_strdup)(VG_AR_SYMTAB, name);
else
v->name = NULL;
- v->type = VG_(st_basetype)(ty, False);
+ v->type = ML_(st_basetype)(ty, False);
v->valuep = valuep;
v->size = size == -1 ? ty->size : size;
v->container = var;
break;
}
- type = VG_(st_basetype)(type, True);
+ type = ML_(st_basetype)(type, True);
switch(type->kind) {
case TyUnion:
// Nb: this may be OS-specific, but let's not factor it out until we
// implement an OS port for which this isn't ok.
-void VG_(sema_init) ( vg_sema_t *sema );
-void VG_(sema_deinit) ( vg_sema_t *sema );
-void VG_(sema_down) ( vg_sema_t *sema );
-void VG_(sema_up) ( vg_sema_t *sema );
+void ML_(sema_init) ( vg_sema_t *sema );
+void ML_(sema_deinit) ( vg_sema_t *sema );
+void ML_(sema_down) ( vg_sema_t *sema );
+void ML_(sema_up) ( vg_sema_t *sema );
#endif // __PRIV_SEMA_H
tst->status = VgTs_Runnable;
- VG_(sema_down)(&run_sema);
+ ML_(sema_down)(&run_sema);
if (VG_(running_tid) != VG_INVALID_THREADID)
VG_(printf)("tid %d found %d running\n", tid, VG_(running_tid));
vg_assert(VG_(running_tid) == VG_INVALID_THREADID);
/* Release the run_sema; this will reschedule any runnable
thread. */
- VG_(sema_up)(&run_sema);
+ ML_(sema_up)(&run_sema);
if (VG_(clo_trace_sched)) {
Char buf[50];
/* There should still be a valid exitreason for this thread */
vg_assert(VG_(threads)[tid].exitreason != VgSrc_None);
- VG_(sema_up)(&run_sema);
+ ML_(sema_up)(&run_sema);
}
/* Kill a thread. This interrupts whatever a thread is doing, and
}
/* re-init and take the sema */
- VG_(sema_deinit)(&run_sema);
- VG_(sema_init)(&run_sema);
- VG_(sema_down)(&run_sema);
+ ML_(sema_deinit)(&run_sema);
+ ML_(sema_init)(&run_sema);
+ ML_(sema_down)(&run_sema);
}
Int i;
ThreadId tid_main;
- VG_(sema_init)(&run_sema);
+ ML_(sema_init)(&run_sema);
for (i = 0 /* NB; not 1 */; i < VG_N_THREADS; i++) {
pipe-based token passing scheme.
*/
-void VG_(sema_init)(vg_sema_t *sema)
+void ML_(sema_init)(vg_sema_t *sema)
{
VG_(pipe)(sema->pipe);
sema->pipe[0] = VG_(safe_fd)(sema->pipe[0]);
VG_(write)(sema->pipe[1], "T", 1);
}
-void VG_(sema_deinit)(vg_sema_t *sema)
+void ML_(sema_deinit)(vg_sema_t *sema)
{
VG_(close)(sema->pipe[0]);
VG_(close)(sema->pipe[1]);
}
/* get a token */
-void VG_(sema_down)(vg_sema_t *sema)
+void ML_(sema_down)(vg_sema_t *sema)
{
Char buf[2] = { 'x' };
Int ret;
}
/* put token back */
-void VG_(sema_up)(vg_sema_t *sema)
+void ML_(sema_up)(vg_sema_t *sema)
{
Int ret;
// Return true if address range entirely contained within client
// address space.
extern
-Bool VG_(valid_client_addr)(Addr start, SizeT size, ThreadId tid,
+Bool ML_(valid_client_addr)(Addr start, SizeT size, ThreadId tid,
const Char *syscallname);
// Returns True if the signal is OK for the client to use.
-extern Bool VG_(client_signal_OK)(Int sigNo);
+extern Bool ML_(client_signal_OK)(Int sigNo);
// Return true if we're allowed to use or create this fd.
extern
-Bool VG_(fd_allowed)(Int fd, const Char *syscallname, ThreadId tid, Bool soft);
+Bool ML_(fd_allowed)(Int fd, const Char *syscallname, ThreadId tid, Bool soft);
extern
-void VG_(record_fd_open)(ThreadId tid, Int fd, char *pathname);
+void ML_(record_fd_open)(ThreadId tid, Int fd, char *pathname);
// Used when killing threads -- we must not kill a thread if it's the thread
// that would do Valgrind's final cleanup and output.
extern
-Bool VG_(do_sigkill)(Int pid, Int tgid);
+Bool ML_(do_sigkill)(Int pid, Int tgid);
/* So that it can be seen from syswrap-x86-linux.c. */
extern
-void VG_(mmap_segment) ( Addr a, SizeT len, UInt prot,
+void ML_(mmap_segment) ( Addr a, SizeT len, UInt prot,
UInt mm_flags, Int fd, ULong offset );
#define UW UWord
#define SR SysRes
-extern void VG_(generic_PRE_sys_socketpair) ( TId, UW, UW, UW, UW );
-extern SysRes VG_(generic_POST_sys_socketpair) ( TId, SR, UW, UW, UW, UW );
-extern SysRes VG_(generic_POST_sys_socket) ( TId, SR );
-extern void VG_(generic_PRE_sys_bind) ( TId, UW, UW, UW );
-extern void VG_(generic_PRE_sys_accept) ( TId, UW, UW, UW );
-extern SysRes VG_(generic_POST_sys_accept) ( TId, SR, UW, UW, UW );
-extern void VG_(generic_PRE_sys_sendto) ( TId, UW, UW, UW, UW, UW, UW );
-extern void VG_(generic_PRE_sys_send) ( TId, UW, UW, UW );
-extern void VG_(generic_PRE_sys_recvfrom) ( TId, UW, UW, UW, UW, UW, UW );
-extern void VG_(generic_POST_sys_recvfrom) ( TId, SR, UW, UW, UW, UW, UW, UW );
-extern void VG_(generic_PRE_sys_recv) ( TId, UW, UW, UW );
-extern void VG_(generic_POST_sys_recv) ( TId, UW, UW, UW, UW );
-extern void VG_(generic_PRE_sys_connect) ( TId, UW, UW, UW );
-extern void VG_(generic_PRE_sys_setsockopt) ( TId, UW, UW, UW, UW, UW );
-extern void VG_(generic_PRE_sys_getsockopt) ( TId, UW, UW, UW, UW, UW );
-extern void VG_(generic_POST_sys_getsockopt) ( TId, SR, UW, UW, UW, UW, UW );
-extern void VG_(generic_PRE_sys_getsockname) ( TId, UW, UW, UW );
-extern void VG_(generic_POST_sys_getsockname) ( TId, SR, UW, UW, UW );
-extern void VG_(generic_PRE_sys_getpeername) ( TId, UW, UW, UW );
-extern void VG_(generic_POST_sys_getpeername) ( TId, SR, UW, UW, UW );
-extern void VG_(generic_PRE_sys_sendmsg) ( TId, UW, UW );
-extern void VG_(generic_PRE_sys_recvmsg) ( TId, UW, UW );
-extern void VG_(generic_POST_sys_recvmsg) ( TId, UW, UW );
-
-extern void VG_(generic_PRE_sys_semop) ( TId, UW, UW, UW );
-extern void VG_(generic_PRE_sys_semtimedop) ( TId, UW, UW, UW, UW );
-extern void VG_(generic_PRE_sys_semctl) ( TId, UW, UW, UW, UW );
-extern void VG_(generic_POST_sys_semctl) ( TId, UW, UW, UW, UW, UW );
-extern void VG_(generic_PRE_sys_msgsnd) ( TId, UW, UW, UW, UW );
-extern void VG_(generic_PRE_sys_msgrcv) ( TId, UW, UW, UW, UW, UW );
-extern void VG_(generic_POST_sys_msgrcv) ( TId, UW, UW, UW, UW, UW, UW );
-extern void VG_(generic_PRE_sys_msgctl) ( TId, UW, UW, UW );
-extern void VG_(generic_POST_sys_msgctl) ( TId, UW, UW, UW, UW );
-extern UWord VG_(generic_PRE_sys_shmat) ( TId, UW, UW, UW );
-extern void VG_(generic_POST_sys_shmat) ( TId, UW, UW, UW, UW );
-extern Bool VG_(generic_PRE_sys_shmdt) ( TId, UW );
-extern void VG_(generic_POST_sys_shmdt) ( TId, UW, UW );
-extern void VG_(generic_PRE_sys_shmctl) ( TId, UW, UW, UW );
-extern void VG_(generic_POST_sys_shmctl) ( TId, UW, UW, UW, UW );
+extern void ML_(generic_PRE_sys_socketpair) ( TId, UW, UW, UW, UW );
+extern SysRes ML_(generic_POST_sys_socketpair) ( TId, SR, UW, UW, UW, UW );
+extern SysRes ML_(generic_POST_sys_socket) ( TId, SR );
+extern void ML_(generic_PRE_sys_bind) ( TId, UW, UW, UW );
+extern void ML_(generic_PRE_sys_accept) ( TId, UW, UW, UW );
+extern SysRes ML_(generic_POST_sys_accept) ( TId, SR, UW, UW, UW );
+extern void ML_(generic_PRE_sys_sendto) ( TId, UW, UW, UW, UW, UW, UW );
+extern void ML_(generic_PRE_sys_send) ( TId, UW, UW, UW );
+extern void ML_(generic_PRE_sys_recvfrom) ( TId, UW, UW, UW, UW, UW, UW );
+extern void ML_(generic_POST_sys_recvfrom) ( TId, SR, UW, UW, UW, UW, UW, UW );
+extern void ML_(generic_PRE_sys_recv) ( TId, UW, UW, UW );
+extern void ML_(generic_POST_sys_recv) ( TId, UW, UW, UW, UW );
+extern void ML_(generic_PRE_sys_connect) ( TId, UW, UW, UW );
+extern void ML_(generic_PRE_sys_setsockopt) ( TId, UW, UW, UW, UW, UW );
+extern void ML_(generic_PRE_sys_getsockopt) ( TId, UW, UW, UW, UW, UW );
+extern void ML_(generic_POST_sys_getsockopt) ( TId, SR, UW, UW, UW, UW, UW );
+extern void ML_(generic_PRE_sys_getsockname) ( TId, UW, UW, UW );
+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, UW, UW );
+extern void ML_(generic_PRE_sys_recvmsg) ( TId, UW, UW );
+extern void ML_(generic_POST_sys_recvmsg) ( TId, UW, UW );
+
+extern void ML_(generic_PRE_sys_semop) ( TId, UW, UW, UW );
+extern void ML_(generic_PRE_sys_semtimedop) ( TId, UW, UW, UW, UW );
+extern void ML_(generic_PRE_sys_semctl) ( TId, UW, UW, UW, UW );
+extern void ML_(generic_POST_sys_semctl) ( TId, UW, UW, UW, UW, UW );
+extern void ML_(generic_PRE_sys_msgsnd) ( TId, UW, UW, UW, UW );
+extern void ML_(generic_PRE_sys_msgrcv) ( TId, UW, UW, UW, UW, UW );
+extern void ML_(generic_POST_sys_msgrcv) ( TId, UW, UW, UW, UW, UW, UW );
+extern void ML_(generic_PRE_sys_msgctl) ( TId, UW, UW, UW );
+extern void ML_(generic_POST_sys_msgctl) ( TId, UW, UW, UW, UW );
+extern UWord ML_(generic_PRE_sys_shmat) ( TId, UW, UW, UW );
+extern void ML_(generic_POST_sys_shmat) ( TId, UW, UW, UW, UW );
+extern Bool ML_(generic_PRE_sys_shmdt) ( TId, UW );
+extern void ML_(generic_POST_sys_shmdt) ( TId, UW, UW );
+extern void ML_(generic_PRE_sys_shmctl) ( TId, UW, UW, UW );
+extern void ML_(generic_POST_sys_shmctl) ( TId, UW, UW, UW, UW );
#undef TId
#undef UW
/* requires #include "priv_types_n_macros.h" */
// Run a thread from beginning to end.
-extern VgSchedReturnCode VG_(thread_wrapper)(Word /*ThreadId*/ tid);
+extern VgSchedReturnCode ML_(thread_wrapper)(Word /*ThreadId*/ tid);
DECL_TEMPLATE(linux, sys_exit_group);
/* Back up a thread so as to restart a system call. */
extern
-void VG_(fixup_guest_state_to_restart_syscall) ( ThreadArchState* arch );
+void ML_(fixup_guest_state_to_restart_syscall) ( ThreadArchState* arch );
#endif // __PRIV_SYSWRAP_MAIN_H
/* return true if address range entirely contained within client
address space */
-Bool VG_(valid_client_addr)(Addr start, SizeT size, ThreadId tid,
+Bool ML_(valid_client_addr)(Addr start, SizeT size, ThreadId tid,
const Char *syscallname)
{
Addr end = start+size;
return ret;
}
-Bool VG_(client_signal_OK)(Int sigNo)
+Bool ML_(client_signal_OK)(Int sigNo)
{
/* signal 0 is OK for kill */
Bool ret = sigNo >= 0 && sigNo <= VG_SIGVGRTUSERMAX;
*a = ra;
}
-void VG_(mmap_segment) ( Addr a, SizeT len, UInt prot,
+void ML_(mmap_segment) ( Addr a, SizeT len, UInt prot,
UInt mm_flags, Int fd, ULong offset )
{
Bool rr, ww, xx;
if (VG_PGROUNDDN(old_addr) != old_addr)
return VG_(mk_SysRes_Error)( VKI_EINVAL );
- if (!VG_(valid_client_addr)(old_addr, old_size, tid, "mremap(old_addr)"))
+ if (!ML_(valid_client_addr)(old_addr, old_size, tid, "mremap(old_addr)"))
return VG_(mk_SysRes_Error)( VKI_EFAULT );
/* fixed at the current address means we don't move it */
if (VG_PGROUNDDN(new_addr) != new_addr)
return VG_(mk_SysRes_Error)( VKI_EINVAL );
- if (!VG_(valid_client_addr)(new_addr, new_size, tid, "mremap(new_addr)"))
+ if (!ML_(valid_client_addr)(new_addr, new_size, tid, "mremap(new_addr)"))
return VG_(mk_SysRes_Error)( VKI_ENOMEM );
/* check for overlaps */
some such thing) or that we don't know the filename. If the fd is
already open, then we're probably doing a dup2() to an existing fd,
so just overwrite the existing one. */
-void VG_(record_fd_open)(ThreadId tid, Int fd, char *pathname)
+void ML_(record_fd_open)(ThreadId tid, Int fd, char *pathname)
{
OpenFd *i;
for (i = 0; i < count; i++)
if(VG_(fcntl)(i, VKI_F_GETFL, 0) != -1)
- VG_(record_fd_open)(-1, i, NULL);
+ ML_(record_fd_open)(-1, i, NULL);
}
/* Initialize the list of open file descriptors with the file descriptors
if(fno != f)
if(VG_(clo_track_fds))
- VG_(record_fd_open)(-1, fno, VG_(resolve_filename)(fno));
+ ML_(record_fd_open)(-1, fno, VG_(resolve_filename)(fno));
}
VG_(lseek)(f, d.d_off, VKI_SEEK_SET);
if(VG_(clo_track_fds))
// XXX: must we check the range on these fds with
// VG_(fd_allowed)()?
- VG_(record_fd_open) (tid, fds[i], VG_(resolve_filename)(fds[i]));
+ ML_(record_fd_open) (tid, fds[i], VG_(resolve_filename)(fds[i]));
}
cm = VKI_CMSG_NXTHDR(msg, cm);
------------------------------------------------------------------ */
/* Return true if we're allowed to use or create this fd */
-Bool VG_(fd_allowed)(Int fd, const Char *syscallname, ThreadId tid, Bool soft)
+Bool ML_(fd_allowed)(Int fd, const Char *syscallname, ThreadId tid, Bool soft)
{
if (fd < 0 || fd >= VG_(fd_hard_limit) || fd == VG_(clo_log_fd)) {
VG_(message)(Vg_UserMsg,
/* ------ */
void
-VG_(generic_PRE_sys_socketpair) ( ThreadId tid,
+ML_(generic_PRE_sys_socketpair) ( ThreadId tid,
UWord arg0, UWord arg1,
UWord arg2, UWord arg3 )
{
}
SysRes
-VG_(generic_POST_sys_socketpair) ( ThreadId tid,
+ML_(generic_POST_sys_socketpair) ( ThreadId tid,
SysRes res,
UWord arg0, UWord arg1,
UWord arg2, UWord arg3 )
Int fd1 = ((Int*)arg3)[0];
Int fd2 = ((Int*)arg3)[1];
POST_MEM_WRITE( arg3, 2*sizeof(int) );
- if (!VG_(fd_allowed)(fd1, "socketcall.socketpair", tid, True) ||
- !VG_(fd_allowed)(fd2, "socketcall.socketpair", tid, True)) {
+ if (!ML_(fd_allowed)(fd1, "socketcall.socketpair", tid, True) ||
+ !ML_(fd_allowed)(fd2, "socketcall.socketpair", tid, True)) {
VG_(close)(fd1);
VG_(close)(fd2);
r = VG_(mk_SysRes_Error)( VKI_EMFILE );
} else {
POST_MEM_WRITE( arg3, 2*sizeof(int) );
if (VG_(clo_track_fds)) {
- VG_(record_fd_open)(tid, fd1, NULL);
- VG_(record_fd_open)(tid, fd2, NULL);
+ ML_(record_fd_open)(tid, fd1, NULL);
+ ML_(record_fd_open)(tid, fd2, NULL);
}
}
return r;
/* ------ */
SysRes
-VG_(generic_POST_sys_socket) ( ThreadId tid, SysRes res )
+ML_(generic_POST_sys_socket) ( ThreadId tid, SysRes res )
{
SysRes r = res;
vg_assert(!res.isError); /* guaranteed by caller */
- if (!VG_(fd_allowed)(res.val, "socket", tid, True)) {
+ if (!ML_(fd_allowed)(res.val, "socket", tid, True)) {
VG_(close)(res.val);
r = VG_(mk_SysRes_Error)( VKI_EMFILE );
} else {
if (VG_(clo_track_fds))
- VG_(record_fd_open)(tid, res.val, NULL);
+ ML_(record_fd_open)(tid, res.val, NULL);
}
return r;
}
/* ------ */
void
-VG_(generic_PRE_sys_bind) ( ThreadId tid,
+ML_(generic_PRE_sys_bind) ( ThreadId tid,
UWord arg0, UWord arg1, UWord arg2 )
{
/* int bind(int sockfd, struct sockaddr *my_addr,
/* ------ */
void
-VG_(generic_PRE_sys_accept) ( ThreadId tid,
+ML_(generic_PRE_sys_accept) ( ThreadId tid,
UWord arg0, UWord arg1, UWord arg2 )
{
/* int accept(int s, struct sockaddr *addr, int *addrlen); */
}
SysRes
-VG_(generic_POST_sys_accept) ( ThreadId tid,
+ML_(generic_POST_sys_accept) ( ThreadId tid,
SysRes res,
UWord arg0, UWord arg1, UWord arg2 )
{
SysRes r = res;
vg_assert(!res.isError); /* guaranteed by caller */
- if (!VG_(fd_allowed)(res.val, "accept", tid, True)) {
+ if (!ML_(fd_allowed)(res.val, "accept", tid, True)) {
VG_(close)(res.val);
r = VG_(mk_SysRes_Error)( VKI_EMFILE );
} else {
buf_and_len_post_check ( tid, res, addr_p, addrlen_p,
"socketcall.accept(addrlen_out)" );
if (VG_(clo_track_fds))
- VG_(record_fd_open)(tid, res.val, NULL);
+ ML_(record_fd_open)(tid, res.val, NULL);
}
return r;
}
/* ------ */
void
-VG_(generic_PRE_sys_sendto) ( ThreadId tid,
+ML_(generic_PRE_sys_sendto) ( ThreadId tid,
UWord arg0, UWord arg1, UWord arg2,
UWord arg3, UWord arg4, UWord arg5 )
{
/* ------ */
void
-VG_(generic_PRE_sys_send) ( ThreadId tid,
+ML_(generic_PRE_sys_send) ( ThreadId tid,
UWord arg0, UWord arg1, UWord arg2 )
{
/* int send(int s, const void *msg, size_t len, int flags); */
/* ------ */
void
-VG_(generic_PRE_sys_recvfrom) ( ThreadId tid,
+ML_(generic_PRE_sys_recvfrom) ( ThreadId tid,
UWord arg0, UWord arg1, UWord arg2,
UWord arg3, UWord arg4, UWord arg5 )
{
}
void
-VG_(generic_POST_sys_recvfrom) ( ThreadId tid,
+ML_(generic_POST_sys_recvfrom) ( ThreadId tid,
SysRes res,
UWord arg0, UWord arg1, UWord arg2,
UWord arg3, UWord arg4, UWord arg5 )
/* ------ */
void
-VG_(generic_PRE_sys_recv) ( ThreadId tid,
+ML_(generic_PRE_sys_recv) ( ThreadId tid,
UWord arg0, UWord arg1, UWord arg2 )
{
/* int recv(int s, void *buf, int len, unsigned int flags); */
}
void
-VG_(generic_POST_sys_recv) ( ThreadId tid,
+ML_(generic_POST_sys_recv) ( ThreadId tid,
UWord res,
UWord arg0, UWord arg1, UWord arg2 )
{
/* ------ */
void
-VG_(generic_PRE_sys_connect) ( ThreadId tid,
+ML_(generic_PRE_sys_connect) ( ThreadId tid,
UWord arg0, UWord arg1, UWord arg2 )
{
/* int connect(int sockfd,
/* ------ */
void
-VG_(generic_PRE_sys_setsockopt) ( ThreadId tid,
+ML_(generic_PRE_sys_setsockopt) ( ThreadId tid,
UWord arg0, UWord arg1, UWord arg2,
UWord arg3, UWord arg4 )
{
/* ------ */
void
-VG_(generic_PRE_sys_getsockopt) ( ThreadId tid,
+ML_(generic_PRE_sys_getsockopt) ( ThreadId tid,
UWord arg0, UWord arg1, UWord arg2,
UWord arg3, UWord arg4 )
{
}
void
-VG_(generic_POST_sys_getsockopt) ( ThreadId tid,
+ML_(generic_POST_sys_getsockopt) ( ThreadId tid,
SysRes res,
UWord arg0, UWord arg1, UWord arg2,
UWord arg3, UWord arg4 )
/* ------ */
void
-VG_(generic_PRE_sys_getsockname) ( ThreadId tid,
+ML_(generic_PRE_sys_getsockname) ( ThreadId tid,
UWord arg0, UWord arg1, UWord arg2 )
{
/* int getsockname(int s, struct sockaddr* name, int* namelen) */
}
void
-VG_(generic_POST_sys_getsockname) ( ThreadId tid,
+ML_(generic_POST_sys_getsockname) ( ThreadId tid,
SysRes res,
UWord arg0, UWord arg1, UWord arg2 )
{
/* ------ */
void
-VG_(generic_PRE_sys_getpeername) ( ThreadId tid,
+ML_(generic_PRE_sys_getpeername) ( ThreadId tid,
UWord arg0, UWord arg1, UWord arg2 )
{
/* int getpeername(int s, struct sockaddr* name, int* namelen) */
}
void
-VG_(generic_POST_sys_getpeername) ( ThreadId tid,
+ML_(generic_POST_sys_getpeername) ( ThreadId tid,
SysRes res,
UWord arg0, UWord arg1, UWord arg2 )
{
/* ------ */
void
-VG_(generic_PRE_sys_sendmsg) ( ThreadId tid,
+ML_(generic_PRE_sys_sendmsg) ( ThreadId tid,
UWord arg0, UWord arg1 )
{
/* int sendmsg(int s, const struct msghdr *msg, int flags); */
/* ------ */
void
-VG_(generic_PRE_sys_recvmsg) ( ThreadId tid,
+ML_(generic_PRE_sys_recvmsg) ( ThreadId tid,
UWord arg0, UWord arg1 )
{
/* int recvmsg(int s, struct msghdr *msg, int flags); */
}
void
-VG_(generic_POST_sys_recvmsg) ( ThreadId tid,
+ML_(generic_POST_sys_recvmsg) ( ThreadId tid,
UWord arg0, UWord arg1 )
{
struct vki_msghdr *msg = (struct vki_msghdr *)arg1;
/* ------ */
void
-VG_(generic_PRE_sys_semop) ( ThreadId tid,
+ML_(generic_PRE_sys_semop) ( ThreadId tid,
UWord arg0, UWord arg1, UWord arg2 )
{
/* int semop(int semid, struct sembuf *sops, unsigned nsops); */
/* ------ */
void
-VG_(generic_PRE_sys_semtimedop) ( ThreadId tid,
+ML_(generic_PRE_sys_semtimedop) ( ThreadId tid,
UWord arg0, UWord arg1,
UWord arg2, UWord arg3 )
{
}
void
-VG_(generic_PRE_sys_semctl) ( ThreadId tid,
+ML_(generic_PRE_sys_semctl) ( ThreadId tid,
UWord arg0, UWord arg1,
UWord arg2, UWord arg3 )
{
}
void
-VG_(generic_POST_sys_semctl) ( ThreadId tid,
+ML_(generic_POST_sys_semctl) ( ThreadId tid,
UWord res,
UWord arg0, UWord arg1,
UWord arg2, UWord arg3 )
/* ------ */
void
-VG_(generic_PRE_sys_msgsnd) ( ThreadId tid,
+ML_(generic_PRE_sys_msgsnd) ( ThreadId tid,
UWord arg0, UWord arg1,
UWord arg2, UWord arg3 )
{
/* ------ */
void
-VG_(generic_PRE_sys_msgrcv) ( ThreadId tid,
+ML_(generic_PRE_sys_msgrcv) ( ThreadId tid,
UWord arg0, UWord arg1, UWord arg2,
UWord arg3, UWord arg4 )
{
}
void
-VG_(generic_POST_sys_msgrcv) ( ThreadId tid,
+ML_(generic_POST_sys_msgrcv) ( ThreadId tid,
UWord res,
UWord arg0, UWord arg1, UWord arg2,
UWord arg3, UWord arg4 )
/* ------ */
void
-VG_(generic_PRE_sys_msgctl) ( ThreadId tid,
+ML_(generic_PRE_sys_msgctl) ( ThreadId tid,
UWord arg0, UWord arg1, UWord arg2 )
{
/* int msgctl(int msqid, int cmd, struct msqid_ds *buf); */
}
void
-VG_(generic_POST_sys_msgctl) ( ThreadId tid,
+ML_(generic_POST_sys_msgctl) ( ThreadId tid,
UWord res,
UWord arg0, UWord arg1, UWord arg2 )
{
}
UWord
-VG_(generic_PRE_sys_shmat) ( ThreadId tid,
+ML_(generic_PRE_sys_shmat) ( ThreadId tid,
UWord arg0, UWord arg1, UWord arg2 )
{
/* void *shmat(int shmid, const void *shmaddr, int shmflg); */
UInt segmentSize = get_shm_size ( arg0 );
if (arg1 == 0)
arg1 = VG_(find_map_space)(0, segmentSize, True);
- else if (!VG_(valid_client_addr)(arg1, segmentSize, tid, "shmat"))
+ else if (!ML_(valid_client_addr)(arg1, segmentSize, tid, "shmat"))
arg1 = 0;
return arg1;
}
void
-VG_(generic_POST_sys_shmat) ( ThreadId tid,
+ML_(generic_POST_sys_shmat) ( ThreadId tid,
UWord res,
UWord arg0, UWord arg1, UWord arg2 )
{
/* ------ */
Bool
-VG_(generic_PRE_sys_shmdt) ( ThreadId tid, UWord arg0 )
+ML_(generic_PRE_sys_shmdt) ( ThreadId tid, UWord arg0 )
{
/* int shmdt(const void *shmaddr); */
- return VG_(valid_client_addr)(arg0, 1, tid, "shmdt");
+ return ML_(valid_client_addr)(arg0, 1, tid, "shmdt");
}
void
-VG_(generic_POST_sys_shmdt) ( ThreadId tid, UWord res, UWord arg0 )
+ML_(generic_POST_sys_shmdt) ( ThreadId tid, UWord res, UWord arg0 )
{
Segment *s = VG_(find_segment)(arg0);
/* ------ */
void
-VG_(generic_PRE_sys_shmctl) ( ThreadId tid,
+ML_(generic_PRE_sys_shmctl) ( ThreadId tid,
UWord arg0, UWord arg1, UWord arg2 )
{
/* int shmctl(int shmid, int cmd, struct shmid_ds *buf); */
}
void
-VG_(generic_POST_sys_shmctl) ( ThreadId tid,
+ML_(generic_POST_sys_shmctl) ( ThreadId tid,
UWord res,
UWord arg0, UWord arg1, UWord arg2 )
{
PRE_REG_READ1(long, "close", unsigned int, fd);
/* Detect and negate attempts by the client to close Valgrind's log fd */
- if (!VG_(fd_allowed)(ARG1, "close", tid, False))
+ if (!ML_(fd_allowed)(ARG1, "close", tid, False))
SET_STATUS_Failure( VKI_EBADF );
}
POST(sys_dup)
{
vg_assert(SUCCESS);
- if (!VG_(fd_allowed)(RES, "dup", tid, True)) {
+ if (!ML_(fd_allowed)(RES, "dup", tid, True)) {
VG_(close)(RES);
SET_STATUS_Failure( VKI_EMFILE );
} else {
if (VG_(clo_track_fds))
- VG_(record_fd_open)(tid, RES, VG_(resolve_filename)(RES));
+ ML_(record_fd_open)(tid, RES, VG_(resolve_filename)(RES));
}
}
{
PRINT("sys_dup2 ( %d, %d )", ARG1,ARG2);
PRE_REG_READ2(long, "dup2", unsigned int, oldfd, unsigned int, newfd);
- if (!VG_(fd_allowed)(ARG2, "dup2", tid, True))
+ if (!ML_(fd_allowed)(ARG2, "dup2", tid, True))
SET_STATUS_Failure( VKI_EBADF );
}
{
vg_assert(SUCCESS);
if (VG_(clo_track_fds))
- VG_(record_fd_open)(tid, RES, VG_(resolve_filename)(RES));
+ ML_(record_fd_open)(tid, RES, VG_(resolve_filename)(RES));
}
PRE(sys_fchdir)
{
vg_assert(SUCCESS);
if (ARG2 == VKI_F_DUPFD) {
- if (!VG_(fd_allowed)(RES, "fcntl(DUPFD)", tid, True)) {
+ if (!ML_(fd_allowed)(RES, "fcntl(DUPFD)", tid, True)) {
VG_(close)(RES);
SET_STATUS_Failure( VKI_EMFILE );
} else {
if (VG_(clo_track_fds))
- VG_(record_fd_open)(tid, RES, VG_(resolve_filename)(RES));
+ ML_(record_fd_open)(tid, RES, VG_(resolve_filename)(RES));
}
}
}
{
vg_assert(SUCCESS);
if (ARG2 == VKI_F_DUPFD) {
- if (!VG_(fd_allowed)(RES, "fcntl64(DUPFD)", tid, True)) {
+ if (!ML_(fd_allowed)(RES, "fcntl64(DUPFD)", tid, True)) {
VG_(close)(RES);
SET_STATUS_Failure( VKI_EMFILE );
} else {
if (VG_(clo_track_fds))
- VG_(record_fd_open)(tid, RES,
+ ML_(record_fd_open)(tid, RES,
VG_(resolve_filename)(RES));
}
}
"tgid" is a thread group id. If it is not -1, then the target
thread must be in that thread group.
*/
-Bool VG_(do_sigkill)(Int pid, Int tgid)
+Bool ML_(do_sigkill)(Int pid, Int tgid)
{
ThreadState *tst;
ThreadId tid;
/* int kill(pid_t pid, int sig); */
PRINT("sys_kill ( %d, %d )", ARG1,ARG2);
PRE_REG_READ2(long, "kill", int, pid, int, sig);
- if (!VG_(client_signal_OK)(ARG2)) {
+ if (!ML_(client_signal_OK)(ARG2)) {
SET_STATUS_Failure( VKI_EINVAL );
return;
}
/* If we're sending SIGKILL, check to see if the target is one of
our threads and handle it specially. */
- if (ARG2 == VKI_SIGKILL && VG_(do_sigkill)(ARG1, -1))
+ if (ARG2 == VKI_SIGKILL && ML_(do_sigkill)(ARG1, -1))
SET_STATUS_Success(0);
else
SET_STATUS_from_SysRes( VG_(do_syscall2)(SYSNO, ARG1, ARG2) );
}
if (ARG4 & VKI_MAP_FIXED) {
- if (!VG_(valid_client_addr)(ARG1, ARG2, tid, "mmap2"))
+ if (!ML_(valid_client_addr)(ARG1, ARG2, tid, "mmap2"))
SET_STATUS_Failure( VKI_ENOMEM );
} else {
Addr a = VG_(find_map_space)(ARG1, ARG2, True);
POST(sys_mmap2)
{
vg_assert(SUCCESS);
- vg_assert(VG_(valid_client_addr)(RES, ARG2, tid, "mmap2"));
- VG_(mmap_segment)( (Addr)RES, ARG2, ARG3, ARG4, ARG5,
+ vg_assert(ML_(valid_client_addr)(RES, ARG2, tid, "mmap2"));
+ ML_(mmap_segment)( (Addr)RES, ARG2, ARG3, ARG4, ARG5,
ARG6 * (ULong)VKI_PAGE_SIZE );
}
PRE_REG_READ3(long, "mprotect",
unsigned long, addr, vki_size_t, len, unsigned long, prot);
- if (!VG_(valid_client_addr)(ARG1, ARG2, tid, "mprotect"))
+ if (!ML_(valid_client_addr)(ARG1, ARG2, tid, "mprotect"))
SET_STATUS_Failure( VKI_ENOMEM );
}
PRINT("sys_munmap ( %p, %llu )", ARG1,(ULong)ARG2);
PRE_REG_READ2(long, "munmap", unsigned long, start, vki_size_t, length);
- if (!VG_(valid_client_addr)(ARG1, ARG2, tid, "munmap"))
+ if (!ML_(valid_client_addr)(ARG1, ARG2, tid, "munmap"))
SET_STATUS_Failure( VKI_EINVAL );
}
POST(sys_open)
{
vg_assert(SUCCESS);
- if (!VG_(fd_allowed)(RES, "open", tid, True)) {
+ if (!ML_(fd_allowed)(RES, "open", tid, True)) {
VG_(close)(RES);
SET_STATUS_Failure( VKI_EMFILE );
} else {
if (VG_(clo_track_fds))
- VG_(record_fd_open)(tid, RES,
+ ML_(record_fd_open)(tid, RES,
VG_(arena_strdup)(VG_AR_CORE, (Char*)ARG1));
}
}
PRE_REG_READ3(ssize_t, "read",
unsigned int, fd, char *, buf, vki_size_t, count);
- if (!VG_(fd_allowed)(ARG1, "read", tid, False))
+ if (!ML_(fd_allowed)(ARG1, "read", tid, False))
SET_STATUS_Failure( VKI_EBADF );
else
PRE_MEM_WRITE( "read(buf)", ARG2, ARG3 );
PRINT("sys_write ( %d, %p, %llu )", ARG1, ARG2, (ULong)ARG3);
PRE_REG_READ3(ssize_t, "write",
unsigned int, fd, const char *, buf, vki_size_t, count);
- if (!VG_(fd_allowed)(ARG1, "write", tid, False))
+ if (!ML_(fd_allowed)(ARG1, "write", tid, False))
SET_STATUS_Failure( VKI_EBADF );
else
PRE_MEM_READ( "write(buf)", ARG2, ARG3 );
POST(sys_creat)
{
vg_assert(SUCCESS);
- if (!VG_(fd_allowed)(RES, "creat", tid, True)) {
+ if (!ML_(fd_allowed)(RES, "creat", tid, True)) {
VG_(close)(RES);
SET_STATUS_Failure( VKI_EMFILE );
} else {
if (VG_(clo_track_fds))
- VG_(record_fd_open)(tid, RES, VG_(arena_strdup)(VG_AR_CORE, (Char*)ARG1));
+ ML_(record_fd_open)(tid, RES, VG_(arena_strdup)(VG_AR_CORE, (Char*)ARG1));
}
}
{
Int *p = (Int *)ARG1;
- if (!VG_(fd_allowed)(p[0], "pipe", tid, True) ||
- !VG_(fd_allowed)(p[1], "pipe", tid, True)) {
+ if (!ML_(fd_allowed)(p[0], "pipe", tid, True) ||
+ !ML_(fd_allowed)(p[1], "pipe", tid, True)) {
VG_(close)(p[0]);
VG_(close)(p[1]);
SET_STATUS_Failure( VKI_EMFILE );
} else {
POST_MEM_WRITE( ARG1, 2*sizeof(int) );
if (VG_(clo_track_fds)) {
- VG_(record_fd_open)(tid, p[0], NULL);
- VG_(record_fd_open)(tid, p[1], NULL);
+ ML_(record_fd_open)(tid, p[0], NULL);
+ ML_(record_fd_open)(tid, p[1], NULL);
}
}
}
PRE_REG_READ3(ssize_t, "readv",
unsigned long, fd, const struct iovec *, vector,
unsigned long, count);
- if (!VG_(fd_allowed)(ARG1, "readv", tid, False)) {
+ if (!ML_(fd_allowed)(ARG1, "readv", tid, False)) {
SET_STATUS_Failure( VKI_EBADF );
} else {
PRE_MEM_READ( "readv(vector)", ARG2, ARG3 * sizeof(struct vki_iovec) );
PRE_REG_READ3(ssize_t, "writev",
unsigned long, fd, const struct iovec *, vector,
unsigned long, count);
- if (!VG_(fd_allowed)(ARG1, "writev", tid, False)) {
+ if (!ML_(fd_allowed)(ARG1, "writev", tid, False)) {
SET_STATUS_Failure( VKI_EBADF );
} else {
PRE_MEM_READ( "writev(vector)",
}
POST(sys_rt_sigqueueinfo)
{
- if (!VG_(client_signal_OK)(ARG2))
+ if (!ML_(client_signal_OK)(ARG2))
SET_STATUS_Failure( VKI_EINVAL );
}
POST(sys_mq_open)
{
vg_assert(SUCCESS);
- if (!VG_(fd_allowed)(RES, "mq_open", tid, True)) {
+ if (!ML_(fd_allowed)(RES, "mq_open", tid, True)) {
VG_(close)(RES);
SET_STATUS_Failure( VKI_EMFILE );
} else {
if (VG_(clo_track_fds))
- VG_(record_fd_open)(tid, RES, VG_(arena_strdup)(VG_AR_CORE, (Char*)ARG1));
+ ML_(record_fd_open)(tid, RES, VG_(arena_strdup)(VG_AR_CORE, (Char*)ARG1));
}
}
PRE_REG_READ5(long, "mq_timedsend",
vki_mqd_t, mqdes, const char *, msg_ptr, vki_size_t, msg_len,
unsigned int, msg_prio, const struct timespec *, abs_timeout);
- if (!VG_(fd_allowed)(ARG1, "mq_timedsend", tid, False)) {
+ if (!ML_(fd_allowed)(ARG1, "mq_timedsend", tid, False)) {
SET_STATUS_Failure( VKI_EBADF );
} else {
PRE_MEM_READ( "mq_timedsend(msg_ptr)", ARG2, ARG3 );
vki_mqd_t, mqdes, char *, msg_ptr, vki_size_t, msg_len,
unsigned int *, msg_prio,
const struct timespec *, abs_timeout);
- if (!VG_(fd_allowed)(ARG1, "mq_timedreceive", tid, False)) {
+ if (!ML_(fd_allowed)(ARG1, "mq_timedreceive", tid, False)) {
SET_STATUS_Failure( VKI_EBADF );
} else {
PRE_MEM_WRITE( "mq_timedreceive(msg_ptr)", ARG2, ARG3 );
PRINT("sys_mq_notify( %d, %p )", ARG1,ARG2 );
PRE_REG_READ2(long, "mq_notify",
vki_mqd_t, mqdes, const struct sigevent *, notification);
- if (!VG_(fd_allowed)(ARG1, "mq_notify", tid, False))
+ if (!ML_(fd_allowed)(ARG1, "mq_notify", tid, False))
SET_STATUS_Failure( VKI_EBADF );
else if (ARG2 != 0)
PRE_MEM_READ( "mq_notify(notification)",
PRE_REG_READ3(long, "mq_getsetattr",
vki_mqd_t, mqdes, const struct mq_attr *, mqstat,
struct mq_attr *, omqstat);
- if (!VG_(fd_allowed)(ARG1, "mq_getsetattr", tid, False)) {
+ if (!ML_(fd_allowed)(ARG1, "mq_getsetattr", tid, False)) {
SET_STATUS_Failure( VKI_EBADF );
} else {
if (ARG2 != 0) {
// Run a thread from beginning to end and return the thread's
// scheduler-return-code.
-VgSchedReturnCode VG_(thread_wrapper)(Word /*ThreadId*/ tidW)
+VgSchedReturnCode ML_(thread_wrapper)(Word /*ThreadId*/ tidW)
{
VG_(debugLog)(1, "core_os",
"VG_(thread_wrapper)(tid=%lld): entry\n",
vg_assert(SUCCESS);
POST_MEM_WRITE( ARG1, sizeof(int) );
if (ARG2 == VKI_FUTEX_FD) {
- if (!VG_(fd_allowed)(RES, "futex", tid, True)) {
+ if (!ML_(fd_allowed)(RES, "futex", tid, True)) {
VG_(close)(RES);
SET_STATUS_Failure( VKI_EMFILE );
} else {
if (VG_(clo_track_fds))
- VG_(record_fd_open)(tid, RES, VG_(arena_strdup)(VG_AR_CORE, (Char*)ARG1));
+ ML_(record_fd_open)(tid, RES, VG_(arena_strdup)(VG_AR_CORE, (Char*)ARG1));
}
}
}
POST(sys_epoll_create)
{
vg_assert(SUCCESS);
- if (!VG_(fd_allowed)(RES, "epoll_create", tid, True)) {
+ if (!ML_(fd_allowed)(RES, "epoll_create", tid, True)) {
VG_(close)(RES);
SET_STATUS_Failure( VKI_EMFILE );
} else {
if (VG_(clo_track_fds))
- VG_(record_fd_open) (tid, RES, NULL);
+ ML_(record_fd_open) (tid, RES, NULL);
}
}
/* int tgkill(pid_t tgid, pid_t tid, int sig); */
PRINT("sys_tgkill ( %d, %d, %d )", ARG1,ARG2,ARG3);
PRE_REG_READ3(long, "tgkill", int, tgid, int, tid, int, sig);
- if (!VG_(client_signal_OK)(ARG3)) {
+ if (!ML_(client_signal_OK)(ARG3)) {
SET_STATUS_Failure( VKI_EINVAL );
return;
}
/* If we're sending SIGKILL, check to see if the target is one of
our threads and handle it specially. */
- if (ARG3 == VKI_SIGKILL && VG_(do_sigkill)(ARG2, ARG1))
+ if (ARG3 == VKI_SIGKILL && ML_(do_sigkill)(ARG2, ARG1))
SET_STATUS_Success(0);
else
SET_STATUS_from_SysRes(VG_(do_syscall3)(SYSNO, ARG1, ARG2, ARG3));
struct vki_aio_ring *r = *(struct vki_aio_ring **)ARG2;
vg_assert(addr == (Addr)r);
- vg_assert(VG_(valid_client_addr)(addr, size, tid, "io_setup"));
+ vg_assert(ML_(valid_client_addr)(addr, size, tid, "io_setup"));
VG_TRACK( new_mem_mmap, addr, size, True, True, False );
POST_MEM_WRITE( ARG2, sizeof(vki_aio_context_t) );
/* Back up guest state to restart a system call. */
-void VG_(fixup_guest_state_to_restart_syscall) ( ThreadArchState* arch )
+void ML_(fixup_guest_state_to_restart_syscall) ( ThreadArchState* arch )
{
#if defined(VGP_x86_linux)
arch->vex.guest_EIP -= 2; // sizeof(int $0x80)
if (debug)
VG_(printf)(" not started: restart\n");
vg_assert(sci->status.what == SsHandToKernel);
- VG_(fixup_guest_state_to_restart_syscall)(th_regs);
+ ML_(fixup_guest_state_to_restart_syscall)(th_regs);
}
else
and the kernel restarted it. Restart if asked, otherwise
EINTR it. */
if (restart)
- VG_(fixup_guest_state_to_restart_syscall)(th_regs);
+ ML_(fixup_guest_state_to_restart_syscall)(th_regs);
else {
canonical = convert_SysRes_to_SyscallStatus(
VG_(mk_SysRes_Error)( VKI_EINTR )
(ULong)tidW);
/* Run the thread all the way through. */
- VgSchedReturnCode src = VG_(thread_wrapper)(tid);
+ VgSchedReturnCode src = ML_(thread_wrapper)(tid);
VG_(debugLog)(1, "syswrap-x86-linux",
"run_a_thread_NORETURN(tid=%lld): "
cloneflags = ARG1;
- if (!VG_(client_signal_OK)(ARG1 & VKI_CSIGNAL)) {
+ if (!ML_(client_signal_OK)(ARG1 & VKI_CSIGNAL)) {
SET_STATUS_Failure( VKI_EINVAL );
return;
}
/* This is only so that the EIP is (might be) useful to report if
something goes wrong in the sigreturn */
- VG_(fixup_guest_state_to_restart_syscall)(&tst->arch);
+ ML_(fixup_guest_state_to_restart_syscall)(&tst->arch);
VG_(sigframe_destroy)(tid, False);
/* This is only so that the EIP is (might be) useful to report if
something goes wrong in the sigreturn */
- VG_(fixup_guest_state_to_restart_syscall)(&tst->arch);
+ ML_(fixup_guest_state_to_restart_syscall)(&tst->arch);
VG_(sigframe_destroy)(tid, True);
switch (ARG1 /* call */) {
case VKI_SEMOP:
- VG_(generic_PRE_sys_semop)( tid, ARG2, ARG5, ARG3 );
+ ML_(generic_PRE_sys_semop)( tid, ARG2, ARG5, ARG3 );
*flags |= SfMayBlock;
break;
case VKI_SEMGET:
case VKI_SEMCTL:
{
UWord arg = deref_Addr( tid, ARG5, "semctl(arg)" );
- VG_(generic_PRE_sys_semctl)( tid, ARG2, ARG3, ARG4, arg );
+ ML_(generic_PRE_sys_semctl)( tid, ARG2, ARG3, ARG4, arg );
break;
}
case VKI_SEMTIMEDOP:
- VG_(generic_PRE_sys_semtimedop)( tid, ARG2, ARG5, ARG3, ARG6 );
+ ML_(generic_PRE_sys_semtimedop)( tid, ARG2, ARG5, ARG3, ARG6 );
*flags |= SfMayBlock;
break;
case VKI_MSGSND:
- VG_(generic_PRE_sys_msgsnd)( tid, ARG2, ARG5, ARG3, ARG4 );
+ ML_(generic_PRE_sys_msgsnd)( tid, ARG2, ARG5, ARG3, ARG4 );
if ((ARG4 & VKI_IPC_NOWAIT) == 0)
*flags |= SfMayBlock;
break;
(Addr) (&((struct vki_ipc_kludge *)ARG5)->msgtyp),
"msgrcv(msgp)" );
- VG_(generic_PRE_sys_msgrcv)( tid, ARG2, msgp, ARG3, msgtyp, ARG4 );
+ ML_(generic_PRE_sys_msgrcv)( tid, ARG2, msgp, ARG3, msgtyp, ARG4 );
if ((ARG4 & VKI_IPC_NOWAIT) == 0)
*flags |= SfMayBlock;
case VKI_MSGGET:
break;
case VKI_MSGCTL:
- VG_(generic_PRE_sys_msgctl)( tid, ARG2, ARG3, ARG5 );
+ ML_(generic_PRE_sys_msgctl)( tid, ARG2, ARG3, ARG5 );
break;
case VKI_SHMAT:
{
UWord w;
PRE_MEM_WRITE( "shmat(raddr)", ARG4, sizeof(Addr) );
- w = VG_(generic_PRE_sys_shmat)( tid, ARG2, ARG5, ARG3 );
+ w = ML_(generic_PRE_sys_shmat)( tid, ARG2, ARG5, ARG3 );
if (w == 0)
SET_STATUS_Failure( VKI_EINVAL );
else
break;
}
case VKI_SHMDT:
- if (!VG_(generic_PRE_sys_shmdt)(tid, ARG5))
+ if (!ML_(generic_PRE_sys_shmdt)(tid, ARG5))
SET_STATUS_Failure( VKI_EINVAL );
break;
case VKI_SHMGET:
break;
case VKI_SHMCTL: /* IPCOP_shmctl */
- VG_(generic_PRE_sys_shmctl)( tid, ARG2, ARG3, ARG5 );
+ ML_(generic_PRE_sys_shmctl)( tid, ARG2, ARG3, ARG5 );
break;
default:
VG_(message)(Vg_DebugMsg, "FATAL: unhandled syscall(ipc) %d", ARG1 );
case VKI_SEMCTL:
{
UWord arg = deref_Addr( tid, ARG5, "semctl(arg)" );
- VG_(generic_PRE_sys_semctl)( tid, ARG2, ARG3, ARG4, arg );
+ ML_(generic_PRE_sys_semctl)( tid, ARG2, ARG3, ARG4, arg );
break;
}
case VKI_SEMTIMEDOP:
(Addr) (&((struct vki_ipc_kludge *)ARG5)->msgtyp),
"msgrcv(msgp)" );
- VG_(generic_POST_sys_msgrcv)( tid, RES, ARG2, msgp, ARG3, msgtyp, ARG4 );
+ ML_(generic_POST_sys_msgrcv)( tid, RES, ARG2, msgp, ARG3, msgtyp, ARG4 );
break;
}
case VKI_MSGGET:
break;
case VKI_MSGCTL:
- VG_(generic_POST_sys_msgctl)( tid, RES, ARG2, ARG3, ARG5 );
+ ML_(generic_POST_sys_msgctl)( tid, RES, ARG2, ARG3, ARG5 );
break;
case VKI_SHMAT:
{
addr = deref_Addr ( tid, ARG4, "shmat(addr)" );
if ( addr > 0 ) {
- VG_(generic_POST_sys_shmat)( tid, addr, ARG2, ARG5, ARG3 );
+ ML_(generic_POST_sys_shmat)( tid, addr, ARG2, ARG5, ARG3 );
}
break;
}
case VKI_SHMDT:
- VG_(generic_POST_sys_shmdt)( tid, RES, ARG5 );
+ ML_(generic_POST_sys_shmdt)( tid, RES, ARG5 );
break;
case VKI_SHMGET:
break;
case VKI_SHMCTL:
- VG_(generic_POST_sys_shmctl)( tid, RES, ARG2, ARG3, ARG5 );
+ ML_(generic_POST_sys_shmctl)( tid, RES, ARG2, ARG3, ARG5 );
break;
default:
VG_(message)(Vg_DebugMsg,
}
if (a4 & VKI_MAP_FIXED) {
- if (!VG_(valid_client_addr)(a1, a2, tid, "old_mmap")) {
+ if (!ML_(valid_client_addr)(a1, a2, tid, "old_mmap")) {
PRINT("old_mmap failing: %p-%p\n", a1, a1+a2);
SET_STATUS_Failure( VKI_ENOMEM );
}
SysRes res = VG_(mmap_native)((void*)a1, a2, a3, a4, a5, a6);
SET_STATUS_from_SysRes(res);
if (!res.isError) {
- vg_assert(VG_(valid_client_addr)(res.val, a2, tid, "old_mmap"));
- VG_(mmap_segment)( (Addr)res.val, a2, a3, a4, a5, a6 );
+ vg_assert(ML_(valid_client_addr)(res.val, a2, tid, "old_mmap"));
+ ML_(mmap_segment)( (Addr)res.val, a2, a3, a4, a5, a6 );
}
}
case VKI_SYS_SOCKETPAIR:
/* int socketpair(int d, int type, int protocol, int sv[2]); */
PRE_MEM_READ( "socketcall.socketpair(args)", ARG2, 4*sizeof(Addr) );
- VG_(generic_PRE_sys_socketpair)( tid, ARG2_0, ARG2_1, ARG2_2, ARG2_3 );
+ ML_(generic_PRE_sys_socketpair)( tid, ARG2_0, ARG2_1, ARG2_2, ARG2_3 );
break;
case VKI_SYS_SOCKET:
/* int bind(int sockfd, struct sockaddr *my_addr,
int addrlen); */
PRE_MEM_READ( "socketcall.bind(args)", ARG2, 3*sizeof(Addr) );
- VG_(generic_PRE_sys_bind)( tid, ARG2_0, ARG2_1, ARG2_2 );
+ ML_(generic_PRE_sys_bind)( tid, ARG2_0, ARG2_1, ARG2_2 );
break;
case VKI_SYS_LISTEN:
case VKI_SYS_ACCEPT: {
/* int accept(int s, struct sockaddr *addr, int *addrlen); */
PRE_MEM_READ( "socketcall.accept(args)", ARG2, 3*sizeof(Addr) );
- VG_(generic_PRE_sys_accept)( tid, ARG2_0, ARG2_1, ARG2_2 );
+ ML_(generic_PRE_sys_accept)( tid, ARG2_0, ARG2_1, ARG2_2 );
break;
}
unsigned int flags,
const struct sockaddr *to, int tolen); */
PRE_MEM_READ( "socketcall.sendto(args)", ARG2, 6*sizeof(Addr) );
- VG_(generic_PRE_sys_sendto)( tid, ARG2_0, ARG2_1, ARG2_2,
+ ML_(generic_PRE_sys_sendto)( tid, ARG2_0, ARG2_1, ARG2_2,
ARG2_3, ARG2_4, ARG2_5 );
break;
case VKI_SYS_SEND:
/* int send(int s, const void *msg, size_t len, int flags); */
PRE_MEM_READ( "socketcall.send(args)", ARG2, 4*sizeof(Addr) );
- VG_(generic_PRE_sys_send)( tid, ARG2_0, ARG2_1, ARG2_2 );
+ ML_(generic_PRE_sys_send)( tid, ARG2_0, ARG2_1, ARG2_2 );
break;
case VKI_SYS_RECVFROM:
/* int recvfrom(int s, void *buf, int len, unsigned int flags,
struct sockaddr *from, int *fromlen); */
PRE_MEM_READ( "socketcall.recvfrom(args)", ARG2, 6*sizeof(Addr) );
- VG_(generic_PRE_sys_recvfrom)( tid, ARG2_0, ARG2_1, ARG2_2,
+ ML_(generic_PRE_sys_recvfrom)( tid, ARG2_0, ARG2_1, ARG2_2,
ARG2_3, ARG2_4, ARG2_5 );
break;
from parameter.
*/
PRE_MEM_READ( "socketcall.recv(args)", ARG2, 4*sizeof(Addr) );
- VG_(generic_PRE_sys_recv)( tid, ARG2_0, ARG2_1, ARG2_2 );
+ ML_(generic_PRE_sys_recv)( tid, ARG2_0, ARG2_1, ARG2_2 );
break;
case VKI_SYS_CONNECT:
/* int connect(int sockfd,
struct sockaddr *serv_addr, int addrlen ); */
PRE_MEM_READ( "socketcall.connect(args)", ARG2, 3*sizeof(Addr) );
- VG_(generic_PRE_sys_connect)( tid, ARG2_0, ARG2_1, ARG2_2 );
+ ML_(generic_PRE_sys_connect)( tid, ARG2_0, ARG2_1, ARG2_2 );
break;
case VKI_SYS_SETSOCKOPT:
/* int setsockopt(int s, int level, int optname,
const void *optval, int optlen); */
PRE_MEM_READ( "socketcall.setsockopt(args)", ARG2, 5*sizeof(Addr) );
- VG_(generic_PRE_sys_setsockopt)( tid, ARG2_0, ARG2_1, ARG2_2,
+ ML_(generic_PRE_sys_setsockopt)( tid, ARG2_0, ARG2_1, ARG2_2,
ARG2_3, ARG2_4 );
break;
/* int getsockopt(int s, int level, int optname,
void *optval, socklen_t *optlen); */
PRE_MEM_READ( "socketcall.getsockopt(args)", ARG2, 5*sizeof(Addr) );
- VG_(generic_PRE_sys_getsockopt)( tid, ARG2_0, ARG2_1, ARG2_2,
+ ML_(generic_PRE_sys_getsockopt)( tid, ARG2_0, ARG2_1, ARG2_2,
ARG2_3, ARG2_4 );
break;
case VKI_SYS_GETSOCKNAME:
/* int getsockname(int s, struct sockaddr* name, int* namelen) */
PRE_MEM_READ( "socketcall.getsockname(args)", ARG2, 3*sizeof(Addr) );
- VG_(generic_PRE_sys_getsockname)( tid, ARG2_0, ARG2_1, ARG2_2 );
+ ML_(generic_PRE_sys_getsockname)( tid, ARG2_0, ARG2_1, ARG2_2 );
break;
case VKI_SYS_GETPEERNAME:
/* int getpeername(int s, struct sockaddr* name, int* namelen) */
PRE_MEM_READ( "socketcall.getpeername(args)", ARG2, 3*sizeof(Addr) );
- VG_(generic_PRE_sys_getpeername)( tid, ARG2_0, ARG2_1, ARG2_2 );
+ ML_(generic_PRE_sys_getpeername)( tid, ARG2_0, ARG2_1, ARG2_2 );
break;
case VKI_SYS_SHUTDOWN:
* (after all it's glibc providing the arguments array)
PRE_MEM_READ( "socketcall.sendmsg(args)", ARG2, 3*sizeof(Addr) );
*/
- VG_(generic_PRE_sys_sendmsg)( tid, ARG2_0, ARG2_1 );
+ ML_(generic_PRE_sys_sendmsg)( tid, ARG2_0, ARG2_1 );
break;
}
* (after all it's glibc providing the arguments array)
PRE_MEM_READ("socketcall.recvmsg(args)", ARG2, 3*sizeof(Addr) );
*/
- VG_(generic_PRE_sys_recvmsg)( tid, ARG2_0, ARG2_1 );
+ ML_(generic_PRE_sys_recvmsg)( tid, ARG2_0, ARG2_1 );
break;
}
switch (ARG1 /* request */) {
case VKI_SYS_SOCKETPAIR:
- r = VG_(generic_POST_sys_socketpair)(
+ r = ML_(generic_POST_sys_socketpair)(
tid, VG_(mk_SysRes_Success)(RES),
ARG2_0, ARG2_1, ARG2_2, ARG2_3
);
break;
case VKI_SYS_SOCKET:
- r = VG_(generic_POST_sys_socket)( tid, VG_(mk_SysRes_Success)(RES) );
+ r = ML_(generic_POST_sys_socket)( tid, VG_(mk_SysRes_Success)(RES) );
SET_STATUS_from_SysRes(r);
break;
case VKI_SYS_ACCEPT:
/* int accept(int s, struct sockaddr *addr, int *addrlen); */
- r = VG_(generic_POST_sys_accept)( tid, VG_(mk_SysRes_Success)(RES),
+ r = ML_(generic_POST_sys_accept)( tid, VG_(mk_SysRes_Success)(RES),
ARG2_0, ARG2_1, ARG2_2 );
SET_STATUS_from_SysRes(r);
break;
break;
case VKI_SYS_RECVFROM:
- VG_(generic_POST_sys_recvfrom)( tid, VG_(mk_SysRes_Success)(RES),
+ ML_(generic_POST_sys_recvfrom)( tid, VG_(mk_SysRes_Success)(RES),
ARG2_0, ARG2_1, ARG2_2,
ARG2_3, ARG2_4, ARG2_5 );
break;
case VKI_SYS_RECV:
- VG_(generic_POST_sys_recv)( tid, RES, ARG2_0, ARG2_1, ARG2_2 );
+ ML_(generic_POST_sys_recv)( tid, RES, ARG2_0, ARG2_1, ARG2_2 );
break;
case VKI_SYS_CONNECT:
break;
case VKI_SYS_GETSOCKOPT:
- VG_(generic_POST_sys_getsockopt)( tid, VG_(mk_SysRes_Success)(RES),
+ ML_(generic_POST_sys_getsockopt)( tid, VG_(mk_SysRes_Success)(RES),
ARG2_0, ARG2_1,
ARG2_2, ARG2_3, ARG2_4 );
break;
case VKI_SYS_GETSOCKNAME:
- VG_(generic_POST_sys_getsockname)( tid, VG_(mk_SysRes_Success)(RES),
+ ML_(generic_POST_sys_getsockname)( tid, VG_(mk_SysRes_Success)(RES),
ARG2_0, ARG2_1, ARG2_2 );
break;
case VKI_SYS_GETPEERNAME:
- VG_(generic_POST_sys_getpeername)( tid, VG_(mk_SysRes_Success)(RES),
+ ML_(generic_POST_sys_getpeername)( tid, VG_(mk_SysRes_Success)(RES),
ARG2_0, ARG2_1, ARG2_2 );
break;
break;
case VKI_SYS_RECVMSG:
- VG_(generic_POST_sys_recvmsg)( tid, ARG2_0, ARG2_1 );
+ ML_(generic_POST_sys_recvmsg)( tid, ARG2_0, ARG2_1 );
break;
default:
#define VGAPPEND(str1,str2) str1##str2
-#define VG_(str) VGAPPEND(vgPlain_, str)
+/* VG_ is for symbols exported from modules. ML_ (module-local) is
+ for symbols which are not intended to be visible outside modules,
+ but which cannot be declared as C 'static's since they need to be
+ visible across C files within a given module. It is a mistake for
+ a ML_ name to appear in a pub_core_*.h or pub_tool_*.h file.
+ Likewise it is a mistake for a VG_ name to appear in a priv_*.h
+ file.
+*/
+#define VG_(str) VGAPPEND(vgPlain_, str)
+#define ML_(str) VGAPPEND(vgModuleLocal_, str)
+
#define VGA_(str) VGAPPEND(vgArch_, str)
#define VGO_(str) VGAPPEND(vgOS_, str)
#define VGP_(str) VGAPPEND(vgPlatform_, str)