Don't write the crash xml file

Nothing uses it and it's not even valid xml.
This commit is contained in:
Thomas Goyne 2013-01-03 19:25:21 -08:00
parent c691099d24
commit 9b24ab38a4
2 changed files with 3 additions and 32 deletions

View file

@ -390,28 +390,14 @@ void AegisubApp::HandleEvent(wxEvtHandler *handler, wxEventFunction func, wxEven
/// @param cause cause of the crash. /// @param cause cause of the crash.
/// ///
StackWalker::StackWalker(wxString cause) { StackWalker::StackWalker(wxString cause) {
wxFileName report_dir("");
report_dir.SetPath(StandardPaths::DecodePath("?user/reporter"));
if (!report_dir.DirExists()) report_dir.Mkdir();
crash_text = new wxFile(StandardPaths::DecodePath("?user/crashlog.txt"), wxFile::write_append); crash_text = new wxFile(StandardPaths::DecodePath("?user/crashlog.txt"), wxFile::write_append);
crash_xml = new wxFile(StandardPaths::DecodePath("?user/reporter/crash.xml"), wxFile::write);
if ((crash_text->IsOpened()) && (crash_xml->IsOpened())) { if (crash_text->IsOpened()) {
wxDateTime time = wxDateTime::Now(); wxDateTime time = wxDateTime::Now();
crash_text->Write(wxString::Format("--- %s ------------------\n", time.FormatISOCombined())); crash_text->Write(wxString::Format("--- %s ------------------\n", time.FormatISOCombined()));
crash_text->Write(wxString::Format("VER - %s\n", GetAegisubLongVersionString())); crash_text->Write(wxString::Format("VER - %s\n", GetAegisubLongVersionString()));
crash_text->Write(wxString::Format("FTL - Beginning stack dump for \"%s\":\n", cause)); crash_text->Write(wxString::Format("FTL - Beginning stack dump for \"%s\":\n", cause));
crash_xml->Write( "<crash>\n");
crash_xml->Write( " <info>\n");
crash_xml->Write(wxString::Format(" <cause>%s</cause>\n", cause));
crash_xml->Write(wxString::Format(" <time>%s</time>\n", time.FormatISOCombined()));
crash_xml->Write(wxString::Format(" <version>%s</version>\n", GetAegisubLongVersionString()));
crash_xml->Write( " </info>\n");
crash_xml->Write( " <trace>\n");
} }
} }
@ -419,36 +405,22 @@ StackWalker::StackWalker(wxString cause) {
/// @param frame frame to parse. /// @param frame frame to parse.
/// ///
void StackWalker::OnStackFrame(const wxStackFrame &frame) { void StackWalker::OnStackFrame(const wxStackFrame &frame) {
if (crash_text->IsOpened()) {
if ((crash_text->IsOpened()) && (crash_xml->IsOpened())) {
wxString dst = wxString::Format("%03u - %p: ", (unsigned)frame.GetLevel(),frame.GetAddress()) + frame.GetName(); wxString dst = wxString::Format("%03u - %p: ", (unsigned)frame.GetLevel(),frame.GetAddress()) + frame.GetName();
if (frame.HasSourceLocation()) if (frame.HasSourceLocation())
dst = wxString::Format("%s on %s:%u", dst, frame.GetFileName(), (unsigned)frame.GetLine()); dst = wxString::Format("%s on %s:%u", dst, frame.GetFileName(), (unsigned)frame.GetLine());
crash_text->Write(wxString::Format("%s\n", dst)); crash_text->Write(wxString::Format("%s\n", dst));
crash_xml->Write(wxString::Format(" <frame id='%u' loc='%p'>\n", (int)frame.GetLevel(), frame.GetAddress()));
crash_xml->Write(wxString::Format(" <name>%s</name>\n", frame.GetName()));
if (frame.HasSourceLocation())
crash_xml->Write(wxString::Format(" <file line='%u'>%s</file>\n", (unsigned)frame.GetLine(), frame.GetFileName()));
crash_xml->Write(wxString::Format(" <module><![CDATA[%s]]></module>\n", frame.GetModule()));
crash_xml->Write( " </frame>\n");
} }
} }
/// @brief Called at the end of walking the stack. /// @brief Called at the end of walking the stack.
StackWalker::~StackWalker() { StackWalker::~StackWalker() {
if ((crash_text->IsOpened()) && (crash_xml->IsOpened())) { if (crash_text->IsOpened()) {
crash_text->Write("End of stack dump.\n"); crash_text->Write("End of stack dump.\n");
crash_text->Write("----------------------------------------\n\n"); crash_text->Write("----------------------------------------\n\n");
crash_text->Close(); crash_text->Close();
crash_xml->Write(" </trace>\n");
crash_xml->Write("</crash>\n");
crash_xml->Close();
} }
} }
#endif #endif

View file

@ -104,7 +104,6 @@ wxDECLARE_APP(AegisubApp);
#if wxUSE_STACKWALKER == 1 #if wxUSE_STACKWALKER == 1
class StackWalker: public wxStackWalker { class StackWalker: public wxStackWalker {
wxFile *crash_text; // FP to the crash text file. wxFile *crash_text; // FP to the crash text file.
wxFile *crash_xml; // FP to the crash xml file.
public: public:
StackWalker(wxString cause); StackWalker(wxString cause);