Skip to content

Commit

Permalink
Expand debugger filter coverage
Browse files Browse the repository at this point in the history
Previously, "hide all" would still show top-level and errors, and RHS writes and
messages were combined in one filter. This made it difficult for users to
achieve a quiet and focused debugger view.

Rename "hide all" to "show only errors and top-level", then create a true "hide
all" filter to complement that. Separate messages from RHS writes, and add
additional filter options for error and top-level. This covers all 14 output
types, while still providing convenient check boxes for common settings.

Fixes #365.
  • Loading branch information
garfieldnate committed Jul 21, 2023
1 parent 13b5834 commit a50da75
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 21 deletions.
8 changes: 8 additions & 0 deletions Java/Debugger/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
## Development

To run in IntelliJ (community edition is fine), first compile the `debugger`
target in the `soar` directory with `python3 scons --verbose debugger`. This will populate
the `soar/out/java` directory with jar files we use here as dependencies. Then, load this
directory as an existing project in IntelliJ.

It's not ideal, but PR's are welcome.
16 changes: 8 additions & 8 deletions Java/Debugger/src/edu/umich/soar/debugger/Application.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/**
/**
* Application.java
*
* Title: Debugger for Soar written in Java
* Description:
* Description:
* @author Douglas Pearson, 2005 (www.threepenny.net)
* @version
* @version
*/

package edu.umich.soar.debugger;
Expand All @@ -15,10 +15,10 @@ public class Application
{

/************************************************************************
*
*
* Default constructor for the application -- creates the main frame and set
* the look and feel.
*
*
*************************************************************************/
public Application(String[] args, boolean alwaysInstallLibs, Display display)
{
Expand All @@ -42,12 +42,12 @@ public Application(String[] args, boolean alwaysInstallLibs, Display display)
}

/*************************************************************************
*
*
* The application's main entry point.
*
*
* @param args
* Command line arguments. Currently ignored.
*
*
*************************************************************************/
static public void main(String[] args)
{
Expand Down
15 changes: 8 additions & 7 deletions Java/Debugger/src/edu/umich/soar/debugger/helpers/TraceType.java
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
/********************************************************************************************
*
* TraceType.java
*
* Description:
*
*
* Description:
*
* Created on May 22, 2005
* @author Douglas Pearson
*
*
* Developed by ThreePenny Software <a href="http://www.threepenny.net">www.threepenny.net</a>
********************************************************************************************/
package edu.umich.soar.debugger.helpers;

/************************************************************************
*
*
* Constants defining different types of information in a trace (which we can
* then use for filtering).
*
*
************************************************************************/
public class TraceType
{
Expand All @@ -34,9 +34,10 @@ public class TraceType
kVerbose = 1 << 11,
kWarning = 1 << 12,
kError = 1 << 13,
kMessage = 1 << 14,

kAllExceptTopLevel = kPhase | kPreference | kWmeChange | kFiring
| kRetraction | kStack | kRhsWrite | kLearning
| kRetraction | kStack | kRhsWrite | kMessage | kLearning
| kFullLearning | kNumericIndifferent | kVerbose | kWarning,

kAll = kAllExceptTopLevel | kTopLevel | kError;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ public void widgetSelected(SelectionEvent e)
});

menuItem = new MenuItem(m_FilterMenu, SWT.CHECK);
menuItem.setText("Wme Changes");
menuItem.setText("WME Changes");
menuItem.setData("type", TraceType.kWmeChange);
menuItem.addSelectionListener(new SelectionAdapter()
{
Expand Down Expand Up @@ -406,7 +406,7 @@ public void widgetSelected(SelectionEvent e)
});

menuItem = new MenuItem(m_FilterMenu, SWT.CHECK);
menuItem.setText("Rhs Writes and Messages");
menuItem.setText("RHS Writes");
menuItem.setData("type", TraceType.kRhsWrite);
menuItem.addSelectionListener(new SelectionAdapter()
{
Expand All @@ -416,6 +416,17 @@ public void widgetSelected(SelectionEvent e)
}
});

menuItem = new MenuItem(m_FilterMenu, SWT.CHECK);
menuItem.setText("Messages");
menuItem.setData("type", TraceType.kMessage);
menuItem.addSelectionListener(new SelectionAdapter()
{
public void widgetSelected(SelectionEvent e)
{
changeFilter(e.widget, TraceType.kMessage);
}
});

menuItem = new MenuItem(m_FilterMenu, SWT.CHECK);
menuItem.setText("Learning");
menuItem.setData("type", TraceType.kLearning);
Expand Down Expand Up @@ -460,6 +471,28 @@ public void widgetSelected(SelectionEvent e)
}
});

menuItem = new MenuItem(m_FilterMenu, SWT.CHECK);
menuItem.setText("Top Level");
menuItem.setData("type", TraceType.kTopLevel);
menuItem.addSelectionListener(new SelectionAdapter()
{
public void widgetSelected(SelectionEvent e)
{
changeFilter(e.widget, TraceType.kTopLevel);
}
});

menuItem = new MenuItem(m_FilterMenu, SWT.CHECK);
menuItem.setText("Errors");
menuItem.setData("type", TraceType.kError);
menuItem.addSelectionListener(new SelectionAdapter()
{
public void widgetSelected(SelectionEvent e)
{
changeFilter(e.widget, TraceType.kError);
}
});

menuItem = new MenuItem(m_FilterMenu, SWT.PUSH);
menuItem.setText("Show all");
menuItem.addSelectionListener(new SelectionAdapter()
Expand All @@ -472,13 +505,25 @@ public void widgetSelected(SelectionEvent e)
});

menuItem = new MenuItem(m_FilterMenu, SWT.PUSH);
menuItem.setText("Hide all");
menuItem.setText("Show only top level and errors");
menuItem.addSelectionListener(new SelectionAdapter()
{
public void widgetSelected(SelectionEvent e)
{
m_FoldingText.setExclusionFilter(TraceType.kAllExceptTopLevel,
true);
true);
updateButtonState();
}
});

menuItem = new MenuItem(m_FilterMenu, SWT.PUSH);
menuItem.setText("Hide all");
menuItem.addSelectionListener(new SelectionAdapter()
{
public void widgetSelected(SelectionEvent e)
{
m_FoldingText.setExclusionFilter(TraceType.kAll,
true);
updateButtonState();
}
});
Expand Down Expand Up @@ -1147,13 +1192,21 @@ else if (xmlTrace.IsTagMessage() || xmlTrace.IsTagWarning()
// Figure out the type of the message so we can filter it
// appropriately
// We'll classify messages and rhs writes together for now
long type = TraceType.kRhsWrite;
if (xmlTrace.IsTagWarning())
long type;
if (xmlTrace.IsTagMessage())
type = TraceType.kMessage;
else if (xmlTrace.IsTagWarning())
type = TraceType.kWarning;
else if (xmlTrace.IsTagVerbose())
type = TraceType.kVerbose;
else if (xmlTrace.IsTagError())
type = TraceType.kError;
else {
System.err.println("Warning: unknown trace type encountered while " +
"writing SML output in debugger. This should never happen.");
// should never happen, but fall back to message type to be safe
type = TraceType.kMessage;
}

if (text.length() != 0)
{
Expand Down

0 comments on commit a50da75

Please sign in to comment.