Anonymous avatar Anonymous committed b17e7a5

more fixups for sparc solaris

Comments (0)

Files changed (5)

 AM_PROG_AS
 AC_PROG_LIBTOOL
 AC_C_INLINE
+AC_C_BIGENDIAN
 
 CFLAGS=`echo $CFLAGS | sed -e 's/-O2//;'`
 CFLAGS="-D_REENTRANT $CFLAGS"
       if (!gimli_dwarf_die_get_uint64_t_attr(die, DW_AT_byte_size, &bytesize)) {
         bytesize = gimli_type_size(memt)/8;
       }
+#if !WORDS_BIGENDIAN
       offset = ((bytesize * 8) - 1) - offset;
+#endif
 
     } else {
       size = gimli_type_size(memt);
 	unsigned vers;
 	int no_rebucket;
 	void (*compile_key)(hash_key_t *key);
-	int (*copy_key)(gimli_hash_bucket *b, hash_key_t key);
-	uint32_t (*hash)(hash_key_t key, uint32_t initval);
-	int (*same_key)(gimli_hash_bucket *b, hash_key_t key);
+	int (*copy_key)(gimli_hash_bucket *b, hash_key_t *key);
+	uint32_t (*hash)(hash_key_t *key, uint32_t initval);
+	int (*same_key)(gimli_hash_bucket *b, hash_key_t *key);
 	struct gimli_slab bucketslab;
 	gimli_hash_free_func_t dtor;
 };
 	key->len = sizeof(uint64_t);
 }
 
-static int u64_key_copy(gimli_hash_bucket *b, hash_key_t key)
+static int u64_key_copy(gimli_hash_bucket *b, hash_key_t *key)
 {
-	b->k = key;
+	b->k = *key;
 	return 1;
 }
 
-static uint32_t u64_key_hash(hash_key_t hkey, uint32_t initval)
+static uint32_t u64_key_hash(hash_key_t *hkey, uint32_t initval)
 {
 #if 0
-	uint32_t a = 0, b = hkey.u.u64 >> 32;
-	uint32_t c = hkey.u.u64 & 0xffffffff;
+	uint32_t a = 0, b = hkey->u.u64 >> 32;
+	uint32_t c = hkey->u.u64 & 0xffffffff;
 
 	mix(a, b, c);
 	return c;
 #elif 1
 	/* http://www.cris.com/~Ttwang/tech/inthash.htm -> hash6432shift */
-	uint64_t key = hkey.u.u64;
+	uint64_t key = hkey->u.u64;
 
   key = (~key) + (key << 18); // key = (key << 18) - key - 1;
   key = key ^ (key >> 31);
   key = key ^ (key >> 22);
   return (uint32_t) key;
 #else
-	return (uint32_t)hkey.u.u64;
+	return (uint32_t)hkey->u.u64;
 #endif
 }
 
-static int u64_key_same(gimli_hash_bucket *b, hash_key_t key)
+static int u64_key_same(gimli_hash_bucket *b, hash_key_t *key)
 {
-	return b->k.u.u64 == key.u.u64;
+	return b->k.u.u64 == key->u.u64;
 }
 
 static void ptr_key_compile(hash_key_t *key)
 	key->len = sizeof(void*);
 }
 
-static int ptr_key_copy(gimli_hash_bucket *b, hash_key_t key)
+static int ptr_key_copy(gimli_hash_bucket *b, hash_key_t *key)
 {
-	b->k = key;
+	b->k = *key;
 	return 1;
 }
 
-static uint32_t ptr_key_hash(hash_key_t key, uint32_t initval)
+static uint32_t ptr_key_hash(hash_key_t *key, uint32_t initval)
 {
-	return (uint32_t)(intptr_t)key.u.ptr;
+	return (uint32_t)(intptr_t)key->u.ptr;
 }
 
-static int ptr_key_same(gimli_hash_bucket *b, hash_key_t key)
+static int ptr_key_same(gimli_hash_bucket *b, hash_key_t *key)
 {
-	return b->k.u.ptr == key.u.ptr;
+	return b->k.u.ptr == key->u.ptr;
 }
 
-static int string_key_dup(gimli_hash_bucket *b, hash_key_t key)
+static int string_key_dup(gimli_hash_bucket *b, hash_key_t *key)
 {
-	b->k = key;
-	b->k.u.str = malloc(key.len + 1);
+	b->k = *key;
+	b->k.u.str = malloc(key->len + 1);
 	if (!b->k.u.str) return 0;
-	memcpy(b->k.u.str, key.u.str, key.len);
-	b->k.u.str[key.len] = '\0';
+	memcpy(b->k.u.str, key->u.str, key->len);
+	b->k.u.str[key->len] = '\0';
 	return 1;
 }
 
 	key->len = strlen(key->u.str);
 }
 
-static int string_key_same(gimli_hash_bucket *b, hash_key_t k)
+static int string_key_same(gimli_hash_bucket *b, hash_key_t *k)
 {
-	return b->k.len == k.len && !memcmp(b->k.u.str, k.u.str, k.len);
+	return b->k.len == k->len && !memcmp(b->k.u.str, k->u.str, k->len);
 }
 
-static uint32_t string_key_hash(hash_key_t key, uint32_t initval)
+static uint32_t string_key_hash(hash_key_t *key, uint32_t initval)
 {
    register uint32_t a,b,c,len;
-	 const char *k = key.u.ptr;
+   const char *k = key->u.ptr;
 
    /* Set up the internal state */
-   len = key.len;
+   len = key->len;
    a = b = 0x9e3779b9;  /* the golden ratio; an arbitrary value */
    c = initval;         /* the previous hash value */
 
    }
 
    /*------------------------------------- handle the last 11 bytes */
-   c += key.len;
+   c += key->len;
    switch(len)              /* all the case statements fall through */
    {
    case 11: c+=((uint32_t)k[10]<<24);
 //	free(b);
 }
 
-static gimli_hash_bucket *new_bucket(gimli_hash_t h, hash_key_t key, void *item)
+static gimli_hash_bucket *new_bucket(gimli_hash_t h, hash_key_t *key, void *item)
 {
 	gimli_hash_bucket *b;
 
 		b = h->buckets[i];
 		while (b) {
 			n = b->next;
-			newoff = h->hash(b->k, h->initval) & (newsize-1);
+			newoff = h->hash(&b->k, h->initval) & (newsize-1);
 			b->next = newbuckets[newoff];
 			newbuckets[newoff] = b;
 			b = n;
 	h->buckets = newbuckets;
 }
 
-static int do_hash_insert(gimli_hash_t h, hash_key_t key, void *item)
+static int do_hash_insert(gimli_hash_t h, hash_key_t *key, void *item)
 {
 	int off;
 	gimli_hash_bucket *b;
 
-	h->compile_key(&key);
+	h->compile_key(key);
 
 	off = h->hash(key, h->initval) & (h->table_size - 1);
 	b = h->buckets[off];
 	return 1;
 }
 
-static int do_hash_find(gimli_hash_t h, hash_key_t key, void **item_p)
+static int do_hash_find(gimli_hash_t h, hash_key_t *key, void **item_p)
 {
 	int off;
 	gimli_hash_bucket *b;
 
-	h->compile_key(&key);
+	h->compile_key(key);
 
 	off = h->hash(key, h->initval) & (h->table_size - 1);
 	b = h->buckets[off];
 	return 0;
 }
 
-static int do_hash_delete(gimli_hash_t h, hash_key_t key)
+static int do_hash_delete(gimli_hash_t h, hash_key_t *key)
 {
 	int off;
 	gimli_hash_bucket *b, *prev = NULL;
 
-	h->compile_key(&key);
+	h->compile_key(key);
 
 	off = h->hash(key, h->initval) & (h->table_size - 1);
 	b = h->buckets[off];
 
 	key.u.str = (char*)k;
 
-	return do_hash_insert(h, key, item);
+	return do_hash_insert(h, &key, item);
 }
 
 int gimli_hash_find(gimli_hash_t h, const char *k, void **item_p)
 
 	key.u.str = (char*)k;
 
-	return do_hash_find(h, key, item_p);
+	return do_hash_find(h, &key, item_p);
 }
 
 int gimli_hash_delete(gimli_hash_t h, const char *k)
 
 	key.u.str = (char*)k;
 
-	return do_hash_delete(h, key);
+	return do_hash_delete(h, &key);
 }
 
 int gimli_hash_delete_u64(gimli_hash_t h, uint64_t k)
 
 	key.u.u64 = k;
 
-	return do_hash_delete(h, key);
+	return do_hash_delete(h, &key);
 }
 
 int gimli_hash_find_u64(gimli_hash_t h, uint64_t k, void **item_p)
 
 	key.u.u64 = k;
 
-	return do_hash_find(h, key, item_p);
+	return do_hash_find(h, &key, item_p);
 }
 
 int gimli_hash_insert_u64(gimli_hash_t h, uint64_t k, void *item)
 
 	key.u.u64 = k;
 
-	return do_hash_insert(h, key, item);
+	return do_hash_insert(h, &key, item);
 }
 
 int gimli_hash_delete_ptr(gimli_hash_t h, void * k)
 
 	key.u.ptr = k;
 
-	return do_hash_delete(h, key);
+	return do_hash_delete(h, &key);
 }
 
 int gimli_hash_find_ptr(gimli_hash_t h, void * k, void **item_p)
 
 	key.u.ptr = k;
 
-	return do_hash_find(h, key, item_p);
+	return do_hash_find(h, &key, item_p);
 }
 
 int gimli_hash_insert_ptr(gimli_hash_t h, void * k, void *item)
 
 	key.u.ptr = k;
 
-	return do_hash_insert(h, key, item);
+	return do_hash_insert(h, &key, item);
 }
 
 void gimli_hash_delete_all(gimli_hash_t h, int downsize)
 //printf("READ: 0x%" PRIx64 "\n", u.u64);
     u.u64 >>= shift;
     u.u64 &= mask;
+//printf("PROC: 0x%" PRIx64 "\n", u.u64);
 
     bytes = 8;
 
   }
   maps = malloc(sb.st_size);
   if (maps == NULL) {
-    fprintf(stderr, "malloc(%d) for maps: %s\n", sb.st_size, strerror(errno));
+    fprintf(stderr, "malloc(%" PRIu64 ") for maps: %s\n", (uint64_t)sb.st_size, strerror(errno));
     close(fd);
     return;
   }
   gwindows_t gwin;
 
   snprintf(path, sizeof(path), "/proc/%d/lwp/%d/gwindows",
-    targetph.pid, cur->st.lwpid);
+    cur->proc->pid, cur->st.lwpid);
 
   if (stat64(path, &st) == -1 || st.st_size == 0) {
     return 0;
       return 0;
     }
 
-    if (gimli_read_mem(cur->proc, (void*)(cur->st.regs[R_FP] + STACK_BIAS),
+    if (gimli_read_mem(cur->proc, (cur->st.regs[R_FP] + STACK_BIAS),
         &cur->st.regs[R_L0],
         sizeof(struct rwindow)) != sizeof(struct rwindow)) {
       /* try to fill this data in via gwindow information */
       if (!read_gwindow(cur)) {
-        fprintf(stderr, "unable to read rwindow @ %p, and no gwindow\n",
+        fprintf(stderr, "unable to read rwindow @ " PTRFMT ", and no gwindow\n",
           cur->st.regs[R_FP]);
       }
     }
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.