make thread dumps generated by debugger and copied to clipboard recognizable by "AnalyzeStackTrace" action (IDEA-71213)

This commit is contained in:
Eugene Zhuravlev
2011-07-20 21:23:15 +02:00
parent 997f9e395d
commit ca64fa4372
3 changed files with 21 additions and 8 deletions
@@ -100,7 +100,7 @@ public class ThreadDumpAction extends AnAction implements AnAction.TransparentUp
result.add(threadState);
threadState.setJavaThreadState(threadStatusToJavaThreadState(threadStatus));
buffer.append(threadName);
buffer.append("\"").append(threadName).append("\"");
ReferenceType referenceType = threadReference.referenceType();
if (referenceType != null) {
//noinspection HardCodedStringLiteral
@@ -118,17 +118,27 @@ public class ThreadDumpAction extends AnAction implements AnAction.TransparentUp
if (priority != null) {
Value value = threadReference.getValue(priority);
if (value instanceof IntegerValue) {
buffer.append(", ").append(DebuggerBundle.message("threads.export.attribute.label.priority", ((IntegerValue)value).intValue()));
buffer.append(" ").append(DebuggerBundle.message("threads.export.attribute.label.priority", ((IntegerValue)value).intValue()));
}
}
Field tid = referenceType.fieldByName("tid");
if (tid != null) {
Value value = threadReference.getValue(tid);
if (value instanceof LongValue) {
buffer.append(" ").append(DebuggerBundle.message("threads.export.attribute.label.tid", Long.toHexString(((LongValue)value).longValue())));
buffer.append(" nid=NA");
}
}
}
ThreadGroupReference groupReference = threadReference.threadGroup();
if (groupReference != null) {
buffer.append(", ").append(DebuggerBundle.message("threads.export.attribute.label.group", groupReference.name()));
//ThreadGroupReference groupReference = threadReference.threadGroup();
//if (groupReference != null) {
// buffer.append(", ").append(DebuggerBundle.message("threads.export.attribute.label.group", groupReference.name()));
//}
final String state = threadState.getState();
if (state != null) {
buffer.append(" ").append(state);
}
buffer.append(", ").append(
DebuggerBundle.message("threads.export.attribute.label.status", threadState.getState()));
buffer.append("\n java.lang.Thread.State: ").append(threadState.getJavaThreadState());
@@ -252,6 +252,7 @@ public class ThreadDumpPanel extends JPanel {
public void actionPerformed(AnActionEvent e) {
final StringBuilder buf = new StringBuilder();
buf.append("Full thread dump").append("\n\n");
for (ThreadState state : myThreadDump) {
buf.append(state.getStackTrace()).append("\n\n");
}
@@ -254,6 +254,8 @@ threads.export.attribute.label.daemon=daemon
threads.export.attribute.label.group=in group ''{0}''
threads.export.attribute.label.status=status: ''{0}''
threads.export.attribute.label.priority=prio={0}
threads.export.attribute.label.tid=tid=0x{0}
threads.export.attribute.label.nid=nid={0}
threads.export.attribute.label.blocks.thread=blocks {0}
threads.export.attribute.label.waiting.for.thread=waiting for {0} to release lock on {1}
threads.export.attribute.label.locked=locked {0}