summaryrefslogtreecommitdiff
path: root/usr/src/cmd/sgs/include
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src/cmd/sgs/include')
-rw-r--r--usr/src/cmd/sgs/include/_string_table.h126
-rw-r--r--usr/src/cmd/sgs/include/debug.h2
-rw-r--r--usr/src/cmd/sgs/include/string_table.h101
3 files changed, 139 insertions, 90 deletions
diff --git a/usr/src/cmd/sgs/include/_string_table.h b/usr/src/cmd/sgs/include/_string_table.h
new file mode 100644
index 0000000000..de0955ec58
--- /dev/null
+++ b/usr/src/cmd/sgs/include/_string_table.h
@@ -0,0 +1,126 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef __STRING_TABLE_DOT_H
+#define __STRING_TABLE_DOT_H
+
+#pragma ident "%Z%%M% %I% %E% SMI"
+
+#include <sys/types.h>
+#include <sys/avl.h>
+#include <string_table.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * A string is represented in a string table using two values: length, and
+ * value. Grouping all the strings of a given length together allows for
+ * efficient matching of tail strings, as each input string value is hashed.
+ * Each string table uses a 2-level AVL tree of AVL trees to represent this
+ * organization.
+ *
+ * The outer (main) AVL tree contains LenNode structures. The search key for
+ * nodes on this main tree is the string length. Each such node represents
+ * all strings of a given length, and all strings of that length are found
+ * within.
+ *
+ * The strings within each LenNode are maintained using a secondary AVL tree
+ * of StrNode structures. The search key for this inner tree is the string
+ * itself. The strings are maintained in lexical order.
+ */
+typedef struct {
+ avl_node_t sn_avlnode; /* AVL book-keeping */
+ const char *sn_str; /* string */
+ uint_t sn_refcnt; /* reference count */
+} StrNode;
+
+typedef struct {
+ avl_node_t ln_avlnode; /* AVL book-keeping */
+ avl_tree_t *ln_strtree; /* AVL tree of associated strings */
+ uint_t ln_strlen; /* length of associated strings */
+} LenNode;
+
+/*
+ * Define a master string data item. Other strings may be suffixes of this
+ * string. The final string table will consist of the master string values,
+ * laid end to end, with the other strings referencing their tails.
+ */
+typedef struct str_master Str_master;
+
+struct str_master {
+ const char *sm_str; /* pointer to master string */
+ Str_master *sm_next; /* used for tracking master strings */
+ uint_t sm_strlen; /* length of master string */
+ uint_t sm_hashval; /* hashval of master string */
+ uint_t sm_stroff; /* offset into destination strtab */
+};
+
+/*
+ * Define a hash data item. This item represents an individual string that has
+ * been input into the String hash table. The string may either be a suffix of
+ * another string, or a master string.
+ */
+typedef struct str_hash Str_hash;
+
+struct str_hash {
+ uint_t hi_strlen; /* string length */
+ uint_t hi_refcnt; /* number of references to str */
+ uint_t hi_hashval; /* hash for string */
+ Str_master *hi_mstr; /* pointer to master string */
+ Str_hash *hi_next; /* next entry in hash bucket */
+};
+
+/*
+ * Controlling data structure for a String Table.
+ */
+struct str_tbl {
+ avl_tree_t *st_lentree; /* AVL tree of string lengths */
+ char *st_strbuf; /* string buffer */
+ Str_hash **st_hashbcks; /* hash buckets */
+ Str_master *st_mstrlist; /* list of all master strings */
+ uint_t st_fullstrsize; /* uncompressed table size */
+ uint_t st_nextoff; /* next available string */
+ uint_t st_strsize; /* compressed size */
+ uint_t st_strcnt; /* number of strings */
+ uint_t st_hbckcnt; /* number of buckets in */
+ /* hashlist */
+ uint_t st_flags;
+};
+
+#define FLG_STTAB_COMPRESS 0x01 /* compressed string table */
+#define FLG_STTAB_COOKED 0x02 /* offset has been assigned */
+
+/*
+ * Starting value for use with string hashing functions inside of string_table.c
+ */
+#define HASHSEED 5381
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __STRING_TABLE_DOT_H */
diff --git a/usr/src/cmd/sgs/include/debug.h b/usr/src/cmd/sgs/include/debug.h
index b777961190..bb77b596d4 100644
--- a/usr/src/cmd/sgs/include/debug.h
+++ b/usr/src/cmd/sgs/include/debug.h
@@ -786,7 +786,7 @@ extern void Dbg_syms_ar_resolve(Lm_list *, Xword, Elf_Arsym *,
const char *, int);
extern void Dbg_syms_ar_title(Lm_list *, const char *, int);
extern void Dbg_syms_created(Lm_list *, const char *);
-extern void Dbg_syms_discarded(Lm_list *, Sym_desc *, Is_desc *);
+extern void Dbg_syms_discarded(Lm_list *, Sym_desc *);
extern void Dbg_syms_dlsym(Rt_map *, const char *, const char *, int);
extern void Dbg_syms_dup_sort_addr(Lm_list *, const char *, const char *,
const char *, Addr);
diff --git a/usr/src/cmd/sgs/include/string_table.h b/usr/src/cmd/sgs/include/string_table.h
index 433ca394e2..1bd2d383e2 100644
--- a/usr/src/cmd/sgs/include/string_table.h
+++ b/usr/src/cmd/sgs/include/string_table.h
@@ -2,9 +2,8 @@
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
@@ -20,7 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -29,109 +28,33 @@
#pragma ident "%Z%%M% %I% %E% SMI"
-#include <stdio.h>
#include <sys/types.h>
-#include <sys/avl.h>
-#include <sgs.h>
#ifdef __cplusplus
extern "C" {
#endif
-typedef struct str_hash Str_hash;
-typedef struct str_tbl Str_tbl;
-typedef struct str_master Str_master;
-
-
-/*
- * The Stringlist is the list of 'input strings'
- * associatied with the AVL nodes Stringelem.
- */
-typedef struct stringlist {
- const char *sl_string;
- struct stringlist *sl_next;
-} Stringlist;
-
-/*
- * Nodes for the initial AVL tree which contains all of
- * the input strings. The AVL tree is indexed off of
- * the length of the strings. This permits later traversal
- * of all of the strings based off of their string length.
- */
-typedef struct {
- avl_node_t se_avlnode;
- Stringlist *se_strlist;
- uint_t se_stlen;
-} Stringelem;
-
-
-/*
- * Pointer to the Master string, other strings may be suffixes
- * of this string.
- */
-struct str_master {
- const char *sm_str; /* pointer to master string */
- Str_master *sm_next; /* used for tracking master strings */
- uint_t sm_stlen; /* length of master string */
- uint_t sm_hashval; /* hashval of master string */
- uint_t sm_stoff; /* offset into destination strtab */
-};
-
-
-/*
- * Represents a individual string that was input into
- * the String hash table. The string may either be a
- * suffix of another string or a master string.
- */
-struct str_hash {
- uint_t hi_stlen; /* string length */
- uint_t hi_refcnt; /* # of references to str */
- uint_t hi_hashval; /* hash for string */
- Str_master *hi_mstr; /* pointer to master string */
- Str_hash *hi_next; /* next entry in hash bckt */
-};
-
-/*
- * Controlling data structure for a String Table
- */
-struct str_tbl {
- avl_tree_t *st_strtree; /* avl tree of initial strs */
- char *st_strbuf; /* string buffer */
- Str_hash **st_hashbcks; /* hash buckets */
- Str_master *st_mstrlist; /* list of all master strings */
- uint_t st_fullstringsize; /* uncompressed table size */
- uint_t st_nextoff; /* next available string */
- uint_t st_stringsize; /* compressed size */
- uint_t st_stringcnt; /* # of strings */
- uint_t st_hbckcnt; /* # of buckets in hashlist */
- uint_t st_flags;
-};
-
-#define FLG_STTAB_COOKED 0x00000001 /* offset has been assigned */
-#define FLG_STTAB_COMPRESS 0x00000002 /* build compressed str tab */
-
-/*
- * starting value for use with string hashing functions
- * inside of string_table.c
- */
-#define HASHSEED 5381
-
/*
- * Flags for st_new
+ * Exported, opaque string table handle.
*/
-#define FLG_STNEW_COMPRESS 0x00000001 /* build compressed str tab */
+typedef struct str_tbl Str_tbl;
/*
- * exported string_table.c functions
+ * Exported string table functions.
*/
extern int st_delstring(Str_tbl *, const char *);
extern void st_destroy(Str_tbl *);
extern uint_t st_getstrtab_sz(Str_tbl *);
extern const char *st_getstrbuf(Str_tbl *);
extern int st_insert(Str_tbl *, const char *);
+extern Str_tbl *st_new(uint_t);
extern int st_setstrbuf(Str_tbl *, char *, uint_t);
extern int st_setstring(Str_tbl *, const char *, uint_t *);
-extern Str_tbl *st_new(uint_t);
+
+/*
+ * Exported flags values for st_new().
+ */
+#define FLG_STNEW_COMPRESS 0x01 /* compressed string table */
#ifdef __cplusplus
}