|
From: Dirk M. <mu...@kd...> - 2004-01-06 16:03:10
|
CVS commit by mueller:
remove anonymous unions - not supported by older versions of gcc.
M +8 -8 stage1.c 1.5 [POSSIBLY UNSAFE: printf]
M +12 -12 stage2.c 1.6
M +0 -2 ume.c 1.7
M +1 -1 ume.h 1.3
M +5 -5 vg_stabs.c 1.5
M +6 -6 vg_symtab2.c 1.73
M +1 -1 vg_symtab2.h 1.6
M +44 -44 vg_symtypes.c 1.4
--- valgrind/coregrind/stage1.c #1.4:1.5
@@ -91,5 +91,5 @@ static void *fix_auxv(void *v_init_esp,
place when we start it */
auxv[0].a_type = AT_UME_PADFD;
- auxv[0].a_val = as_getpadfd();
+ auxv[0].u.a_val = as_getpadfd();
/* This will be needed by valgrind itself so that it can
@@ -97,10 +97,10 @@ static void *fix_auxv(void *v_init_esp,
because /proc/self/exe will go away once we unmap stage1. */
auxv[1].a_type = AT_UME_EXECFD;
- auxv[1].a_val = open("/proc/self/exe", O_RDONLY);
+ auxv[1].u.a_val = open("/proc/self/exe", O_RDONLY);
/* make sure the rest are sane */
for(i = new_entries; i < delta/sizeof(*auxv); i++) {
auxv[i].a_type = AT_IGNORE;
- auxv[i].a_val = 0;
+ auxv[i].u.a_val = 0;
}
@@ -110,25 +110,25 @@ static void *fix_auxv(void *v_init_esp,
for(; auxv->a_type != AT_NULL; auxv++) {
if (0)
- printf("doing auxv %p %4x: %d %p\n", auxv, auxv->a_type, auxv->a_val, auxv->a_ptr);
+ printf("doing auxv %p %4x: %d %p\n", auxv, auxv->a_type, auxv->u.a_val, auxv->u.a_ptr);
switch(auxv->a_type) {
case AT_PHDR:
seen |= 1;
- auxv->a_val = info->phdr;
+ auxv->u.a_val = info->phdr;
break;
case AT_PHNUM:
seen |= 2;
- auxv->a_val = info->phnum;
+ auxv->u.a_val = info->phnum;
break;
case AT_BASE:
seen |= 4;
- auxv->a_val = info->interp_base;
+ auxv->u.a_val = info->interp_base;
break;
case AT_ENTRY:
seen |= 8;
- auxv->a_val = info->entry;
+ auxv->u.a_val = info->entry;
break;
}
--- valgrind/coregrind/stage2.c #1.5:1.6
@@ -91,10 +91,10 @@ static int scan_auxv(void)
switch(auxv->a_type) {
case AT_UME_PADFD:
- as_setpadfd(auxv->a_val);
+ as_setpadfd(auxv->u.a_val);
found |= 1;
break;
case AT_UME_EXECFD:
- kp.vgexecfd = auxv->a_val;
+ kp.vgexecfd = auxv->u.a_val;
found |= 2;
break;
@@ -237,5 +237,5 @@ static Addr setup_client_stack(char **or
for(cauxv = orig_auxv; cauxv->a_type != AT_NULL; cauxv++) {
if (cauxv->a_type == AT_PLATFORM)
- stringsize += strlen(cauxv->a_ptr) + 1;
+ stringsize += strlen(cauxv->u.a_ptr) + 1;
auxsize += sizeof(*cauxv);
}
@@ -278,5 +278,5 @@ static Addr setup_client_stack(char **or
client_end - PGROUNDDN(cl_esp),
PROT_READ | PROT_WRITE | PROT_EXEC,
- MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED, -1, 0);
+ MAP_PRIVATE | MAP_ANON | MAP_FIXED, -1, 0);
@@ -322,5 +322,5 @@ static Addr setup_client_stack(char **or
auxv->a_type = AT_IGNORE;
else
- auxv->a_val = info->phdr;
+ auxv->u.a_val = info->phdr;
break;
@@ -329,5 +329,5 @@ static Addr setup_client_stack(char **or
auxv->a_type = AT_IGNORE;
else
- auxv->a_val = info->phnum;
+ auxv->u.a_val = info->phnum;
break;
@@ -336,13 +336,13 @@ static Addr setup_client_stack(char **or
auxv->a_type = AT_IGNORE;
else
- auxv->a_val = info->interp_base;
+ auxv->u.a_val = info->interp_base;
break;
case AT_PLATFORM: /* points to a platform description string */
- auxv->a_ptr = copy_str(&strtab, orig_auxv->a_ptr);
+ auxv->u.a_ptr = copy_str(&strtab, orig_auxv->u.a_ptr);
break;
case AT_ENTRY:
- auxv->a_val = info->entry;
+ auxv->u.a_val = info->entry;
break;
@@ -374,5 +374,5 @@ static Addr setup_client_stack(char **or
need LD_PRELOAD/LD_LIBRARY_PATH to work for the client, we
set AT_SECURE to 0. */
- auxv->a_val = 0;
+ auxv->u.a_val = 0;
break;
@@ -925,5 +925,5 @@ int main(int argc, char **argv)
/* make the redzone inaccessible */
mmap((void *)client_end, REDZONE_SIZE, PROT_NONE,
- MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE, -1, 0);
+ MAP_FIXED|MAP_ANON|MAP_PRIVATE, -1, 0);
munmap(CLIENT_BASE, client_size); /* make client hole */
@@ -952,5 +952,5 @@ int main(int argc, char **argv)
if (shadow_size != 0)
mmap((char *)shadow_base, shadow_size, PROT_NONE,
- MAP_PRIVATE|MAP_ANONYMOUS|MAP_FIXED, -1, 0);
+ MAP_PRIVATE|MAP_ANON|MAP_FIXED, -1, 0);
/* unpad us */
--- valgrind/coregrind/ume.c #1.6:1.7
@@ -86,7 +86,5 @@
#include <stdlib.h>
#include <unistd.h>
-#include <asm/unistd.h>
#include <sys/stat.h>
-#include <sys/sysmacros.h>
#include <dlfcn.h>
#include <assert.h>
--- valgrind/coregrind/ume.h #1.2:1.3
@@ -92,5 +92,5 @@ struct ume_auxv
int a_val;
void (*a_fcn)(void);
- };
+ } u;
};
--- valgrind/coregrind/vg_stabs.c #1.4:1.5
@@ -1013,10 +1013,10 @@ static Bool initSym(SegInfo *si, Sym *sy
case N_LCSYM:
sym->kind = SyStatic;
- sym->addr = si->offset + (Addr)val;
+ sym->u.addr = si->offset + (Addr)val;
break;
case N_PSYM:
sym->kind = SyEBPrel; /* +ve offset off EBP (erk, or ESP if no frame pointer) */
- sym->offset = val;
+ sym->u.offset = val;
break;
@@ -1026,15 +1026,15 @@ static Bool initSym(SegInfo *si, Sym *sy
else
sym->kind = SyESPrel; /* +ve off ESP when there's no frame pointer */
- sym->offset = val;
+ sym->u.offset = val;
break;
case N_RSYM:
sym->kind = SyReg;
- sym->regno = val;
+ sym->u.regno = val;
break;
case N_GSYM:
sym->kind = SyGlobal;
- sym->addr = 0; /* XXX should really look up global address */
+ sym->u.addr = 0; /* XXX should really look up global address */
break;
--- valgrind/coregrind/vg_symtab2.c #1.72:1.73
@@ -1778,5 +1778,5 @@ Variable *VG_(get_scope_variables)(Threa
if (debug && 0)
- VG_(printf)("sym->name=%s sym->kind=%d offset=%d\n", sym->name, sym->kind, sym->offset);
+ VG_(printf)("sym->name=%s sym->kind=%d offset=%d\n", sym->name, sym->kind, sym->u.offset);
switch(sym->kind) {
UInt reg;
@@ -1784,12 +1784,12 @@ Variable *VG_(get_scope_variables)(Threa
case SyGlobal:
case SyStatic:
- if (sym->addr == 0) {
+ if (sym->u.addr == 0) {
/* XXX lookup value */
}
- v->valuep = sym->addr;
+ v->valuep = sym->u.addr;
break;
case SyReg:
- v->valuep = (Addr)regaddr(tid, sym->regno);
+ v->valuep = (Addr)regaddr(tid, sym->u.regno);
break;
@@ -1798,6 +1798,6 @@ Variable *VG_(get_scope_variables)(Threa
reg = *regaddr(tid, sym->kind == SyESPrel ? R_ESP : R_EBP);
if (debug)
- VG_(printf)("reg=%p+%d=%p\n", reg, sym->offset, reg+sym->offset);
- v->valuep = (Addr)(reg + sym->offset);
+ VG_(printf)("reg=%p+%d=%p\n", reg, sym->u.offset, reg+sym->u.offset);
+ v->valuep = (Addr)(reg + sym->u.offset);
break;
--- valgrind/coregrind/vg_symtab2.h #1.5:1.6
@@ -98,5 +98,5 @@ struct _Sym {
Int regno; /* register number */
Addr addr; /* static or global address */
- };
+ } u;
};
--- valgrind/coregrind/vg_symtypes.c #1.3:1.4
@@ -152,5 +152,5 @@ struct _SymType {
void *data; /* data for resolver */
} t_unresolved;
- };
+ } u;
};
@@ -187,5 +187,5 @@ static void resolve(SymType *st)
return;
- (*st->t_unresolved.resolver)(st, st->t_unresolved.data);
+ (*st->u.t_unresolved.resolver)(st, st->u.t_unresolved.data);
if (st->kind == TyUnresolved)
@@ -201,6 +201,6 @@ SymType *VG_(st_mkunresolved)(SymType *s
st->kind = TyUnresolved;
st->size = 0;
- st->t_unresolved.resolver = resolver;
- st->t_unresolved.data = data;
+ st->u.t_unresolved.resolver = resolver;
+ st->u.t_unresolved.data = data;
return st;
@@ -212,6 +212,6 @@ void VG_(st_unresolved_setdata)(SymType
return;
- st->t_unresolved.resolver = resolver;
- st->t_unresolved.data = data;
+ st->u.t_unresolved.resolver = resolver;
+ st->u.t_unresolved.data = data;
}
@@ -247,5 +247,5 @@ SymType *VG_(st_mkint)(SymType *st, UInt
st->kind = TyInt;
st->size = size;
- st->t_scalar.issigned = isSigned;
+ st->u.t_scalar.issigned = isSigned;
return st;
@@ -260,5 +260,5 @@ SymType *VG_(st_mkfloat)(SymType *st, UI
st->kind = TyFloat;
st->size = size;
- st->t_scalar.issigned = True;
+ st->u.t_scalar.issigned = True;
return st;
@@ -286,5 +286,5 @@ SymType *VG_(st_mkpointer)(SymType *st,
st->kind = TyPointer;
st->size = sizeof(void *);
- st->t_pointer.type = ptr;
+ st->u.t_pointer.type = ptr;
return st;
@@ -299,7 +299,7 @@ SymType *VG_(st_mkrange)(SymType *st, Sy
st->kind = TyRange;
st->size = 0; /* ? */
- st->t_range.type = ty;
- st->t_range.min = min;
- st->t_range.max = max;
+ st->u.t_range.type = ty;
+ st->u.t_range.min = min;
+ st->u.t_range.max = max;
return st;
@@ -312,14 +312,14 @@ SymType *VG_(st_mkstruct)(SymType *st, U
vg_assert(st->kind == TyUnresolved || st->kind == TyUnknown || st->kind == TyStruct);
- vg_assert(st->kind != TyStruct || st->t_struct.nfield == 0);
+ vg_assert(st->kind != TyStruct || st->u.t_struct.nfield == 0);
st->kind = TyStruct;
st->size = size;
- st->t_struct.nfield = 0;
- st->t_struct.nfieldalloc = nfields;
+ st->u.t_struct.nfield = 0;
+ st->u.t_struct.nfieldalloc = nfields;
if (nfields != 0)
- st->t_struct.fields = VG_(arena_malloc)(VG_AR_SYMTAB, sizeof(StField) * nfields);
+ st->u.t_struct.fields = VG_(arena_malloc)(VG_AR_SYMTAB, sizeof(StField) * nfields);
else
- st->t_struct.fields = NULL;
+ st->u.t_struct.fields = NULL;
return st;
@@ -332,14 +332,14 @@ SymType *VG_(st_mkunion)(SymType *st, UI
vg_assert(st->kind == TyUnresolved || st->kind == TyUnknown || st->kind == TyUnion);
- vg_assert(st->kind != TyUnion || st->t_struct.nfield == 0);
+ vg_assert(st->kind != TyUnion || st->u.t_struct.nfield == 0);
st->kind = TyUnion;
st->size = size;
- st->t_struct.nfield = 0;
- st->t_struct.nfieldalloc = nfields;
+ st->u.t_struct.nfield = 0;
+ st->u.t_struct.nfieldalloc = nfields;
if (nfields != 0)
- st->t_struct.fields = VG_(arena_malloc)(VG_AR_SYMTAB, sizeof(StField) * nfields);
+ st->u.t_struct.fields = VG_(arena_malloc)(VG_AR_SYMTAB, sizeof(StField) * nfields);
else
- st->t_struct.fields = NULL;
+ st->u.t_struct.fields = NULL;
return st;
@@ -352,15 +352,15 @@ void VG_(st_addfield)(SymType *st, Char
vg_assert(st->kind == TyStruct || st->kind == TyUnion);
- if (st->t_struct.nfieldalloc == st->t_struct.nfield) {
+ if (st->u.t_struct.nfieldalloc == st->u.t_struct.nfield) {
StField *n = VG_(arena_malloc)(VG_AR_SYMTAB,
- sizeof(StField) * (st->t_struct.nfieldalloc + 2));
- VG_(memcpy)(n, st->t_struct.fields, sizeof(*n) * st->t_struct.nfield);
- if (st->t_struct.fields != NULL)
- VG_(arena_free)(VG_AR_SYMTAB, st->t_struct.fields);
- st->t_struct.nfieldalloc++;
- st->t_struct.fields = n;
+ sizeof(StField) * (st->u.t_struct.nfieldalloc + 2));
+ VG_(memcpy)(n, st->u.t_struct.fields, sizeof(*n) * st->u.t_struct.nfield);
+ if (st->u.t_struct.fields != NULL)
+ VG_(arena_free)(VG_AR_SYMTAB, st->u.t_struct.fields);
+ st->u.t_struct.nfieldalloc++;
+ st->u.t_struct.fields = n;
}
- f = &st->t_struct.fields[st->t_struct.nfield++];
+ f = &st->u.t_struct.fields[st->u.t_struct.nfield++];
f->name = name;
f->type = type;
@@ -377,6 +377,6 @@ SymType *VG_(st_mkenum)(SymType *st, UIn
st->kind = TyEnum;
- st->t_enum.ntag = 0;
- st->t_enum.tags = NULL;
+ st->u.t_enum.ntag = 0;
+ st->u.t_enum.tags = NULL;
return st;
@@ -390,6 +390,6 @@ SymType *VG_(st_mkarray)(SymType *st, Sy
st->kind = TyArray;
- st->t_array.type = type;
- st->t_array.idxtype = idxtype;
+ st->u.t_array.type = type;
+ st->u.t_array.idxtype = idxtype;
return st;
@@ -406,5 +406,5 @@ SymType *VG_(st_mktypedef)(SymType *st,
st->kind = TyTypedef;
st->name = name;
- st->t_typedef.type = type;
+ st->u.t_typedef.type = type;
return st;
@@ -419,5 +419,5 @@ SymType *VG_(st_basetype)(SymType *type,
if (type->kind == TyTypedef)
- type = type->t_typedef.type;
+ type = type->u.t_typedef.type;
}
@@ -826,7 +826,7 @@ Char *VG_(describe_addr)(ThreadId tid, A
if (debug)
- VG_(printf)(" %d fields\n", type->t_struct.nfield);
- for(i = 0; i < type->t_struct.nfield; i++) {
- StField *f = &type->t_struct.fields[i];
+ VG_(printf)(" %d fields\n", type->u.t_struct.nfield);
+ for(i = 0; i < type->u.t_struct.nfield; i++) {
+ StField *f = &type->u.t_struct.fields[i];
newvar(f->name, f->type, var->valuep + (f->offset / 8), (f->size + 7) / 8);
}
@@ -838,10 +838,10 @@ Char *VG_(describe_addr)(ThreadId tid, A
Int offset; /* offset of index for non-0-based arrays */
Int min, max; /* range of indicies we care about (0 based) */
- SymType *ty = type->t_array.type;
- vg_assert(type->t_array.idxtype->kind == TyRange);
+ SymType *ty = type->u.t_array.type;
+ vg_assert(type->u.t_array.idxtype->kind == TyRange);
- offset = type->t_array.idxtype->t_range.min;
+ offset = type->u.t_array.idxtype->u.t_range.min;
min = 0;
- max = type->t_array.idxtype->t_range.max - offset;
+ max = type->u.t_array.idxtype->u.t_range.max - offset;
if ((max-min+1) == 0) {
@@ -894,5 +894,5 @@ Char *VG_(describe_addr)(ThreadId tid, A
actually a decayed array, and treat it accordingly */
if (is_valid_addr(var->valuep))
- newvar(NULL, type->t_pointer.type, *(Addr *)var->valuep, -1);
+ newvar(NULL, type->u.t_pointer.type, *(Addr *)var->valuep, -1);
break;
|