MCPcopy Create free account
hub / github.com/SoarGroup/Soar / print_stack_trace_xml

Function print_stack_trace_xml

Core/SoarKernel/src/trace.cpp:1744–1829  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1742}
1743
1744void print_stack_trace_xml(agent* thisAgent, Symbol* object, Symbol* state, int slot_type, bool/*allow_cycle_counts*/)
1745{
1746
1747 Symbol* current_o = 0;
1748
1749 switch (slot_type)
1750 {
1751 case FOR_STATES_TF:
1752 //create XML trace for state object
1753 xml_begin_tag(thisAgent, kTagState);
1754 xml_att_val(thisAgent, kState_StackLevel, state->id->level - 1);
1755 xml_att_val(thisAgent, kState_DecisionCycleCt, thisAgent->d_cycle_count);
1756 xml_att_val(thisAgent, kState_ID, object);
1757
1758 // find impasse object and add it to XML
1759 wme* w;
1760 for (w = object->id->impasse_wmes; w != NIL; w = w->next)
1761 {
1762 if (w->attr == thisAgent->attribute_symbol)
1763 {
1764 xml_att_val(thisAgent, kState_ImpasseObject, w->value->sc->name);
1765 break;
1766 }
1767 }
1768
1769 // find impasse type and add it to XML
1770 for (w = object->id->impasse_wmes; w != NIL; w = w->next)
1771 {
1772 if (w->attr == thisAgent->impasse_symbol)
1773 {
1774 xml_att_val(thisAgent, kState_ImpasseType, w->value->sc->name);
1775 break;
1776 }
1777 }
1778
1779 xml_end_tag(thisAgent, kTagState);
1780 break;
1781
1782 case FOR_OPERATORS_TF:
1783 //create XML trace for operator object
1784 xml_begin_tag(thisAgent, kTagOperator);
1785 /* -- Prior to Soar 9.4, the following line printed (object->id.level - 1)
1786 * instead of (state->id->level - 1). This was causing the
1787 * unit test to fail. Changing it to state seems to make sense in this
1788 * context, since the level of the state should also be the level of the
1789 * operator. (Could be wrong about this.)
1790 * Leaving this comment because it's possible that the real problem is
1791 * that the level of the operator isn't being set somewhere else to
1792 * the proper value. - MMA 9-2014*/
1793 xml_att_val(thisAgent, kState_StackLevel, state->id->level - 1);
1794 xml_att_val(thisAgent, kOperator_DecisionCycleCt, thisAgent->d_cycle_count);
1795
1796 if (state->id->operator_slot->wmes)
1797 {
1798 current_o = state->id->operator_slot->wmes->value;
1799 }
1800 if (current_o)
1801 {

Callers 1

print_stack_traceFunction · 0.85

Calls 4

xml_begin_tagFunction · 0.85
xml_att_valFunction · 0.85
xml_end_tagFunction · 0.85
find_name_of_objectFunction · 0.85

Tested by

no test coverage detected