]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
remove anonymous unions - not supported by older versions of gcc.
authorDirk Mueller <dmuell@gmx.net>
Tue, 6 Jan 2004 16:02:29 +0000 (16:02 +0000)
committerDirk Mueller <dmuell@gmx.net>
Tue, 6 Jan 2004 16:02:29 +0000 (16:02 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2188

coregrind/stage1.c
coregrind/stage2.c
coregrind/ume.c
coregrind/ume.h
coregrind/vg_stabs.c
coregrind/vg_symtab2.c
coregrind/vg_symtab2.h
coregrind/vg_symtypes.c

index d293f8f48098d6d60f538ad6d3098e8469440db2..7056784e47f689a50471d88ff0d0f0df0bd9423a 100644 (file)
@@ -90,18 +90,18 @@ static void *fix_auxv(void *v_init_esp, const struct exeinfo *info)
    /* stage2 needs this so it can clean up the padding we leave in
       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
       subsequently execve() children.  This needs to be done here
       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;
    }
 
    /* OK, go through and patch up the auxv entries to match the new
@@ -109,27 +109,27 @@ static void *fix_auxv(void *v_init_esp, const struct exeinfo *info)
    seen = 0;
    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;
       }
    }
index ab7800a4b435910dd9eccbc2dc3a1c34d197fd0a..3f26fbbc8b03c7b96da20fda03edd1586a1da53f 100644 (file)
@@ -90,12 +90,12 @@ static int scan_auxv(void)
    for(; auxv->a_type != AT_NULL; auxv++)
       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;
       }
@@ -236,7 +236,7 @@ static Addr setup_client_stack(char **orig_argv, char **orig_envp,
    auxsize = sizeof(*auxv);    /* there's always at least one entry: AT_NULL */
    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);
    }
 
@@ -277,7 +277,7 @@ static Addr setup_client_stack(char **orig_argv, char **orig_envp,
    mmap((void *)PGROUNDDN(cl_esp),
        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);
    
 
    /* ==================== copy client stack ==================== */
@@ -321,29 +321,29 @@ static Addr setup_client_stack(char **orig_argv, char **orig_envp,
         if (info->phdr == 0)
            auxv->a_type = AT_IGNORE;
         else
-           auxv->a_val = info->phdr;
+           auxv->u.a_val = info->phdr;
         break;
 
       case AT_PHNUM:
         if (info->phdr == 0)
            auxv->a_type = AT_IGNORE;
         else
-           auxv->a_val = info->phnum;
+           auxv->u.a_val = info->phnum;
         break;
 
       case AT_BASE:
         if (info->interp_base == 0)
            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;
 
       case AT_IGNORE:
@@ -373,7 +373,7 @@ static Addr setup_client_stack(char **orig_argv, char **orig_envp,
            the kernel actually execve's) should never be SUID, and we
            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;
 
       case AT_SYSINFO:
@@ -924,7 +924,7 @@ 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 */
 
@@ -951,7 +951,7 @@ int main(int argc, char **argv)
       incrementally initialized as it is used */
    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 */
    as_unpad((void *)shadow_end, (void *)~0);
index bda21000570a0b21153e4529527652500cb13bd6..2a12f01a7a760cf813ede3c348068c07dea7f943 100644 (file)
@@ -85,9 +85,7 @@
 #include <string.h>
 #include <stdlib.h>
 #include <unistd.h>
-#include <asm/unistd.h>
 #include <sys/stat.h>
-#include <sys/sysmacros.h>
 #include <dlfcn.h>
 #include <assert.h>
 
index 26499ea1cfd09081838e83351718abec94290788..a1647dd0b8542c8e6830dce14a3b7c7b3f6c6970 100644 (file)
@@ -91,7 +91,7 @@ struct ume_auxv
       void *a_ptr;
       int   a_val;
       void (*a_fcn)(void);
-   };
+   } u;
 };
 
 struct ume_auxv *find_auxv(int *orig_esp);
index bbbec89202882a616ba36c8180ce9bfc802694cc..b321bb1ffc8827fb4f0ee61037464d3f0ae3d707 100644 (file)
@@ -1012,12 +1012,12 @@ static Bool initSym(SegInfo *si, Sym *sym, stab_types kind, Char **namep, Int va
    case N_STSYM:
    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;
 
    case N_LSYM:
@@ -1025,17 +1025,17 @@ static Bool initSym(SegInfo *si, Sym *sym, stab_types kind, Char **namep, Int va
         sym->kind = SyEBPrel;  /* -ve off EBP when there's a frame pointer */
       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;
 
    default:
index 5c6b3541062e3e0433bb266d5b73258f0126e5f7..c779873760a02c5853268b90220a938cd3291d27 100644 (file)
@@ -1777,28 +1777,28 @@ Variable *VG_(get_scope_variables)(ThreadId tid)
         v->size = VG_(st_sizeof)(sym->type);
 
         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;
 
         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;
 
         case SyEBPrel:
         case SyESPrel:
            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;
 
         case SyType:
index 117a8bd8266100d73af2b3140c9b5364c1943289..7fef52489cef31f1ace5faf26225066616bf8985 100644 (file)
@@ -97,7 +97,7 @@ struct _Sym {
       Int      offset;         /* offset on stack (-ve -> ebp; +ve -> esp) */
       Int      regno;          /* register number */
       Addr     addr;           /* static or global address */
-   };
+   } u;
 };
 
 struct _Scope {
index 9fc09a334352e31f001a84f47f6b47fc428d6eca..2ce4033744a2f0e7ed41f4e0f081d5c8b823cef0 100644 (file)
@@ -151,7 +151,7 @@ struct _SymType {
         SymResolver    *resolver;      /* symtab reader's resolver */
         void           *data;          /* data for resolver */
       } t_unresolved;
-   };
+   } u;
 };
 
 
@@ -186,7 +186,7 @@ static void resolve(SymType *st)
    if (st->kind != TyUnresolved)
       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)
       st->kind = TyError;
@@ -200,8 +200,8 @@ SymType *VG_(st_mkunresolved)(SymType *st, SymResolver *resolver, void *data)
 
    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;
 }
@@ -211,8 +211,8 @@ void VG_(st_unresolved_setdata)(SymType *st, SymResolver *resolver, void *data)
    if (st->kind != TyUnresolved)
       return;
 
-   st->t_unresolved.resolver = resolver;
-   st->t_unresolved.data = data;
+   st->u.t_unresolved.resolver = resolver;
+   st->u.t_unresolved.data = data;
 }
 
 Bool VG_(st_isresolved)(SymType *st)
@@ -246,7 +246,7 @@ SymType *VG_(st_mkint)(SymType *st, UInt size, Bool isSigned)
    
    st->kind = TyInt;
    st->size = size;
-   st->t_scalar.issigned = isSigned;
+   st->u.t_scalar.issigned = isSigned;
 
    return st;
 }
@@ -259,7 +259,7 @@ SymType *VG_(st_mkfloat)(SymType *st, UInt size)
    
    st->kind = TyFloat;
    st->size = size;
-   st->t_scalar.issigned = True;
+   st->u.t_scalar.issigned = True;
 
    return st;
 }
@@ -285,7 +285,7 @@ SymType *VG_(st_mkpointer)(SymType *st, SymType *ptr)
 
    st->kind = TyPointer;
    st->size = sizeof(void *);
-   st->t_pointer.type = ptr;
+   st->u.t_pointer.type = ptr;
 
    return st;
 }
@@ -298,9 +298,9 @@ SymType *VG_(st_mkrange)(SymType *st, SymType *ty, Int min, Int max)
 
    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;
 }
@@ -311,16 +311,16 @@ SymType *VG_(st_mkstruct)(SymType *st, UInt size, UInt nfields)
 
    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;
 }
@@ -331,16 +331,16 @@ SymType *VG_(st_mkunion)(SymType *st, UInt size, UInt nfields)
 
    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;
 }
@@ -351,17 +351,17 @@ void VG_(st_addfield)(SymType *st, Char *name, SymType *type, UInt off, UInt siz
 
    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;
    f->offset = off;
@@ -376,8 +376,8 @@ SymType *VG_(st_mkenum)(SymType *st, UInt ntags)
    vg_assert(st->kind == TyUnresolved || st->kind == TyUnknown || st->kind == TyEnum);
 
    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;
 }
@@ -389,8 +389,8 @@ SymType *VG_(st_mkarray)(SymType *st, SymType *idxtype, SymType *type)
    vg_assert(st->kind == TyUnresolved || st->kind == TyUnknown);
 
    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;
 }
@@ -405,7 +405,7 @@ SymType *VG_(st_mktypedef)(SymType *st, Char *name, SymType *type)
    
    st->kind = TyTypedef;
    st->name = name;
-   st->t_typedef.type = type;
+   st->u.t_typedef.type = type;
 
    return st;
 }
@@ -418,7 +418,7 @@ SymType *VG_(st_basetype)(SymType *type, Bool do_resolve)
         resolve(type);
 
       if (type->kind == TyTypedef)
-        type = type->t_typedef.type;
+        type = type->u.t_typedef.type;
    }
 
    return type;
@@ -825,9 +825,9 @@ Char *VG_(describe_addr)(ThreadId tid, Addr addr)
            Int i;
 
            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);
            }
            break;
@@ -837,12 +837,12 @@ Char *VG_(describe_addr)(ThreadId tid, Addr addr)
            Int i; 
            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) {
 #if SHADOWCHUNK
@@ -893,7 +893,7 @@ Char *VG_(describe_addr)(ThreadId tid, Addr addr)
            /* XXX work out a way of telling whether a pointer is
               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;
 
         case TyUnresolved: