summaryrefslogtreecommitdiff
path: root/src/gallium
diff options
context:
space:
mode:
authorKristian H. Kristensen <hoegsberg@google.com>2020-07-28 22:52:46 -0700
committerMarge Bot <eric+marge@anholt.net>2020-08-05 18:08:06 +0000
commite487043fd09a2307f868ebcba50abcafe0a2d4fe (patch)
treed7145073756c4d94ef63449d756ea7d24e024bb9 /src/gallium
parente1a58ae7c464bc25c24efcbbbcd31c5919aae661 (diff)
gallium: Switch u_debug_stack/symbol.c to util/hash_table.h
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6112>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/auxiliary/util/u_debug_stack.c13
-rw-r--r--src/gallium/auxiliary/util/u_debug_symbol.c13
2 files changed, 12 insertions, 14 deletions
diff --git a/src/gallium/auxiliary/util/u_debug_stack.c b/src/gallium/auxiliary/util/u_debug_stack.c
index a1e7b27f63d..21f0371d3c1 100644
--- a/src/gallium/auxiliary/util/u_debug_stack.c
+++ b/src/gallium/auxiliary/util/u_debug_stack.c
@@ -45,7 +45,7 @@
#include <dlfcn.h>
#include "os/os_thread.h"
-#include "u_hash_table.h"
+#include "util/hash_table.h"
static struct hash_table* symbols_hash;
static mtx_t symbols_mutex = _MTX_INITIALIZER_NP;
@@ -62,10 +62,9 @@ symbol_name_cached(unw_cursor_t *cursor, unw_proc_info_t *pip)
mtx_lock(&symbols_mutex);
if(!symbols_hash)
- symbols_hash = util_hash_table_create_ptr_keys();
- name = util_hash_table_get(symbols_hash, addr);
- if(!name)
- {
+ symbols_hash = _mesa_pointer_hash_table_create(NULL);
+ struct hash_entry *entry = _mesa_hash_table_search(symbols_hash, addr);
+ if (!entry) {
char procname[256];
unw_word_t off;
int ret;
@@ -78,11 +77,11 @@ symbol_name_cached(unw_cursor_t *cursor, unw_proc_info_t *pip)
if (asprintf(&name, "%s%s", procname, ret == -UNW_ENOMEM ? "..." : "") == -1)
name = "??";
- _mesa_hash_table_insert(symbols_hash, addr, (void*)name);
+ entry = _mesa_hash_table_insert(symbols_hash, addr, (void*)name);
}
mtx_unlock(&symbols_mutex);
- return name;
+ return entry->data;
}
void
diff --git a/src/gallium/auxiliary/util/u_debug_symbol.c b/src/gallium/auxiliary/util/u_debug_symbol.c
index d6471928a9d..73225e9e495 100644
--- a/src/gallium/auxiliary/util/u_debug_symbol.c
+++ b/src/gallium/auxiliary/util/u_debug_symbol.c
@@ -38,7 +38,7 @@
#include "util/u_debug.h"
#include "u_debug_symbol.h"
-#include "u_hash_table.h"
+#include "util/hash_table.h"
#if defined(PIPE_OS_WINDOWS)
@@ -292,16 +292,15 @@ debug_symbol_name_cached(const void *addr)
mtx_lock(&symbols_mutex);
if(!symbols_hash)
- symbols_hash = util_hash_table_create_ptr_keys();
- name = util_hash_table_get(symbols_hash, (void*)addr);
- if(!name)
- {
+ symbols_hash = _mesa_pointer_hash_table_create(NULL);
+ struct hash_entry *entry = _mesa_hash_table_search(symbols_hash, addr);
+ if (!entry) {
char buf[1024];
debug_symbol_name(addr, buf, sizeof(buf));
name = strdup(buf);
- _mesa_hash_table_insert(symbols_hash, (void*)addr, (void*)name);
+ entry = _mesa_hash_table_insert(symbols_hash, addr, (void*)name);
}
mtx_unlock(&symbols_mutex);
- return name;
+ return entry->data;
}