#endif
#ifdef BDEBUG
-extern int dflag;
+int pcap_optimizer_debug;
#endif
#if defined(MSDOS) && !defined(__DJGPP__)
{
#ifdef BDEBUG
- if (dflag > 1) {
+ if (pcap_optimizer_debug > 1) {
printf("opt_loop(root, %d) begin\n", do_stmts);
opt_dump(root);
}
find_edom(root);
opt_blks(root, do_stmts);
#ifdef BDEBUG
- if (dflag > 1) {
+ if (pcap_optimizer_debug > 1) {
printf("opt_loop(root, %d) bottom, done=%d\n", do_stmts, done);
opt_dump(root);
}
opt_loop(root, 1);
intern_blocks(root);
#ifdef BDEBUG
- if (dflag > 1) {
+ if (pcap_optimizer_debug > 1) {
printf("after intern_blocks()\n");
opt_dump(root);
}
#endif
opt_root(rootp);
#ifdef BDEBUG
- if (dflag > 1) {
+ if (pcap_optimizer_debug > 1) {
printf("after opt_root()\n");
opt_dump(root);
}
dot_dump_node(JT(block), prog, out);
dot_dump_node(JF(block), prog, out);
}
+
static void
dot_dump_edge(struct block *block, FILE *out)
{
dot_dump_edge(JT(block), out);
dot_dump_edge(JF(block), out);
}
+
/* Output the block CFG using graphviz/DOT language
* In the CFG, block's code, value index for each registers at EXIT,
* and the jump relationship is show.
putchar('\n');
free((char *)f.bf_insns);
}
+
static void
opt_dump(struct block *root)
{
/* if optimizer debugging is enabled, output DOT graph
- * `dflag=4' is equivalent to -dddd to follow -d/-dd/-ddd
- * convention in tcpdump command line
+ * `pcap_optimizer_debug=4' is equivalent to -dddd to follow -d/-dd/-ddd
+ * convention in tcpdump command line
*/
- if (dflag > 3)
+ if (pcap_optimizer_debug > 3)
dot_dump(root);
else
plain_dump(root);
}
-
#endif
return (pcap_version_string);
}
#endif
+
+#ifdef YYDEBUG
+/*
+ * Set the internal "debug printout" flag for the filter expression parser.
+ * The code to print that stuff is present only if YYDEBUG is defined, so
+ * the flag, and the routine to set it, are defined only if YYDEBUG is
+ * defined.
+ *
+ * This is intended for libpcap developers, not for general use.
+ * If you want to set these in a program, you'll have to declare this
+ * routine yourself, with the appropriate DLL import attribute on Windows;
+ * it's not declared in any header file, and won't be declared in any
+ * header file provided by libpcap.
+ */
+PCAP_API void pcap_set_parser_debug(int value);
+
+PCAP_API_DEF void
+pcap_set_parser_debug(int value)
+{
+ extern int pcap_debug;
+
+ pcap_debug = value;
+}
+#endif
+
+#ifdef BDEBUG
+/*
+ * Set the internal "debug printout" flag for the filter expression optimizer.
+ * The code to print that stuff is present only if BDEBUG is defined, so
+ * the flag, and the routine to set it, are defined only if BDEBUG is
+ * defined.
+ *
+ * This is intended for libpcap developers, not for general use.
+ * If you want to set these in a program, you'll have to declare this
+ * routine yourself, with the appropriate DLL import attribute on Windows;
+ * it's not declared in any header file, and won't be declared in any
+ * header file provided by libpcap.
+ */
+PCAP_API void pcap_set_optimizer_debug(int value);
+
+PCAP_API_DEF void
+pcap_set_optimizer_debug(int value)
+{
+ extern int pcap_optimizer_debug;
+
+ pcap_optimizer_debug = value;
+}
+#endif