summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2003-03-13 10:31:35 +0000
committerBruno Haible <bruno@clisp.org>2003-03-13 10:31:35 +0000
commit19c69d8e5a9151d25938eb06244978eb753995e8 (patch)
treeefa266c7574f9541f8c208cf57a52f0938538a7c /src
parent6ba54862299937b54369f1d64f620ad2bc8fd60f (diff)
downloadgperf-19c69d8e5a9151d25938eb06244978eb753995e8.tar.gz
Better debugging output.
Diffstat (limited to 'src')
-rw-r--r--src/search.cc45
1 files changed, 41 insertions, 4 deletions
diff --git a/src/search.cc b/src/search.cc
index 4d2c58f..cb0ed8f 100644
--- a/src/search.cc
+++ b/src/search.cc
@@ -830,9 +830,39 @@ Search::prepare_asso_values ()
_collision_detector = new Bool_Array (_max_hash_value + 1);
if (option[DEBUG])
- fprintf (stderr, "total non-linked keys = %d\nmaximum associated value is %d"
- "\nmaximum size of generated hash table is %d\n",
- non_linked_length, asso_value_max, _max_hash_value);
+ {
+ fprintf (stderr, "total non-linked keys = %d\nmaximum associated value is %d"
+ "\nmaximum size of generated hash table is %d\n",
+ non_linked_length, asso_value_max, _max_hash_value);
+
+ int field_width;
+
+ field_width = 0;
+ {
+ for (KeywordExt_List *temp = _head; temp; temp = temp->rest())
+ {
+ KeywordExt *keyword = temp->first();
+ if (field_width < keyword->_selchars_length)
+ field_width = keyword->_selchars_length;
+ }
+ }
+
+ fprintf (stderr, "\ndumping the keyword list without duplicates\n");
+ fprintf (stderr, "keyword #, %*s, keyword\n", field_width, "keysig");
+ int i = 0;
+ for (KeywordExt_List *temp = _head; temp; temp = temp->rest())
+ {
+ KeywordExt *keyword = temp->first();
+ fprintf (stderr, "%9d, ", ++i);
+ if (field_width > keyword->_selchars_length)
+ fprintf (stderr, "%*s", field_width - keyword->_selchars_length, "");
+ for (int j = 0; j < keyword->_selchars_length; j++)
+ putc (keyword->_selchars[j], stderr);
+ fprintf (stderr, ", %.*s\n",
+ keyword->_allchars_length, keyword->_allchars);
+ }
+ fprintf (stderr, "\nend of keyword list\n\n");
+ }
if (option[RANDOM] || option.get_jump () == 0)
/* We will use rand(), so initialize the random number generator. */
@@ -1191,8 +1221,15 @@ Search::find_asso_values ()
if (option[DEBUG])
{
- fprintf (stderr, "** collision not resolved after %d iterations, backtracking...\n",
+ fprintf (stderr, "** collision not resolved after %d iterations of asso_value[",
iterations);
+ for (union_index = 0; union_index < union_set_length; union_index++)
+ {
+ if (union_index > 0)
+ fprintf (stderr, ",");
+ fprintf(stderr, "'%c'", union_set[union_index]);
+ }
+ fprintf (stderr, "], backtracking...\n");
fflush (stderr);
}
}