aboutsummaryrefslogtreecommitdiff
path: root/gdb/bcache.c
diff options
context:
space:
mode:
authorAleksandar Ristovski <aristovski@qnx.com>2008-06-05 19:21:55 +0000
committerAleksandar Ristovski <aristovski@qnx.com>2008-06-05 19:21:55 +0000
commit2e618c13af17f36d0f0173786d49abea7308dc24 (patch)
treed25c6e97d0ee183dcba1b54d3f2d0ec0679188dc /gdb/bcache.c
parent8a34ac3f587db129417fd57104477cd186b666c8 (diff)
downloadgdb-2e618c13af17f36d0f0173786d49abea7308dc24.zip
gdb-2e618c13af17f36d0f0173786d49abea7308dc24.tar.gz
gdb-2e618c13af17f36d0f0173786d49abea7308dc24.tar.bz2
* bcache.c (bcache_data): Call deprecated_bcache_added function.
(deprecated_bcache_added): New function name. Body of function bcache_data is used here with the addition of 'added' argument. * bcache.h (deprecated_bcache_added): New function. * symfile.c (add_psymbol_to_bcache): New helper function, takes part of work from add_psymbol_to_list - initialises partial symbol and stashes it in objfile's cache. (append_psymbol_to_list): New helper function, takes other part of work from add_psymbol_to_list - adds partial symbol to the given list. (add_psymbol_to_list): Call helper functions instead of doing work here. If adding to global list, do not duplicate partial symbols in the partial symtab.
Diffstat (limited to 'gdb/bcache.c')
-rw-r--r--gdb/bcache.c44
1 files changed, 32 insertions, 12 deletions
diff --git a/gdb/bcache.c b/gdb/bcache.c
index 9454537..9f7a915 100644
--- a/gdb/bcache.c
+++ b/gdb/bcache.c
@@ -197,11 +197,40 @@ expand_hash_table (struct bcache *bcache)
static void *
bcache_data (const void *addr, int length, struct bcache *bcache)
{
+ return deprecated_bcache_added (addr, length, bcache, NULL);
+}
+
+
+void *
+deprecated_bcache (const void *addr, int length, struct bcache *bcache)
+{
+ return bcache_data (addr, length, bcache);
+}
+
+const void *
+bcache (const void *addr, int length, struct bcache *bcache)
+{
+ return bcache_data (addr, length, bcache);
+}
+
+/* Find a copy of the LENGTH bytes at ADDR in BCACHE. If BCACHE has
+ never seen those bytes before, add a copy of them to BCACHE. In
+ either case, return a pointer to BCACHE's copy of that string. If
+ optional ADDED is not NULL, return 1 in case of new entry or 0 if
+ returning an old entry. */
+
+void *
+deprecated_bcache_added (const void *addr, int length, struct bcache *bcache,
+ int *added)
+{
unsigned long full_hash;
unsigned short half_hash;
int hash_index;
struct bstring *s;
+ if (added)
+ *added = 0;
+
/* If our average chain length is too high, expand the hash table. */
if (bcache->unique_count >= bcache->num_buckets * CHAIN_LENGTH_THRESHOLD)
expand_hash_table (bcache);
@@ -242,21 +271,12 @@ bcache_data (const void *addr, int length, struct bcache *bcache)
bcache->unique_size += length;
bcache->structure_size += BSTRING_SIZE (length);
+ if (added)
+ *added = 1;
+
return &new->d.data;
}
}
-
-void *
-deprecated_bcache (const void *addr, int length, struct bcache *bcache)
-{
- return bcache_data (addr, length, bcache);
-}
-
-const void *
-bcache (const void *addr, int length, struct bcache *bcache)
-{
- return bcache_data (addr, length, bcache);
-}
/* Allocating and freeing bcaches. */