Soar Kernel
9.3.2 08-06-12
|
#include <portability.h>
#include <stdlib.h>
#include "trace.h"
#include "mem.h"
#include "production.h"
#include "kernel.h"
#include "lexer.h"
#include "symtab.h"
#include "agent.h"
#include "print.h"
#include "init_soar.h"
#include "gdatastructs.h"
#include "tempmem.h"
#include "wmem.h"
#include "xml.h"
#include "soar_TraceNames.h"
#include <ctype.h>
Go to the source code of this file.
Data Structures | |
union | trace_format_struct::trace_format_data_union |
struct | trace_format_struct |
struct | tracing_parameters |
struct | tracing_rule_struct |
Macros | |
#define | GROWABLE_STRING_TRACE_FORMAT_LIST_TO_STRING_BUFFER_SIZE 50 |
Typedefs | |
typedef struct trace_format_struct | trace_format |
typedef struct tracing_rule_struct | tracing_rule |
Enumerations | |
enum | trace_format_type |
Functions | |
void | add_trace_for_attribute_path (agent *thisAgent, Symbol *object, list *path, growable_string *result, Bool print_attributes, Bool recursive) |
void | add_trace_for_wme (agent *thisAgent, growable_string *result, wme *w, Bool print_attribute, Bool recursive) |
Bool | add_trace_format (agent *thisAgent, Bool stack_trace, int type_restriction, Symbol *name_restriction, const char *format_string) |
void | add_values_of_attribute_path (agent *thisAgent, Symbol *object, list *path, growable_string *result, Bool recursive, int *count) |
void | deallocate_trace_format_list (agent *thisAgent, trace_format *tf) |
trace_format * | find_appropriate_trace_format (agent *thisAgent, Bool stack_trace, int type, Symbol *name) |
uint32_t | hash_name_restriction (Symbol *name, short num_bits) |
void | init_tracing (agent *thisAgent) |
trace_format * | lookup_trace_format (agent *thisAgent, Bool stack_trace, int type_restriction, Symbol *name_restriction) |
growable_string | object_to_trace_string (agent *thisAgent, Symbol *object) |
list * | parse_attribute_path_in_brackets (agent *thisAgent) |
trace_format * | parse_format_string (agent *thisAgent, const char *string) |
trace_format * | parse_item_from_format_string (agent *thisAgent) |
trace_format * | parse_pattern_in_brackets (agent *thisAgent, Bool read_opening_bracket) |
void | print_all_trace_formats (agent *thisAgent, Bool stack_trace, FILE *f) |
void | print_all_trace_formats_tcl (agent *thisAgent, Bool stack_trace, FILE *f) |
void | print_object_trace (agent *thisAgent, Symbol *object) |
void | print_object_trace_using_provided_format_string (agent *thisAgent, Symbol *object, Symbol *current_goal, char *format_string) |
void | print_stack_trace (agent *thisAgent, Symbol *object, Symbol *state, int slot_type, Bool allow_cycle_counts) |
void | print_stack_trace_xml (agent *thisAgent, Symbol *object, Symbol *state, int slot_type, Bool) |
Bool | print_trace_callback_fn (agent *thisAgent, void *item, void *) |
Bool | print_trace_callback_fn_tcl (agent *thisAgent, void *item, void *) |
void | print_trace_format_list (agent *thisAgent, trace_format *tf) |
void | print_tracing_rule (agent *thisAgent, int type_restriction, Symbol *name_restriction, trace_format *format) |
void | print_tracing_rule_tcl (agent *thisAgent, int type_restriction, Symbol *name_restriction, trace_format *format) |
Bool | remove_trace_format (agent *thisAgent, Bool stack_trace, int type_restriction, Symbol *name_restriction) |
growable_string | selection_to_trace_string (agent *thisAgent, Symbol *object, Symbol *current_state, int selection_type, Bool allow_cycle_counts) |
void | set_print_trace_formats (agent *thisAgent) |
void | set_tagged_trace_formats (agent *thisAgent) |
growable_string | trace_format_list_to_string (agent *thisAgent, trace_format *tf, Symbol *object) |
uint32_t | tracing_rule_hash_function (void *item, short num_bits) |
Variables | |
const char * | format |
const char * | format_string_error_message |
Bool | found_undefined |
struct tracing_parameters | tparams |
char | tracing_object_letters [3] = {'*','s','o'} |
#define GROWABLE_STRING_TRACE_FORMAT_LIST_TO_STRING_BUFFER_SIZE 50 |
Referenced by trace_format_list_to_string().
typedef struct trace_format_struct trace_format |
typedef struct tracing_rule_struct tracing_rule |
enum trace_format_type |
Definition at line 49 of file trace.cpp.
void add_trace_for_attribute_path | ( | agent * | thisAgent, |
Symbol * | object, | ||
list * | path, | ||
growable_string * | result, | ||
Bool | print_attributes, | ||
Bool | recursive | ||
) |
Definition at line 1028 of file trace.cpp.
References add_to_growable_string(), add_trace_for_wme(), add_values_of_attribute_path(), cons_struct::first, found_undefined, free_growable_string(), symbol_union::id, IDENTIFIER_SYMBOL_TYPE, identifier_struct::impasse_wmes, identifier_struct::input_wmes, length_of_growable_string(), make_blank_growable_string(), wme_struct::next, slot_struct::next, NIL, cons_struct::rest, identifier_struct::slots, symbol_to_string(), text_of_growable_string(), TRUE, and slot_struct::wmes.
Referenced by trace_format_list_to_string().
void add_trace_for_wme | ( | agent * | thisAgent, |
growable_string * | result, | ||
wme * | w, | ||
Bool | print_attribute, | ||
Bool | recursive | ||
) |
Definition at line 993 of file trace.cpp.
References add_to_growable_string(), wme_struct::attr, free_growable_string(), object_to_trace_string(), symbol_to_string(), text_of_growable_string(), TRUE, and wme_struct::value.
Referenced by add_trace_for_attribute_path().
Bool add_trace_format | ( | agent * | thisAgent, |
Bool | stack_trace, | ||
int | type_restriction, | ||
Symbol * | name_restriction, | ||
const char * | format_string | ||
) |
Definition at line 727 of file trace.cpp.
References add_to_hash_table(), allocate_memory(), FALSE, tracing_rule_struct::format, MISCELLANEOUS_MEM_USAGE, tracing_rule_struct::name_restriction, agent_struct::object_tf_for_anything, agent_struct::object_tr_ht, parse_format_string(), remove_trace_format(), agent_struct::stack_tf_for_anything, agent_struct::stack_tr_ht, symbol_add_ref(), TRUE, and tracing_rule_struct::type_restriction.
Referenced by init_soar_agent(), set_print_trace_formats(), and set_tagged_trace_formats().
void add_values_of_attribute_path | ( | agent * | thisAgent, |
Symbol * | object, | ||
list * | path, | ||
growable_string * | result, | ||
Bool | recursive, | ||
int * | count | ||
) |
Definition at line 939 of file trace.cpp.
References add_to_growable_string(), wme_struct::attr, find_slot(), cons_struct::first, free_growable_string(), symbol_union::id, IDENTIFIER_SYMBOL_TYPE, identifier_struct::impasse_wmes, identifier_struct::input_wmes, wme_struct::next, NIL, object_to_trace_string(), cons_struct::rest, symbol_to_string(), text_of_growable_string(), TRUE, wme_struct::value, and slot_struct::wmes.
Referenced by add_trace_for_attribute_path().
void deallocate_trace_format_list | ( | agent * | thisAgent, |
trace_format * | tf | ||
) |
Definition at line 89 of file trace.cpp.
References trace_format_struct::trace_format_data_union::attribute_path, ATTS_AND_VALUES_RECURSIVELY_TFT, ATTS_AND_VALUES_TFT, trace_format_struct::data, deallocate_symbol_list_removing_references(), free_memory(), free_memory_block_for_string(), IF_ALL_DEFINED_TFT, LEFT_JUSTIFY_TFT, MISCELLANEOUS_MEM_USAGE, trace_format_struct::next, REPEAT_SUBGOAL_DEPTH_TFT, RIGHT_JUSTIFY_TFT, trace_format_struct::trace_format_data_union::string, STRING_TFT, trace_format_struct::trace_format_data_union::subformat, trace_format_struct::type, VALUES_RECURSIVELY_TFT, and VALUES_TFT.
Referenced by parse_format_string(), parse_pattern_in_brackets(), and remove_trace_format().
trace_format* find_appropriate_trace_format | ( | agent * | thisAgent, |
Bool | stack_trace, | ||
int | type, | ||
Symbol * | name | ||
) |
Definition at line 1257 of file trace.cpp.
References FOR_ANYTHING_TF, lookup_trace_format(), and NIL.
Referenced by object_to_trace_string(), and selection_to_trace_string().
Definition at line 638 of file trace.cpp.
References masks_for_n_low_order_bits.
Referenced by lookup_trace_format(), remove_trace_format(), and tracing_rule_hash_function().
void init_tracing | ( | agent * | thisAgent | ) |
Definition at line 654 of file trace.cpp.
References make_hash_table(), NIL, agent_struct::object_tf_for_anything, agent_struct::object_tr_ht, agent_struct::stack_tf_for_anything, agent_struct::stack_tr_ht, and tracing_rule_hash_function().
Referenced by init_soar_agent().
trace_format* lookup_trace_format | ( | agent * | thisAgent, |
Bool | stack_trace, | ||
int | type_restriction, | ||
Symbol * | name_restriction | ||
) |
Definition at line 665 of file trace.cpp.
References hash_table_struct::buckets, tracing_rule_struct::format, hash_name_restriction(), hash_table_struct::log2size, tracing_rule_struct::name_restriction, tracing_rule_struct::next_in_hash_bucket, NIL, agent_struct::object_tf_for_anything, agent_struct::object_tr_ht, agent_struct::stack_tf_for_anything, agent_struct::stack_tr_ht, tracing_rule_struct::type_restriction, and uint32_t().
Referenced by find_appropriate_trace_format().
growable_string object_to_trace_string | ( | agent * | thisAgent, |
Symbol * | object | ||
) |
Definition at line 1283 of file trace.cpp.
References add_to_growable_string(), tracing_parameters::allow_cycle_counts, tracing_parameters::current_o, tracing_parameters::current_s, FALSE, find_appropriate_trace_format(), find_name_of_object(), FOR_ANYTHING_TF, FOR_OPERATORS_TF, FOR_STATES_TF, symbol_union::id, IDENTIFIER_SYMBOL_TYPE, identifier_struct::isa_goal, identifier_struct::isa_operator, make_blank_growable_string(), NIL, symbol_to_string(), identifier_struct::tc_num, agent_struct::tf_printing_tc, tparams, trace_format_list_to_string(), and TRUE.
Referenced by add_trace_for_wme(), add_values_of_attribute_path(), print_object_trace(), and trace_format_list_to_string().
Definition at line 180 of file trace.cpp.
References deallocate_symbol_list_removing_references(), destructively_reverse_list(), format, format_string_error_message, make_sym_constant(), MAX_LEXEME_LENGTH, NIL, push(), and TRUE.
Referenced by parse_item_from_format_string().
trace_format* parse_format_string | ( | agent * | thisAgent, |
const char * | string | ||
) |
Definition at line 152 of file trace.cpp.
References deallocate_trace_format_list(), format, format_string_error_message, trace_format_struct::next, NIL, parse_item_from_format_string(), and print().
Referenced by add_trace_format(), and print_object_trace_using_provided_format_string().
trace_format * parse_item_from_format_string | ( | agent * | thisAgent | ) |
Definition at line 270 of file trace.cpp.
References allocate_memory(), trace_format_struct::trace_format_data_union::attribute_path, ATTS_AND_VALUES_RECURSIVELY_TFT, ATTS_AND_VALUES_TFT, CURRENT_OPERATOR_TFT, CURRENT_STATE_TFT, trace_format_struct::data, DECISION_CYCLE_COUNT_TFT, ELABORATION_CYCLE_COUNT_TFT, FALSE, format, format_string_error_message, IDENTIFIER_TFT, IF_ALL_DEFINED_TFT, L_BRACKET_TFT, LEFT_JUSTIFY_TFT, make_memory_block_for_string(), MAX_LEXEME_LENGTH, MISCELLANEOUS_MEM_USAGE, NEWLINE_TFT, NIL, trace_format_struct::num, parse_attribute_path_in_brackets(), parse_pattern_in_brackets(), PERCENT_TFT, R_BRACKET_TFT, REPEAT_SUBGOAL_DEPTH_TFT, RIGHT_JUSTIFY_TFT, trace_format_struct::trace_format_data_union::string, STRING_TFT, trace_format_struct::trace_format_data_union::subformat, SUBGOAL_DEPTH_TFT, TRUE, trace_format_struct::type, VALUES_RECURSIVELY_TFT, and VALUES_TFT.
Referenced by parse_format_string(), and parse_pattern_in_brackets().
trace_format* parse_pattern_in_brackets | ( | agent * | thisAgent, |
Bool | read_opening_bracket | ||
) |
Definition at line 232 of file trace.cpp.
References deallocate_trace_format_list(), format, format_string_error_message, trace_format_struct::next, NIL, and parse_item_from_format_string().
Referenced by parse_item_from_format_string().
Definition at line 823 of file trace.cpp.
References do_for_all_items_in_hash_table(), NIL, agent_struct::object_tf_for_anything, agent_struct::object_tr_ht, print_trace_callback_fn(), print_tracing_rule(), agent_struct::printing_stack_traces, agent_struct::stack_tf_for_anything, and agent_struct::stack_tr_ht.
Definition at line 843 of file trace.cpp.
References do_for_all_items_in_hash_table(), NIL, agent_struct::object_tf_for_anything, agent_struct::object_tr_ht, print_trace_callback_fn_tcl(), print_tracing_rule_tcl(), agent_struct::printing_stack_traces, agent_struct::stack_tf_for_anything, and agent_struct::stack_tr_ht.
Definition at line 1377 of file trace.cpp.
References free_growable_string(), get_new_tc_number(), object_to_trace_string(), print_string(), text_of_growable_string(), and agent_struct::tf_printing_tc.
void print_object_trace_using_provided_format_string | ( | agent * | thisAgent, |
Symbol * | object, | ||
Symbol * | current_goal, | ||
char * | format_string | ||
) |
Definition at line 1473 of file trace.cpp.
References tracing_parameters::allow_cycle_counts, tracing_parameters::current_s, free_growable_string(), get_new_tc_number(), parse_format_string(), print_string(), agent_struct::printer_output_column, text_of_growable_string(), agent_struct::tf_printing_tc, tparams, trace_format_list_to_string(), and TRUE.
void print_stack_trace | ( | agent * | thisAgent, |
Symbol * | object, | ||
Symbol * | state, | ||
int | slot_type, | ||
Bool | allow_cycle_counts | ||
) |
Definition at line 1459 of file trace.cpp.
References free_growable_string(), get_new_tc_number(), print_stack_trace_xml(), print_string(), selection_to_trace_string(), text_of_growable_string(), and agent_struct::tf_printing_tc.
Referenced by print_lowest_slot_in_context_stack().
void print_stack_trace_xml | ( | agent * | thisAgent, |
Symbol * | object, | ||
Symbol * | state, | ||
int | slot_type, | ||
Bool | |||
) |
Definition at line 1386 of file trace.cpp.
References wme_struct::attr, agent_struct::attribute_symbol, tracing_parameters::current_o, agent_struct::d_cycle_count, find_name_of_object(), FOR_OPERATORS_TF, FOR_STATES_TF, symbol_union::id, agent_struct::impasse_symbol, identifier_struct::impasse_wmes, identifier_struct::level, sym_constant_struct::name, wme_struct::next, NIL, identifier_struct::operator_slot, symbol_union::sc, wme_struct::value, slot_struct::wmes, xml_att_val(), xml_begin_tag(), and xml_end_tag().
Referenced by print_stack_trace().
Definition at line 804 of file trace.cpp.
References FALSE, tracing_rule_struct::format, tracing_rule_struct::name_restriction, print_tracing_rule(), and tracing_rule_struct::type_restriction.
Referenced by print_all_trace_formats().
Definition at line 813 of file trace.cpp.
References FALSE, tracing_rule_struct::format, tracing_rule_struct::name_restriction, print_tracing_rule_tcl(), and tracing_rule_struct::type_restriction.
Referenced by print_all_trace_formats_tcl().
void print_trace_format_list | ( | agent * | thisAgent, |
trace_format * | tf | ||
) |
Definition at line 514 of file trace.cpp.
References abort_with_fatal_error(), trace_format_struct::trace_format_data_union::attribute_path, ATTS_AND_VALUES_RECURSIVELY_TFT, ATTS_AND_VALUES_TFT, BUFFER_MSG_SIZE, CURRENT_OPERATOR_TFT, CURRENT_STATE_TFT, trace_format_struct::data, DECISION_CYCLE_COUNT_TFT, ELABORATION_CYCLE_COUNT_TFT, cons_struct::first, IDENTIFIER_TFT, IF_ALL_DEFINED_TFT, L_BRACKET_TFT, LEFT_JUSTIFY_TFT, agent_struct::name, NEWLINE_TFT, trace_format_struct::next, NIL, trace_format_struct::num, PERCENT_TFT, print(), print_string(), R_BRACKET_TFT, REPEAT_SUBGOAL_DEPTH_TFT, cons_struct::rest, RIGHT_JUSTIFY_TFT, trace_format_struct::trace_format_data_union::string, STRING_TFT, string_to_escaped_string(), trace_format_struct::trace_format_data_union::subformat, SUBGOAL_DEPTH_TFT, trace_format_struct::type, VALUES_RECURSIVELY_TFT, and VALUES_TFT.
Referenced by print_tracing_rule(), and print_tracing_rule_tcl().
void print_tracing_rule | ( | agent * | thisAgent, |
int | type_restriction, | ||
Symbol * | name_restriction, | ||
trace_format * | format | ||
) |
Definition at line 769 of file trace.cpp.
References print(), print_string(), print_trace_format_list(), print_with_symbols(), agent_struct::printing_stack_traces, and tracing_object_letters.
Referenced by print_all_trace_formats(), and print_trace_callback_fn().
void print_tracing_rule_tcl | ( | agent * | thisAgent, |
int | type_restriction, | ||
Symbol * | name_restriction, | ||
trace_format * | format | ||
) |
Definition at line 793 of file trace.cpp.
References print(), print_string(), print_trace_format_list(), print_with_symbols(), and tracing_object_letters.
Referenced by print_all_trace_formats_tcl(), and print_trace_callback_fn_tcl().
Bool remove_trace_format | ( | agent * | thisAgent, |
Bool | stack_trace, | ||
int | type_restriction, | ||
Symbol * | name_restriction | ||
) |
Definition at line 691 of file trace.cpp.
References hash_table_struct::buckets, deallocate_trace_format_list(), FALSE, format, tracing_rule_struct::format, free_memory(), hash_name_restriction(), hash_table_struct::log2size, MISCELLANEOUS_MEM_USAGE, tracing_rule_struct::name_restriction, tracing_rule_struct::next_in_hash_bucket, NIL, agent_struct::object_tf_for_anything, agent_struct::object_tr_ht, remove_from_hash_table(), agent_struct::stack_tf_for_anything, agent_struct::stack_tr_ht, symbol_remove_ref(), TRUE, tracing_rule_struct::type_restriction, and uint32_t().
Referenced by add_trace_format(), and destroy_soar_agent().
growable_string selection_to_trace_string | ( | agent * | thisAgent, |
Symbol * | object, | ||
Symbol * | current_state, | ||
int | selection_type, | ||
Bool | allow_cycle_counts | ||
) |
Definition at line 1330 of file trace.cpp.
References tracing_parameters::allow_cycle_counts, tracing_parameters::current_o, tracing_parameters::current_s, find_appropriate_trace_format(), symbol_union::id, make_blank_growable_string(), NIL, identifier_struct::operator_slot, tparams, trace_format_list_to_string(), TRUE, wme_struct::value, and slot_struct::wmes.
Referenced by print_stack_trace().
|
inline |
Definition at line 864 of file trace.cpp.
References add_trace_format(), FALSE, FOR_ANYTHING_TF, FOR_OPERATORS_TF, FOR_STATES_TF, NIL, and TRUE.
|
inline |
Definition at line 884 of file trace.cpp.
References add_trace_format(), FALSE, FOR_ANYTHING_TF, FOR_OPERATORS_TF, FOR_STATES_TF, NIL, and TRUE.
growable_string trace_format_list_to_string | ( | agent * | thisAgent, |
trace_format * | tf, | ||
Symbol * | object | ||
) |
Definition at line 1086 of file trace.cpp.
References abort_with_fatal_error(), add_to_growable_string(), add_trace_for_attribute_path(), tracing_parameters::allow_cycle_counts, trace_format_struct::trace_format_data_union::attribute_path, ATTS_AND_VALUES_RECURSIVELY_TFT, ATTS_AND_VALUES_TFT, BUFFER_MSG_SIZE, tracing_parameters::current_o, CURRENT_OPERATOR_TFT, tracing_parameters::current_s, CURRENT_STATE_TFT, agent_struct::d_cycle_count, trace_format_struct::data, DECISION_CYCLE_COUNT_TFT, agent_struct::e_cycle_count, ELABORATION_CYCLE_COUNT_TFT, FALSE, found_undefined, free_growable_string(), GROWABLE_STRING_TRACE_FORMAT_LIST_TO_STRING_BUFFER_SIZE, symbol_union::id, IDENTIFIER_TFT, IF_ALL_DEFINED_TFT, L_BRACKET_TFT, LEFT_JUSTIFY_TFT, length_of_growable_string(), identifier_struct::level, make_blank_growable_string(), NEWLINE_TFT, trace_format_struct::next, NIL, trace_format_struct::num, object_to_trace_string(), PERCENT_TFT, R_BRACKET_TFT, REPEAT_SUBGOAL_DEPTH_TFT, RIGHT_JUSTIFY_TFT, trace_format_struct::trace_format_data_union::string, STRING_TFT, trace_format_struct::trace_format_data_union::subformat, SUBGOAL_DEPTH_TFT, symbol_to_string(), text_of_growable_string(), tparams, TRUE, trace_format_struct::type, VALUES_RECURSIVELY_TFT, and VALUES_TFT.
Referenced by object_to_trace_string(), print_object_trace_using_provided_format_string(), and selection_to_trace_string().
uint32_t tracing_rule_hash_function | ( | void * | item, |
short | num_bits | ||
) |
Definition at line 644 of file trace.cpp.
References hash_name_restriction(), and tracing_rule_struct::name_restriction.
Referenced by init_tracing().
const char* format |
Definition at line 147 of file trace.cpp.
Referenced by parse_attribute_path_in_brackets(), parse_format_string(), parse_item_from_format_string(), parse_pattern_in_brackets(), and remove_trace_format().
const char* format_string_error_message |
Definition at line 148 of file trace.cpp.
Referenced by parse_attribute_path_in_brackets(), parse_format_string(), parse_item_from_format_string(), and parse_pattern_in_brackets().
Bool found_undefined |
Definition at line 921 of file trace.cpp.
Referenced by add_trace_for_attribute_path(), and trace_format_list_to_string().
struct tracing_parameters tparams |
char tracing_object_letters[3] = {'*','s','o'} |
Definition at line 767 of file trace.cpp.
Referenced by print_tracing_rule(), and print_tracing_rule_tcl().