Skip to content

Commit

Permalink
Start work on #87, Add ability to generate Trace files in complx
Browse files Browse the repository at this point in the history
  • Loading branch information
TricksterGuy committed Oct 11, 2018
1 parent 2417cda commit e0c70a8
Show file tree
Hide file tree
Showing 5 changed files with 254 additions and 177 deletions.
24 changes: 24 additions & 0 deletions complx/ComplxFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -998,6 +998,30 @@ void ComplxFrame::OnBlackbox(wxCommandEvent& event)
memory->OnBlackbox(event);
}

void ComplxFrame::OnTraceFile(wxCommandEvent& event)
{
wxString file = wxFileSelector("Save trace file (note these files can potentially be huge)", wxEmptyString, wxEmptyString, wxEmptyString, "Trace files (*.trace)|*.trace", wxFD_OVERWRITE_PROMPT | wxFD_SAVE);
if (file.empty())
return;

wxFileName filename(file);
filename.SetExt("trace");

std::string full_path = filename.GetFullPath().ToStdString();

state.trace.reset(new std::ofstream(full_path.c_str()));

if (state.trace->good())
{
wxMessageBox(wxString::Format("Trace file set to %s", full_path), "Trace file set successfully");
}
else
{
state.trace.reset();
wxMessageBox(wxString::Format("Trace file could not be set to %s", full_path), "Failed to set trace file");
}
}

/** OnBreakAndWatchpoints
*
* Called when the user wants to display all breakpoints.
Expand Down
1 change: 1 addition & 0 deletions complx/ComplxFrame.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ class ComplxFrame : public ComplxFrameDecl
void OnWatchpoint(wxCommandEvent& event) override;
void OnAdvancedBreakpoint(wxCommandEvent& event) override;
void OnBlackbox(wxCommandEvent& event) override;
void OnTraceFile(wxCommandEvent& event) override;

// Test menu event handlers
void OnSetupReplayString(wxCommandEvent& event) override;
Expand Down
Loading

0 comments on commit e0c70a8

Please sign in to comment.