1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-23 08:55:25 +02:00

Bug 369168: threadOSId is not extracted for non-pthread programs

This commit is contained in:
Marc Khouzam 2012-01-19 22:13:36 -05:00
parent c7adafb18b
commit 50640df3c0
2 changed files with 9 additions and 0 deletions

View file

@ -124,6 +124,7 @@ public class MIThread {
private static Pattern fgOsIdPattern1 = Pattern.compile("([Tt][Hh][Rr][Ee][Aa][Dd]\\s*)(0x[0-9a-fA-F]+|-?\\d+)(\\s*\\([Ll][Ww][Pp]\\s*)(\\d*)", 0); //$NON-NLS-1$
private static Pattern fgOsIdPattern2 = Pattern.compile("[Tt][Hh][Rr][Ee][Aa][Dd]\\s*\\d+\\.(\\d+)", 0); //$NON-NLS-1$
private static Pattern fgOsIdPattern3 = Pattern.compile("[Tt][Hh][Rr][Ee][Aa][Dd]\\s*(\\S+)", 0); //$NON-NLS-1$
private static Pattern fgOsIdPattern4 = Pattern.compile("[Pp][Rr][Oo][Cc][Ee][Ss][Ss]\\s*(\\S+)", 0); //$NON-NLS-1$
static String parseOsId(String str) {
// General format:
@ -132,6 +133,8 @@ public class MIThread {
// "Thread 162.32942"
// ^^^^^
// "thread abc123"
//
// "process 12345" => Linux without pthread. The process as one thread, the process thread.
// ^^^^^^
// PLEASE UPDATE MIThreadTests.java IF YOU TWEAK THIS CODE
@ -150,6 +153,11 @@ public class MIThread {
return matcher.group(1);
}
matcher = fgOsIdPattern4.matcher(str);
if (matcher.find()) {
return matcher.group(1);
}
return null;
}

View file

@ -12,6 +12,7 @@ public class MIThreadTests {
assertEquals("abc123", MIThread.parseOsId("Thread abc123"));
assertEquals("abc123", MIThread.parseOsId("thread abc123"));
assertEquals("abc123", MIThread.parseOsId("THREAD abc123"));
assertEquals("abc123", MIThread.parseOsId("process abc123"));
}
@Test