mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Bug 325552: GDB 7.x getOsId() pattern match too restrictive (DSF)
This commit is contained in:
parent
f7266e6cbb
commit
b78d754109
2 changed files with 24 additions and 1 deletions
|
@ -120,7 +120,7 @@ public class MIThread {
|
|||
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 String parseOsId(String str) {
|
||||
static String parseOsId(String str) {
|
||||
// General format:
|
||||
// "Thread 0xb7c8ab90 (LWP 7010)"
|
||||
// ^^^^
|
||||
|
@ -128,6 +128,7 @@ public class MIThread {
|
|||
// ^^^^^
|
||||
// "thread abc123"
|
||||
// ^^^^^^
|
||||
// PLEASE UPDATE MIThreadTests.java IF YOU TWEAK THIS CODE
|
||||
|
||||
Matcher matcher = fgOsIdPattern1.matcher(str);
|
||||
if (matcher.find()) {
|
||||
|
@ -153,6 +154,7 @@ public class MIThread {
|
|||
// General format:
|
||||
// "Thread 162.32942"
|
||||
// ^^^
|
||||
// PLEASE UPDATE MIThreadTests.java IF YOU TWEAK THIS CODE
|
||||
|
||||
Matcher matcher = fgIdPattern.matcher(str);
|
||||
if (matcher.find()) {
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
package org.eclipse.cdt.dsf.mi.service.command.output;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
public class MIThreadTests {
|
||||
@Test
|
||||
public void testOsIdParsing() {
|
||||
assertEquals("7010", MIThread.parseOsId("Thread 0xb7c8ab90 (LWP 7010)"));
|
||||
assertEquals("32942", MIThread.parseOsId("Thread 162.32942"));
|
||||
assertEquals("abc123", MIThread.parseOsId("Thread abc123"));
|
||||
assertEquals("abc123", MIThread.parseOsId("thread abc123"));
|
||||
assertEquals("abc123", MIThread.parseOsId("THREAD abc123"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParentIdParsing() {
|
||||
assertEquals("32942", MIThread.parseOsId("Thread 162.32942"));
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue