aboutsummaryrefslogtreecommitdiffstats
path: root/ddms/libs
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2012-12-18 18:02:49 -0800
committerElliott Hughes <enh@google.com>2012-12-18 18:02:49 -0800
commitedaec558c9fac5b6f1c84475304de3ec072caf21 (patch)
tree2a6ef14e7823c2620a5937f8dc1d362ea6d7da03 /ddms/libs
parent402c3b3f47c7c3ce236c7ce888a8e0da7fc713e3 (diff)
downloadsdk-edaec558c9fac5b6f1c84475304de3ec072caf21.zip
sdk-edaec558c9fac5b6f1c84475304de3ec072caf21.tar.gz
sdk-edaec558c9fac5b6f1c84475304de3ec072caf21.tar.bz2
Make ddms show Java stacks in the traditional format, for legibility.
Also remove the need to double-click to see a stack. Change-Id: I076179b09350d1c85614c7325e2faa4848b4e8d8
Diffstat (limited to 'ddms/libs')
-rw-r--r--ddms/libs/ddmuilib/src/com/android/ddmuilib/AllocationPanel.java15
-rw-r--r--ddms/libs/ddmuilib/src/com/android/ddmuilib/StackTracePanel.java69
-rw-r--r--ddms/libs/ddmuilib/src/com/android/ddmuilib/ThreadPanel.java50
3 files changed, 31 insertions, 103 deletions
diff --git a/ddms/libs/ddmuilib/src/com/android/ddmuilib/AllocationPanel.java b/ddms/libs/ddmuilib/src/com/android/ddmuilib/AllocationPanel.java
index 23775e8..a48f73d 100644
--- a/ddms/libs/ddmuilib/src/com/android/ddmuilib/AllocationPanel.java
+++ b/ddms/libs/ddmuilib/src/com/android/ddmuilib/AllocationPanel.java
@@ -77,11 +77,7 @@ public class AllocationPanel extends TablePanel {
private final static String PREFS_ALLOC_SASH = "allocPanel.sash"; //$NON-NLS-1$
- private static final String PREFS_STACK_COL_CLASS = "allocPanel.stack.col0"; //$NON-NLS-1$
- private static final String PREFS_STACK_COL_METHOD = "allocPanel.stack.col1"; //$NON-NLS-1$
- private static final String PREFS_STACK_COL_FILE = "allocPanel.stack.col2"; //$NON-NLS-1$
- private static final String PREFS_STACK_COL_LINE = "allocPanel.stack.col3"; //$NON-NLS-1$
- private static final String PREFS_STACK_COL_NATIVE = "allocPanel.stack.col4"; //$NON-NLS-1$
+ private static final String PREFS_STACK_COLUMN = "allocPanel.stack.col0"; //$NON-NLS-1$
private Composite mAllocationBase;
private Table mAllocationTable;
@@ -387,13 +383,7 @@ public class AllocationPanel extends TablePanel {
// the UI below the sash
mStackTracePanel = new StackTracePanel();
- mStackTraceTable = mStackTracePanel.createPanel(mAllocationBase,
- PREFS_STACK_COL_CLASS,
- PREFS_STACK_COL_METHOD,
- PREFS_STACK_COL_FILE,
- PREFS_STACK_COL_LINE,
- PREFS_STACK_COL_NATIVE,
- store);
+ mStackTraceTable = mStackTracePanel.createPanel(mAllocationBase, PREFS_STACK_COLUMN, store);
// now setup the sash.
// form layout data
@@ -659,4 +649,3 @@ public class AllocationPanel extends TablePanel {
}
}
-
diff --git a/ddms/libs/ddmuilib/src/com/android/ddmuilib/StackTracePanel.java b/ddms/libs/ddmuilib/src/com/android/ddmuilib/StackTracePanel.java
index 336a5a3..b00120b 100644
--- a/ddms/libs/ddmuilib/src/com/android/ddmuilib/StackTracePanel.java
+++ b/ddms/libs/ddmuilib/src/com/android/ddmuilib/StackTracePanel.java
@@ -40,7 +40,7 @@ import org.eclipse.swt.widgets.Table;
* <p/>This is not a panel in the regular sense. Instead this is just an object around the creation
* and management of a Stack Trace display.
* <p/>UI creation is done through
- * {@link #createPanel(Composite, String, String, String, String, String, IPreferenceStore)}.
+ * {@link #createPanel(Composite, String, IPreferenceStore)}.
*
*/
public final class StackTracePanel {
@@ -97,22 +97,10 @@ public final class StackTracePanel {
@Override
public String getColumnText(Object element, int columnIndex) {
- if (element instanceof StackTraceElement) {
- StackTraceElement traceElement = (StackTraceElement)element;
- switch (columnIndex) {
- case 0:
- return traceElement.getClassName();
- case 1:
- return traceElement.getMethodName();
- case 2:
- return traceElement.getFileName();
- case 3:
- return Integer.toString(traceElement.getLineNumber());
- case 4:
- return Boolean.toString(traceElement.isNativeMethod());
- }
+ if (element instanceof StackTraceElement && columnIndex == 0) {
+ StackTraceElement traceElement = (StackTraceElement) element;
+ return " at " + traceElement.toString();
}
-
return null;
}
@@ -166,55 +154,22 @@ public final class StackTracePanel {
* <p/>This method will set the parent {@link Composite} to use a {@link GridLayout} with
* 2 columns.
* @param parent the parent composite.
- * @param prefs_stack_col_class
- * @param prefs_stack_col_method
- * @param prefs_stack_col_file
- * @param prefs_stack_col_line
- * @param prefs_stack_col_native
+ * @param prefs_stack_column
* @param store
*/
- public Table createPanel(Composite parent, String prefs_stack_col_class,
- String prefs_stack_col_method, String prefs_stack_col_file, String prefs_stack_col_line,
- String prefs_stack_col_native, IPreferenceStore store) {
+ public Table createPanel(Composite parent, String prefs_stack_column,
+ IPreferenceStore store) {
mStackTraceTable = new Table(parent, SWT.MULTI | SWT.FULL_SELECTION);
- mStackTraceTable.setHeaderVisible(true);
- mStackTraceTable.setLinesVisible(true);
-
- TableHelper.createTableColumn(
- mStackTraceTable,
- "Class",
- SWT.LEFT,
- "SomeLongClassName", //$NON-NLS-1$
- prefs_stack_col_class, store);
-
- TableHelper.createTableColumn(
- mStackTraceTable,
- "Method",
- SWT.LEFT,
- "someLongMethod", //$NON-NLS-1$
- prefs_stack_col_method, store);
-
- TableHelper.createTableColumn(
- mStackTraceTable,
- "File",
- SWT.LEFT,
- "android/somepackage/someotherpackage/somefile.class", //$NON-NLS-1$
- prefs_stack_col_file, store);
-
- TableHelper.createTableColumn(
- mStackTraceTable,
- "Line",
- SWT.RIGHT,
- "99999", //$NON-NLS-1$
- prefs_stack_col_line, store);
+ mStackTraceTable.setHeaderVisible(false);
+ mStackTraceTable.setLinesVisible(false);
TableHelper.createTableColumn(
mStackTraceTable,
- "Native",
+ "Info",
SWT.LEFT,
- "Native", //$NON-NLS-1$
- prefs_stack_col_native, store);
+ "SomeLongClassName.method(android/somepackage/someotherpackage/somefile.java:99999)", //$NON-NLS-1$
+ prefs_stack_column, store);
mStackTraceViewer = new TableViewer(mStackTraceTable);
mStackTraceViewer.setContentProvider(new StackTraceContentProvider());
diff --git a/ddms/libs/ddmuilib/src/com/android/ddmuilib/ThreadPanel.java b/ddms/libs/ddmuilib/src/com/android/ddmuilib/ThreadPanel.java
index f88b4c4..81e245d 100644
--- a/ddms/libs/ddmuilib/src/com/android/ddmuilib/ThreadPanel.java
+++ b/ddms/libs/ddmuilib/src/com/android/ddmuilib/ThreadPanel.java
@@ -71,11 +71,7 @@ public class ThreadPanel extends TablePanel {
private final static String PREFS_THREAD_SASH = "threadPanel.sash"; //$NON-NLS-1$
- private static final String PREFS_STACK_COL_CLASS = "threadPanel.stack.col0"; //$NON-NLS-1$
- private static final String PREFS_STACK_COL_METHOD = "threadPanel.stack.col1"; //$NON-NLS-1$
- private static final String PREFS_STACK_COL_FILE = "threadPanel.stack.col2"; //$NON-NLS-1$
- private static final String PREFS_STACK_COL_LINE = "threadPanel.stack.col3"; //$NON-NLS-1$
- private static final String PREFS_STACK_COL_NATIVE = "threadPanel.stack.col4"; //$NON-NLS-1$
+ private static final String PREFS_STACK_COLUMN = "threadPanel.stack.col0"; //$NON-NLS-1$
private Display mDisplay;
private Composite mBase;
@@ -100,9 +96,9 @@ public class ThreadPanel extends TablePanel {
private Object mLock = new Object();
private static final String[] THREAD_STATUS = {
- "zombie", "running", "timed-wait", "monitor",
- "wait", "init", "start", "native", "vmwait",
- "suspended"
+ "Zombie", "Runnable", "TimedWait", "Monitor",
+ "Wait", "Initializing", "Starting", "Native", "VmWait",
+ "Suspended"
};
/**
@@ -269,21 +265,13 @@ public class ThreadPanel extends TablePanel {
mThreadViewer.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
- ThreadInfo selectedThread = getThreadSelection(event.getSelection());
- updateThreadStackTrace(selectedThread);
+ requestThreadStackTrace(getThreadSelection(event.getSelection()));
}
});
mThreadViewer.addDoubleClickListener(new IDoubleClickListener() {
@Override
public void doubleClick(DoubleClickEvent event) {
- ThreadInfo selectedThread = getThreadSelection(event.getSelection());
- if (selectedThread != null) {
- Client client = (Client)mThreadViewer.getInput();
-
- if (client != null) {
- client.requestThreadStackTrace(selectedThread.getThreadId());
- }
- }
+ requestThreadStackTrace(getThreadSelection(event.getSelection()));
}
});
@@ -301,13 +289,7 @@ public class ThreadPanel extends TablePanel {
mRefreshStackTraceButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- ThreadInfo selectedThread = getThreadSelection(null);
- if (selectedThread != null) {
- Client currentClient = getCurrentClient();
- if (currentClient != null) {
- currentClient.requestThreadStackTrace(selectedThread.getThreadId());
- }
- }
+ requestThreadStackTrace(getThreadSelection(null));
}
});
@@ -315,13 +297,7 @@ public class ThreadPanel extends TablePanel {
mStackTraceTimeLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
mStackTracePanel = new StackTracePanel();
- mStackTraceTable = mStackTracePanel.createPanel(mStackTraceBase,
- PREFS_STACK_COL_CLASS,
- PREFS_STACK_COL_METHOD,
- PREFS_STACK_COL_FILE,
- PREFS_STACK_COL_LINE,
- PREFS_STACK_COL_NATIVE,
- store);
+ mStackTraceTable = mStackTracePanel.createPanel(mStackTraceBase, PREFS_STACK_COLUMN, store);
GridData gd;
mStackTraceTable.setLayoutData(gd = new GridData(GridData.FILL_BOTH));
@@ -478,6 +454,15 @@ public class ThreadPanel extends TablePanel {
mBase.layout();
}
+ private void requestThreadStackTrace(ThreadInfo selectedThread) {
+ if (selectedThread != null) {
+ Client client = (Client) mThreadViewer.getInput();
+ if (client != null) {
+ client.requestThreadStackTrace(selectedThread.getThreadId());
+ }
+ }
+ }
+
/**
* Updates the stack call of the currently selected thread.
* <p/>
@@ -586,4 +571,3 @@ public class ThreadPanel extends TablePanel {
}
}
-