virtual void OnStackFrame(const wxStackFrame& frame) { printf("[%2d] ", (int) frame.GetLevel()); wxString name = frame.GetName(); if ( !name.empty() ) { printf("%-20.40s", (const char*)name.mb_str()); } else { printf("0x%08lx", (unsigned long)frame.GetAddress()); } if ( frame.HasSourceLocation() ) { printf("\t%s:%d", (const char*)frame.GetFileName().mb_str(), (int)frame.GetLine()); } puts(""); wxString type, val; for ( size_t n = 0; frame.GetParam(n, &type, &name, &val); n++ ) { printf("\t%s %s = %s\n", (const char*)type.mb_str(), (const char*)name.mb_str(), (const char*)val.mb_str()); } }
void XmlStackWalker::OnStackFrame(const wxStackFrame& frame) { m_isOk = true; wxXmlNode *nodeFrame = new wxXmlNode(wxXML_ELEMENT_NODE, wxT("frame")); m_nodeStack->AddChild(nodeFrame); NumProperty(nodeFrame, wxT("level"), frame.GetLevel()); wxString func = frame.GetName(); if ( !func.empty() ) { nodeFrame->AddAttribute(wxT("function"), func); HexProperty(nodeFrame, wxT("offset"), frame.GetOffset()); } if ( frame.HasSourceLocation() ) { nodeFrame->AddAttribute(wxT("file"), frame.GetFileName()); NumProperty(nodeFrame, wxT("line"), frame.GetLine()); } const size_t nParams = frame.GetParamCount(); if ( nParams ) { wxXmlNode *nodeParams = new wxXmlNode(wxXML_ELEMENT_NODE, wxT("parameters")); nodeFrame->AddChild(nodeParams); for ( size_t n = 0; n < nParams; n++ ) { wxXmlNode * nodeParam = new wxXmlNode(wxXML_ELEMENT_NODE, wxT("parameter")); nodeParams->AddChild(nodeParam); NumProperty(nodeParam, wxT("number"), n); wxString type, name, value; if ( !frame.GetParam(n, &type, &name, &value) ) continue; if ( !type.empty() ) TextElement(nodeParam, wxT("type"), type); if ( !name.empty() ) TextElement(nodeParam, wxT("name"), name); if ( !value.empty() ) TextElement(nodeParam, wxT("value"), value); } } }