Improvements to the -debug command line options
The debug command line options that display parse tree nodes (-debug-module, -debug-top, -debug-symtabs) now display previously hidden linked list pointers which are useful for debugging parse trees. Added new command line option -debug-quiet. This suppresses the display of most linked list pointers and symbol table pointers in the parse tree nodes. The keys in the parse tree node are now shown in alphabetical order.
This commit is contained in:
parent
b737a64ec5
commit
1db04bf322
9 changed files with 277 additions and 215 deletions
|
|
@ -760,13 +760,10 @@ int JSEmitter::emitWrapperFunction(Node *n) {
|
|||
ret = emitSetter(n, is_member, is_static);
|
||||
} else if (is_getter) {
|
||||
ret = emitGetter(n, is_member, is_static);
|
||||
} else {
|
||||
Swig_print_node(n);
|
||||
}
|
||||
|
||||
} else {
|
||||
Printf(stderr, "Warning: unsupported wrapper function type\n");
|
||||
Swig_print_node(n);
|
||||
ret = SWIG_ERROR;
|
||||
}
|
||||
} else {
|
||||
|
|
@ -778,7 +775,6 @@ int JSEmitter::emitWrapperFunction(Node *n) {
|
|||
ret = emitDtor(n);
|
||||
} else {
|
||||
Printf(stderr, "Warning: unsupported wrapper function type");
|
||||
Swig_print_node(n);
|
||||
ret = SWIG_ERROR;
|
||||
}
|
||||
}
|
||||
|
|
@ -1409,7 +1405,6 @@ int JSEmitter::switchNamespace(Node *n) {
|
|||
String *_nspace = lang->getNSpace();
|
||||
if (!Equal(nspace, _nspace)) {
|
||||
Printf(stdout, "##### Custom vs Language::getNSpace(): %s | %s\n", nspace, _nspace);
|
||||
Swig_print_node(n);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -74,6 +74,7 @@ static const char *usage1 = (const char *) "\
|
|||
-debug-symbols - Display target language symbols in the symbol tables\n\
|
||||
-debug-csymbols - Display C symbols in the symbol tables\n\
|
||||
-debug-lsymbols - Display target language layer symbols\n\
|
||||
-debug-quiet - Display less parse tree node debug info when using other -debug options\n\
|
||||
-debug-tags - Display information about the tags found in the interface\n\
|
||||
-debug-template - Display information for debugging templates\n\
|
||||
-debug-top <n> - Display entire parse tree at stages 1-4, <n> is a csv list of stages\n\
|
||||
|
|
@ -778,6 +779,9 @@ static void getoptions(int argc, char *argv[]) {
|
|||
} else if (strncmp(argv[i], "-w", 2) == 0) {
|
||||
Swig_mark_arg(i);
|
||||
Swig_warnfilter(argv[i] + 2, 1);
|
||||
} else if (strcmp(argv[i], "-debug-quiet") == 0) {
|
||||
Swig_print_quiet(1);
|
||||
Swig_mark_arg(i);
|
||||
} else if (strcmp(argv[i], "-debug-symtabs") == 0) {
|
||||
dump_symtabs = 1;
|
||||
Swig_mark_arg(i);
|
||||
|
|
|
|||
|
|
@ -339,7 +339,6 @@ List *Swig_overload_rank(Node *n, bool script_lang_wrapping) {
|
|||
Setattr(nodes[i].n, "overload:ignore", "1");
|
||||
Append(result, nodes[i].n);
|
||||
// Printf(stdout,"[ %d ] %d %s\n", i, nodes[i].implicitconv_function, ParmList_errorstr(nodes[i].parms));
|
||||
// Swig_print_node(nodes[i].n);
|
||||
if (i == nnodes-1 || nodes[i].argc != nodes[i+1].argc) {
|
||||
if (argc_changed_index+2 < nnodes && (nodes[argc_changed_index+1].argc == nodes[argc_changed_index+2].argc)) {
|
||||
// Add additional implicitconv functions in same order as already ranked.
|
||||
|
|
@ -351,7 +350,6 @@ List *Swig_overload_rank(Node *n, bool script_lang_wrapping) {
|
|||
SetFlag(nodes[j].n, "implicitconvtypecheckoff");
|
||||
Append(result, nodes[j].n);
|
||||
// Printf(stdout,"[ %d ] %d + %s\n", j, nodes[j].implicitconv_function, ParmList_errorstr(nodes[j].parms));
|
||||
// Swig_print_node(nodes[j].n);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1542,8 +1542,6 @@ List * R::Swig_overload_rank(Node *n,
|
|||
if (nodes[i].error)
|
||||
Setattr(nodes[i].n, "overload:ignore", "1");
|
||||
Append(result,nodes[i].n);
|
||||
// Printf(stdout,"[ %d ] %s\n", i, ParmList_errorstr(nodes[i].parms));
|
||||
// Swig_print_node(nodes[i].n);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
|
|
|||
|
|
@ -51,3 +51,4 @@ extern void Swig_restore(Node *node);
|
|||
extern void Swig_print_tags(File *obj, Node *root);
|
||||
extern void Swig_print_tree(Node *obj);
|
||||
extern void Swig_print_node(Node *obj);
|
||||
extern int Swig_print_quiet(int quiet);
|
||||
|
|
|
|||
|
|
@ -16,6 +16,20 @@
|
|||
#include <stdarg.h>
|
||||
#include <assert.h>
|
||||
|
||||
static int debug_quiet = 0;
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* Swig_print_quiet()
|
||||
*
|
||||
* Set quiet mode when printing a parse tree node
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
int Swig_print_quiet(int quiet) {
|
||||
int previous_quiet = debug_quiet;
|
||||
debug_quiet = quiet;
|
||||
return previous_quiet;
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* Swig_print_tags()
|
||||
*
|
||||
|
|
@ -68,31 +82,40 @@ void Swig_print_node(Node *obj) {
|
|||
Node *cobj;
|
||||
|
||||
print_indent(0);
|
||||
Printf(stdout, "+++ %s - %p ----------------------------------------\n", nodeType(obj), obj);
|
||||
ki = First(obj);
|
||||
while (ki.key) {
|
||||
String *k = ki.key;
|
||||
if ((Cmp(k, "nodeType") == 0) || (Cmp(k, "firstChild") == 0) || (Cmp(k, "lastChild") == 0) ||
|
||||
(Cmp(k, "parentNode") == 0) || (Cmp(k, "nextSibling") == 0) || (Cmp(k, "previousSibling") == 0) || (*(Char(k)) == '$')) {
|
||||
if (debug_quiet)
|
||||
Printf(stdout, "+++ %s ----------------------------------------\n", nodeType(obj));
|
||||
else
|
||||
Printf(stdout, "+++ %s - %p ----------------------------------------\n", nodeType(obj), obj);
|
||||
|
||||
List *keys = Keys(obj);
|
||||
SortList(keys, 0);
|
||||
ki = First(keys);
|
||||
while (ki.item) {
|
||||
String *k = ki.item;
|
||||
DOH *value = Getattr(obj, k);
|
||||
if (Equal(k, "nodeType") || (*(Char(k)) == '$')) {
|
||||
/* Do nothing */
|
||||
} else if (Cmp(k, "kwargs") == 0 || Cmp(k, "parms") == 0 || Cmp(k, "wrap:parms") == 0 ||
|
||||
Cmp(k, "pattern") == 0 || Cmp(k, "templateparms") == 0 || Cmp(k, "throws") == 0) {
|
||||
} else if (debug_quiet && (Equal(k, "nodeType") || Equal(k, "firstChild") || Equal(k, "lastChild") || Equal(k, "parentNode") || Equal(k, "nextSibling") ||
|
||||
Equal(k, "previousSibling") || Equal(k, "symtab") || Equal(k, "csymtab") || Equal(k, "sym:symtab") || Equal(k, "sym:nextSibling") ||
|
||||
Equal(k, "sym:previousSibling") || Equal(k, "csym:nextSibling") || Equal(k, "csym:previousSibling"))) {
|
||||
/* Do nothing */
|
||||
} else if (Equal(k, "kwargs") || Equal(k, "parms") || Equal(k, "wrap:parms") || Equal(k, "pattern") || Equal(k, "templateparms") || Equal(k, "throws")) {
|
||||
print_indent(2);
|
||||
/* Differentiate parameter lists by displaying within single quotes */
|
||||
Printf(stdout, "%-12s - \'%s\'\n", k, ParmList_str_defaultargs(Getattr(obj, k)));
|
||||
Printf(stdout, "%-12s - \'%s\'\n", k, ParmList_str_defaultargs(value));
|
||||
} else {
|
||||
DOH *o;
|
||||
const char *trunc = "";
|
||||
print_indent(2);
|
||||
if (DohIsString(Getattr(obj, k))) {
|
||||
o = Str(Getattr(obj, k));
|
||||
if (DohIsString(value)) {
|
||||
o = Str(value);
|
||||
if (Len(o) > 80) {
|
||||
trunc = "...";
|
||||
}
|
||||
Printf(stdout, "%-12s - \"%(escape)-0.80s%s\"\n", k, o, trunc);
|
||||
Delete(o);
|
||||
} else {
|
||||
Printf(stdout, "%-12s - %p\n", k, Getattr(obj, k));
|
||||
Printf(stdout, "%-12s - %p\n", k, value);
|
||||
}
|
||||
}
|
||||
ki = Next(ki);
|
||||
|
|
@ -107,6 +130,7 @@ void Swig_print_node(Node *obj) {
|
|||
print_indent(1);
|
||||
Printf(stdout, "\n");
|
||||
}
|
||||
Delete(keys);
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue