From 6a765aed3bfcf0a3f22af0ac1b7baf82faf3a135 Mon Sep 17 00:00:00 2001 From: Marc Khouzam Date: Tue, 23 Dec 2014 09:20:38 -0500 Subject: [PATCH] Bug 456807 - Update Tracepoint tests to handle both 32bit and 64bit architectures Change-Id: I4325fadfec95efc263b72db8dbe446de31154169 Signed-off-by: Marc Khouzam Reviewed-on: https://git.eclipse.org/r/39006 --- .../META-INF/MANIFEST.MF | 4 +- .../data/launch/src/Makefile | 4 +- .../data/launch/src/TracepointTestApp.cc | 187 +--- .../GDBRemoteTracepointsTest_7_0.java | 833 +++++------------- .../GDBRemoteTracepointsTest_7_4.java | 26 +- .../tests/tests_7_4/TraceFileTest_7_4.java | 19 +- 6 files changed, 264 insertions(+), 809 deletions(-) diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/META-INF/MANIFEST.MF b/dsf-gdb/org.eclipse.cdt.dsf.gdb/META-INF/MANIFEST.MF index 55913450d90..8a9511ea8b8 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/META-INF/MANIFEST.MF +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/META-INF/MANIFEST.MF @@ -24,10 +24,10 @@ Export-Package: org.eclipse.cdt.dsf.gdb, org.eclipse.cdt.dsf.gdb.internal.commands;x-friends:="org.eclipse.cdt.dsf.gdb.ui", org.eclipse.cdt.dsf.gdb.internal.memory;x-internal:=true, org.eclipse.cdt.dsf.gdb.internal.service.command.commands;x-internal:=true, + org.eclipse.cdt.dsf.gdb.internal.service.command.events;x-internal:=true, org.eclipse.cdt.dsf.gdb.internal.service.command.output;x-internal:=true, org.eclipse.cdt.dsf.gdb.internal.service.control;x-internal:=true, - org.eclipse.cdt.dsf.gdb.internal.service.command.events;x-internal:=true, - org.eclipse.cdt.dsf.gdb.internal.tracepointactions;x-friends:="org.eclipse.cdt.dsf.gdb.ui", + org.eclipse.cdt.dsf.gdb.internal.tracepointactions;x-friends:="org.eclipse.cdt.dsf.gdb.ui,org.eclipse.cdt.tests.dsf.gdb", org.eclipse.cdt.dsf.gdb.launching, org.eclipse.cdt.dsf.gdb.service, org.eclipse.cdt.dsf.gdb.service.command, diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/data/launch/src/Makefile b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/data/launch/src/Makefile index 7e36aaaa45a..38187687476 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/data/launch/src/Makefile +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/data/launch/src/Makefile @@ -12,8 +12,8 @@ COREFILE = $(BINDIR)/core CC = gcc CXX = g++ -CFLAGS = -g -CXXFLAGS = -g +CFLAGS = -g3 -O0 +CXXFLAGS = -g3 -O0 # Don't try to use pthread on Windows # The OS environment variable exists on Windows diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/data/launch/src/TracepointTestApp.cc b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/data/launch/src/TracepointTestApp.cc index ae8acdff923..9aac1214a98 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/data/launch/src/TracepointTestApp.cc +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/data/launch/src/TracepointTestApp.cc @@ -1,154 +1,41 @@ -#ifdef __MINGW32__ - #include // MinGW has no POSIX support; use MSVC runtime -#else - #include -#endif -#include -#include -#include "Sleep.h" -#define NUM_THREADS 5 +/* + * This program should be compiled with -g3 -O0 to try to always obtain + * the proper instruction sizes at the expected location. + * The instruction sizes matter for tests that set tracepoints + */ -int gIntVar = 543; -double gDoubleVar = 543.543; -char gCharVar = 'g'; -bool gBoolVar = false; - -int gIntArray[2] = {987, 654}; -double gDoubleArray[2] = {987.654, 654.321}; -char gCharArray[2] = {'g', 'd'}; -bool gBoolArray[2] = {true, false}; - -int *gIntPtr = &gIntVar; -double *gDoublePtr = &gDoubleVar; -char *gCharPtr = &gCharVar; -bool *gBoolPtr = &gBoolVar; - -int *gIntPtr2 = (int*)0x8; -double *gDoublePtr2 = (double*)0x5432; -char *gCharPtr2 = (char*)0x4321; -bool *gBoolPtr2 = (bool*)0x12ABCDEF; - -class bar { -public: - int d; -private: - int e[2]; -}; - -class bar2 { -public: - int f; -private: - int g[2]; -}; - -class foo: public bar, bar2 { -public: - int a[2]; - bar b; -private: - int c; -}; - -struct Z { -public: - int x; - int y; -}; -struct childStruct { -public: - Z z; -}; - -#ifdef __MINGW32__ -typedef unsigned int TID; -#else -typedef pthread_t TID; -#endif - - -#ifdef __MINGW32__ -unsigned int __stdcall testTracepoints(void *threadid) -#else -void *testTracepoints(void *threadid) -#endif -{ - long tid = (long)threadid; - printf("Hello World! It's me, thread #%ld!\n", tid); - - int lIntVar = 12345; - double lDoubleVar = 12345.12345; - char lCharVar = 'm'; - bool lBoolVar = false; - - int lIntArray[2] = {6789, 12345}; - double lDoubleArray[2] = {456.789, 12345.12345}; - char lCharArray[2] = {'i', 'm'}; - bool lBoolArray[2] = {true, false}; - - int *lIntPtr = &lIntVar; - double *lDoublePtr = &lDoubleVar; - char *lCharPtr = &lCharVar; - bool *lBoolPtr = &gBoolVar; - - int *lIntPtr2 = (int*)0x1; - double *lDoublePtr2 = (double*)0x2345; - char *lCharPtr2 = (char*)0x1234; - bool *lBoolPtr2 = (bool*)0x123ABCDE; - - int counter = 0; - // Small loop - for (counter=0; counter<10;) { - counter++; - } - - printf("counter is now #%d!\n", counter); - - // Large loop - for (; counter<10000;) { - counter++; - } - - SLEEP(2); // keep this thread around for a bit; the tests will check for its existence while the main thread is stopped at a breakpoint - -#ifdef __MINGW32__ - return 0; -#else - pthread_exit(NULL); -#endif -} - -int main() -{ - TID threads[NUM_THREADS]; - int t; - for(t=0; t < NUM_THREADS; t++) - { - printf("In main: creating thread %d\n", t); -#ifdef __MINGW32__ - { - uintptr_t rc = _beginthreadex(NULL, 0, testTracepoints, (void*)t, 0, &threads[t]); - SLEEP(1); // debugger should for sure receive thread creation event after stepping over this sleep; not guaranteed to happen simply stepping over the thread creation call - if (rc == 0) - { - printf("ERROR; _beginthreadex() failed. errno = %d\n", errno); - exit(-1); - } - } -#else - { - int rc = pthread_create(&threads[t], NULL, testTracepoints, (void *)t); - SLEEP(1); // debugger should for sure receive thread creation event after stepping over this sleep; not guaranteed to happen simply stepping over the thread creation call - if (rc) - { - printf("ERROR; return code from pthread_create() is %d\n", rc); - exit(-1); - } - } -#endif - } - - SLEEP(2); // keep this thread around for a bit +int bar() { return 0; } +int foo(int a) +{ + int x = a; + + while(x < 5) { // 2-byte on both 32bit and 64bit + + if (x != a) { // 3-byte on both 32bit and 64bit + + ++x; // 4-byte on both 32bit and 64bit + + bar(); // 5-byte on both 32bit and 64bit + + } + x++; + } + return 0; + +} // 1-byte on both 32bit and 64bit + +int gIntVar = 0; +bool gBoolVar = true; + +void lastCall() {} + +int main() { + + foo(0); + + lastCall(); // This method should be called last + return 0; +} diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_0/GDBRemoteTracepointsTest_7_0.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_0/GDBRemoteTracepointsTest_7_0.java index 36b71e998c1..4f7a9144577 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_0/GDBRemoteTracepointsTest_7_0.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_0/GDBRemoteTracepointsTest_7_0.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2010 Ericsson and others. + * Copyright (c) 2009, 2015 Ericsson and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -11,15 +11,17 @@ package org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_0; +import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; -import java.util.ArrayList; import java.util.HashMap; import java.util.Map; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.TimeUnit; import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor; -import org.eclipse.cdt.dsf.concurrent.RequestMonitor; +import org.eclipse.cdt.dsf.concurrent.Query; import org.eclipse.cdt.dsf.datamodel.DMContexts; import org.eclipse.cdt.dsf.debug.service.IBreakpoints; import org.eclipse.cdt.dsf.debug.service.IBreakpoints.IBreakpointDMContext; @@ -38,12 +40,12 @@ import org.eclipse.cdt.dsf.mi.service.MIBreakpoints; import org.eclipse.cdt.dsf.service.DsfServiceEventHandler; import org.eclipse.cdt.dsf.service.DsfServicesTracker; import org.eclipse.cdt.dsf.service.DsfSession; -import org.eclipse.cdt.tests.dsf.gdb.framework.AsyncCompletionWaitor; import org.eclipse.cdt.tests.dsf.gdb.framework.BackgroundRunner; import org.eclipse.cdt.tests.dsf.gdb.framework.BaseTestCase; import org.eclipse.cdt.tests.dsf.gdb.framework.SyncUtil; import org.eclipse.cdt.tests.dsf.gdb.launching.TestsPlugin; import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants; +import org.junit.BeforeClass; import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; @@ -65,12 +67,11 @@ public class GDBRemoteTracepointsTest_7_0 extends BaseTestCase { // private int fTotalTracingBufferSize = 0; protected static final String SOURCE_FILE = "TracepointTestApp.cc"; - protected static final String METHOD_NAME = "testTracepoints"; - protected static final int LINE_NUMBER_1 = 97; - protected static final int LINE_NUMBER_2 = 75; - protected static final int LINE_NUMBER_3 = 76; - protected static final int LINE_NUMBER_4 = 85; - protected static final int LINE_LOOP_2 = 109; + protected static final int LINE_NUMBER_1_BYTE_INSTR = 28; + protected static final int LINE_NUMBER_2_BYTE_INSTR = 15; + protected static final int LINE_NUMBER_3_BYTE_INSTR = 17; + protected static final int LINE_NUMBER_4_BYTE_INSTR = 19; + protected static final int LINE_NUMBER_5_BYTE_INSTR = 21; protected static final String NO_CONDITION = ""; protected static final String NO_COMMANDS = ""; // private static final int LAST_LINE_NUMBER = 94; @@ -78,13 +79,14 @@ public class GDBRemoteTracepointsTest_7_0 extends BaseTestCase { // private static final int TOTAL_FRAMES_TO_BE_COLLECTED = 1 + 1 + 10 + 1 + 10000; protected final static int[] PASS_COUNTS = {12, 2, 32, 6, 128, 0, 0, 0, 0, 0, 0, 0}; - protected final static String[] CONDITIONS = {"gIntVar == 543", "gBoolVar == false", "counter == 3", "counter > 4", "counter > 2 && lIntVar == 12345"}; + protected final static String[] CONDITIONS = {"gIntVar == 543", "gBoolVar == false", "x == 3", "x > 4", "x > 2 && gIntVar == 12345"}; protected static CollectAction[] COLLECT_ACTIONS = new CollectAction[10]; protected static EvaluateAction[] EVAL_ACTIONS = new EvaluateAction[10]; // private static WhileSteppingAction[] STEPPING_ACTION_1 = new WhileSteppingAction[3]; - static { + @BeforeClass + public static void initializeActions() { TracepointActionManager tracepointActionMgr = TracepointActionManager.getInstance(); int index = 0; @@ -101,8 +103,8 @@ public class GDBRemoteTracepointsTest_7_0 extends BaseTestCase { index++; COLLECT_ACTIONS[index] = new CollectAction(); - COLLECT_ACTIONS[index].setCollectString("$locals, counter, $reg"); - COLLECT_ACTIONS[index].setName("Collect locals, counter and reg"); + COLLECT_ACTIONS[index].setCollectString("$locals, x, $reg"); + COLLECT_ACTIONS[index].setName("Collect locals, x and reg"); tracepointActionMgr.addAction(COLLECT_ACTIONS[index]); index++; @@ -113,8 +115,8 @@ public class GDBRemoteTracepointsTest_7_0 extends BaseTestCase { index++; COLLECT_ACTIONS[index] = new CollectAction(); - COLLECT_ACTIONS[index].setCollectString("counter, $locals"); - COLLECT_ACTIONS[index].setName("Collect counter, locals"); + COLLECT_ACTIONS[index].setCollectString("x, $locals"); + COLLECT_ACTIONS[index].setName("Collect x, locals"); tracepointActionMgr.addAction(COLLECT_ACTIONS[index]); index++; @@ -289,7 +291,8 @@ public class GDBRemoteTracepointsTest_7_0 extends BaseTestCase { protected boolean acceptsFastTpOnFourBytes() { // Starting with GDB 7.4, fast tracepoints can be set - // on 4-byte instructions. Before that, it was on 5-bytes or more. + // on 4-byte instructions on a 32bit machine. Before that, or on 64bits, + // it was on 5-bytes or more. return false; } @@ -297,120 +300,97 @@ public class GDBRemoteTracepointsTest_7_0 extends BaseTestCase { // Breakpoint service methods (to use with tracepoints). // ********************************************************************* - protected IBreakpointDMContext insertBreakpoint(final IBreakpointsTargetDMContext context, - final Map attributes) throws InterruptedException - { - final AsyncCompletionWaitor wait = new AsyncCompletionWaitor(); - - fBreakpointService.getExecutor().submit(new Runnable() { - @Override - public void run() { - fBreakpointService.insertBreakpoint(context, attributes, - new DataRequestMonitor(fBreakpointService.getExecutor(), null) { - @Override - protected void handleCompleted() { - wait.setReturnInfo(getData()); - wait.waitFinished(getStatus()); - } - }); - } - }); - - // Wait for the result and return the breakpoint id - wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER); - assertTrue(wait.getMessage(), wait.isOK()); - - return (IBreakpointDMContext)wait.getReturnInfo(); - } - - protected void removeBreakpoint(final IBreakpointDMContext breakpoint) throws InterruptedException + protected IBreakpointDMContext insertBreakpoint(final IBreakpointsTargetDMContext context, final Map attributes) + throws Throwable { - final AsyncCompletionWaitor wait = new AsyncCompletionWaitor(); - - fBreakpointService.getExecutor().submit(new Runnable() { + Query query = new Query() { @Override - public void run() { - fBreakpointService.removeBreakpoint(breakpoint, - new RequestMonitor(fBreakpointService.getExecutor(), null) { - @Override - protected void handleCompleted() { - wait.waitFinished(getStatus()); - } - }); + protected void execute(final DataRequestMonitor rm) { + fBreakpointService.insertBreakpoint(context, attributes, rm); } - }); + }; - wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER); - assertTrue(wait.getMessage(), wait.isOK()); + fBreakpointService.getExecutor().execute(query); + try { + return query.get(1, TimeUnit.SECONDS); + } catch (ExecutionException e) { + assert false : e.getCause().getMessage(); + } + return null; } - protected void updateBreakpoint(final IBreakpointDMContext breakpoint, - final Map delta) throws InterruptedException - { - final AsyncCompletionWaitor wait = new AsyncCompletionWaitor(); - - fBreakpointService.getExecutor().submit(new Runnable() { - @Override - public void run() { - fBreakpointService.updateBreakpoint(breakpoint, delta, - new RequestMonitor(fBreakpointService.getExecutor(), null) { - @Override - protected void handleCompleted() { - wait.waitFinished(getStatus()); - } - }); - } - }); - - wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER); - assertTrue(wait.getMessage(), wait.isOK()); - } - - protected IBreakpointDMData getBreakpoint(final IBreakpointDMContext breakpoint) throws InterruptedException + protected void removeBreakpoint(final IBreakpointDMContext breakpoint) + throws Throwable { - final AsyncCompletionWaitor wait = new AsyncCompletionWaitor(); - - fBreakpointService.getExecutor().submit(new Runnable() { + Query query = new Query() { @Override - public void run() { - fBreakpointService.getBreakpointDMData(breakpoint, - new DataRequestMonitor(fBreakpointService.getExecutor(), null) { - @Override - protected void handleCompleted() { - wait.setReturnInfo(getData()); - wait.waitFinished(getStatus()); - } - }); + protected void execute(final DataRequestMonitor rm) { + fBreakpointService.removeBreakpoint(breakpoint, rm); } - }); + }; - wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER); - assertTrue(wait.getMessage(), wait.isOK()); - - return (IBreakpointDMData)wait.getReturnInfo(); + fBreakpointService.getExecutor().execute(query); + try { + query.get(1, TimeUnit.SECONDS); + } catch (ExecutionException e) { + assert false : e.getCause().getMessage(); + } } - protected IBreakpointDMContext[] getBreakpoints(final IBreakpointsTargetDMContext context) throws InterruptedException + protected void updateBreakpoint(final IBreakpointDMContext breakpoint, final Map delta) + throws Throwable { - final AsyncCompletionWaitor wait = new AsyncCompletionWaitor(); - - fBreakpointService.getExecutor().submit(new Runnable() { + Query query = new Query() { @Override - public void run() { - fBreakpointService.getBreakpoints(context, new DataRequestMonitor(fBreakpointService.getExecutor(), null) { - @Override - protected void handleCompleted() { - wait.setReturnInfo(getData()); - wait.waitFinished(getStatus()); - } - }); + protected void execute(DataRequestMonitor rm) { + fBreakpointService.updateBreakpoint(breakpoint, delta, rm); } - }); + }; - wait.waitUntilDone(AsyncCompletionWaitor.WAIT_FOREVER); - assertTrue(wait.getMessage(), wait.isOK()); + fBreakpointService.getExecutor().execute(query); + try { + query.get(1, TimeUnit.SECONDS); + } catch (ExecutionException e) { + assert false : e.getCause().getMessage(); + } + } - return (IBreakpointDMContext[])wait.getReturnInfo(); + protected IBreakpointDMData getBreakpoint(final IBreakpointDMContext breakpoint) + throws Throwable + { + Query query = new Query() { + @Override + protected void execute(DataRequestMonitor rm) { + fBreakpointService.getBreakpointDMData(breakpoint, rm); + } + }; + + fBreakpointService.getExecutor().execute(query); + try { + return query.get(1, TimeUnit.SECONDS); + } catch (ExecutionException e) { + assert false : e.getCause().getMessage(); + } + return null; + } + + protected IBreakpointDMContext[] getBreakpoints(final IBreakpointsTargetDMContext context) + throws Throwable + { + Query query = new Query() { + @Override + protected void execute(DataRequestMonitor rm) { + fBreakpointService.getBreakpoints(context, rm); + } + }; + + fBreakpointService.getExecutor().execute(query); + try { + return query.get(1, TimeUnit.SECONDS); + } catch (ExecutionException e) { + assert false : e.getCause().getMessage(); + } + return null; } // ********************************************************************* @@ -607,6 +587,10 @@ public class GDBRemoteTracepointsTest_7_0 extends BaseTestCase { String commands; boolean isFastTp; + public TracepointData(int line, String cond, int pass, boolean isEnabled, String cmds, boolean fast) { + this(SOURCE_FILE, line, cond, pass, isEnabled, cmds, fast); + } + public TracepointData(String file, int line, String cond, int pass, boolean isEnabled, String cmds, boolean fast) { sourceFile = file; lineNumber = line; @@ -657,6 +641,52 @@ public class GDBRemoteTracepointsTest_7_0 extends BaseTestCase { } } + protected void checkTracepoints(boolean useCond, boolean useCount, boolean enabled, boolean useActions) + throws Throwable { + TracepointData[] dataArray = new TracepointData[] { + new TracepointData(LINE_NUMBER_1_BYTE_INSTR, useCond ? CONDITIONS[0] : NO_CONDITION, useCount ? PASS_COUNTS[0] : 0, enabled, useActions ? COLLECT_ACTIONS[0].toString() : NO_COMMANDS, false), + new TracepointData(LINE_NUMBER_2_BYTE_INSTR, useCond ? CONDITIONS[1] : NO_CONDITION, useCount ? PASS_COUNTS[1] : 0, enabled, useActions ? COLLECT_ACTIONS[1].toString() : NO_COMMANDS, false), + new TracepointData(LINE_NUMBER_3_BYTE_INSTR, useCond ? CONDITIONS[2] : NO_CONDITION, useCount ? PASS_COUNTS[2] : 0, enabled, useActions ? COLLECT_ACTIONS[2].toString() : NO_COMMANDS, false), + new TracepointData(LINE_NUMBER_4_BYTE_INSTR, useCond ? CONDITIONS[3] : NO_CONDITION, useCount ? PASS_COUNTS[3] : 0, enabled, useActions ? COLLECT_ACTIONS[3].toString() : NO_COMMANDS, acceptsFastTpOnFourBytes()), + new TracepointData(LINE_NUMBER_5_BYTE_INSTR, useCond ? CONDITIONS[4] : NO_CONDITION, useCount ? PASS_COUNTS[4] : 0, enabled, useActions ? COLLECT_ACTIONS[4].toString() : NO_COMMANDS, true), + }; + + checkTracepoints(dataArray); + } + + protected void createTracepoints(boolean useCond, boolean useCount, boolean enabled, boolean useActions) + throws Throwable + { + Map attributes = null; + + int[] lineNumbers = { + LINE_NUMBER_1_BYTE_INSTR, + LINE_NUMBER_2_BYTE_INSTR, + LINE_NUMBER_3_BYTE_INSTR, + LINE_NUMBER_4_BYTE_INSTR, + LINE_NUMBER_5_BYTE_INSTR }; + + for (int i = 0; i < lineNumbers.length; i++) { + attributes = new HashMap(); + attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT); + attributes.put(MIBreakpoints.FILE_NAME, SOURCE_FILE); + attributes.put(MIBreakpoints.LINE_NUMBER, lineNumbers[i]); + if (!enabled) attributes.put(MIBreakpoints.IS_ENABLED, enabled); + if (useCount) attributes.put(MIBreakpoints.PASS_COUNT, PASS_COUNTS[i]); + if (useCond) attributes.put(MIBreakpoints.CONDITION, CONDITIONS[i]); + if (useActions) attributes.put(MIBreakpoints.COMMANDS, COLLECT_ACTIONS[i].getName()); + + fTracepoints[i] = insertBreakpoint(fBreakpointsDmc, attributes); + + waitForBreakpointEvent(); + assertEquals("Incorrect number of breakpoint events", 1, fBreakpointEventCount); + assertEquals("Incorrect number of breakpoint added events", 1, getBreakpointEventCount(BP_ADDED)); + clearEventCounters(); + } + + checkTracepoints(useCond, useCount, enabled, useActions); + } + /** * This test makes sure that the tracing status is correct when we start. * It also stores the total buffer size to be used by other tests. @@ -679,87 +709,7 @@ public class GDBRemoteTracepointsTest_7_0 extends BaseTestCase { */ @Test public void createTracepoints() throws Throwable { - - Map attributes = null; - int index = 0; - - // First tracepoint (will be a normal tracepoint) - attributes = new HashMap(); - attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT); - attributes.put(MIBreakpoints.FUNCTION, "*"+METHOD_NAME); - fTracepoints[index++] = insertBreakpoint(fBreakpointsDmc, attributes); - - waitForBreakpointEvent(); - assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " - + fBreakpointEventCount, fBreakpointEventCount == 1); - assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " - + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); - clearEventCounters(); - - // Second tracepoint (will be a normal tracepoint) - attributes = new HashMap(); - attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT); - attributes.put(MIBreakpoints.FILE_NAME, SOURCE_FILE); - attributes.put(MIBreakpoints.FUNCTION, METHOD_NAME); - fTracepoints[index++] = insertBreakpoint(fBreakpointsDmc, attributes); - - waitForBreakpointEvent(); - assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " - + fBreakpointEventCount, fBreakpointEventCount == 1); - assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " - + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); - clearEventCounters(); - - // Third tracepoint (will be a fast tracepoint) - attributes = new HashMap(); - attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT); - attributes.put(MIBreakpoints.FILE_NAME, SOURCE_FILE); - attributes.put(MIBreakpoints.LINE_NUMBER, LINE_NUMBER_4); - fTracepoints[index++] = insertBreakpoint(fBreakpointsDmc, attributes); - - waitForBreakpointEvent(); - assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " - + fBreakpointEventCount, fBreakpointEventCount == 1); - assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " - + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); - clearEventCounters(); - - // Forth tracepoint (will be a fast tracepoint) - attributes = new HashMap(); - attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT); - attributes.put(MIBreakpoints.FILE_NAME, SOURCE_FILE); - attributes.put(MIBreakpoints.LINE_NUMBER, LINE_NUMBER_1); - fTracepoints[index++] = insertBreakpoint(fBreakpointsDmc, attributes); - - waitForBreakpointEvent(); - assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " - + fBreakpointEventCount, fBreakpointEventCount == 1); - assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " - + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); - clearEventCounters(); - - // Fifth tracepoint (will be a normal tracepoint) - attributes = new HashMap(); - attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT); - attributes.put(MIBreakpoints.FILE_NAME, SOURCE_FILE); - attributes.put(MIBreakpoints.LINE_NUMBER, LINE_LOOP_2); - fTracepoints[index++] = insertBreakpoint(fBreakpointsDmc, attributes); - - waitForBreakpointEvent(); - assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " - + fBreakpointEventCount, fBreakpointEventCount == 1); - assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " - + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); - clearEventCounters(); - - ArrayList dataArray = new ArrayList(); - dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_2, NO_CONDITION, 0, true, NO_COMMANDS, false)); - dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_3, NO_CONDITION, 0, true, NO_COMMANDS, false)); - dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_4, NO_CONDITION, 0, true, NO_COMMANDS, true)); - dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_1, NO_CONDITION, 0, true, NO_COMMANDS, true)); - dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_2, NO_CONDITION, 0, true, NO_COMMANDS, acceptsFastTpOnFourBytes())); - - checkTracepoints(dataArray.toArray(new TracepointData[dataArray.size()])); + createTracepoints(false, false, true, false); } /** @@ -795,14 +745,7 @@ public class GDBRemoteTracepointsTest_7_0 extends BaseTestCase { updateBreakpoint(tp, delta); } - ArrayList dataArray = new ArrayList(); - dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_2, NO_CONDITION, 0, false, NO_COMMANDS, false)); - dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_3, NO_CONDITION, 0, false, NO_COMMANDS, false)); - dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_4, NO_CONDITION, 0, false, NO_COMMANDS, true)); - dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_1, NO_CONDITION, 0, false, NO_COMMANDS, true)); - dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_2, NO_CONDITION, 0, false, NO_COMMANDS, acceptsFastTpOnFourBytes())); - - checkTracepoints(dataArray.toArray(new TracepointData[dataArray.size()])); + checkTracepoints(false, false, false, false); } /** @@ -820,14 +763,7 @@ public class GDBRemoteTracepointsTest_7_0 extends BaseTestCase { updateBreakpoint(tp, delta); } - ArrayList dataArray = new ArrayList(); - dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_2, NO_CONDITION, 0, true, NO_COMMANDS, false)); - dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_3, NO_CONDITION, 0, true, NO_COMMANDS, false)); - dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_4, NO_CONDITION, 0, true, NO_COMMANDS, true)); - dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_1, NO_CONDITION, 0, true, NO_COMMANDS, true)); - dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_2, NO_CONDITION, 0, true, NO_COMMANDS, acceptsFastTpOnFourBytes())); - - checkTracepoints(dataArray.toArray(new TracepointData[dataArray.size()])); + checkTracepoints(false, false, true, false); } /** @@ -846,14 +782,7 @@ public class GDBRemoteTracepointsTest_7_0 extends BaseTestCase { updateBreakpoint(fTracepoints[i], delta); } - ArrayList dataArray = new ArrayList(); - dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_2, NO_CONDITION, PASS_COUNTS[0], true, NO_COMMANDS, false)); - dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_3, NO_CONDITION, PASS_COUNTS[1], true, NO_COMMANDS, false)); - dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_4, NO_CONDITION, PASS_COUNTS[2], true, NO_COMMANDS, true)); - dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_1, NO_CONDITION, PASS_COUNTS[3], true, NO_COMMANDS, true)); - dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_2, NO_CONDITION, PASS_COUNTS[4], true, NO_COMMANDS, acceptsFastTpOnFourBytes())); - - checkTracepoints(dataArray.toArray(new TracepointData[dataArray.size()])); + checkTracepoints(false, true, true, false); } /** @@ -872,15 +801,7 @@ public class GDBRemoteTracepointsTest_7_0 extends BaseTestCase { updateBreakpoint(fTracepoints[i], delta); } - ArrayList dataArray = new ArrayList(); - dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_2, CONDITIONS[0], 0, true, NO_COMMANDS, false)); - dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_3, CONDITIONS[1], 0, true, NO_COMMANDS, false)); - dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_4, CONDITIONS[2], 0, true, NO_COMMANDS, true)); - dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_1, CONDITIONS[3], 0, true, NO_COMMANDS, true)); - dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_2, CONDITIONS[4], 0, true, NO_COMMANDS, acceptsFastTpOnFourBytes())); - - checkTracepoints(dataArray.toArray(new TracepointData[dataArray.size()])); - + checkTracepoints(true, false, true, false); } /** @@ -899,15 +820,7 @@ public class GDBRemoteTracepointsTest_7_0 extends BaseTestCase { updateBreakpoint(fTracepoints[i], delta); } - ArrayList dataArray = new ArrayList(); - dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_2, NO_CONDITION, 0, true, COLLECT_ACTIONS[0].toString(), false)); - dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_3, NO_CONDITION, 0, true, COLLECT_ACTIONS[1].toString(), false)); - dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_4, NO_CONDITION, 0, true, COLLECT_ACTIONS[2].toString(), true)); - dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_1, NO_CONDITION, 0, true, COLLECT_ACTIONS[3].toString(), true)); - dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_2, NO_CONDITION, 0, true, COLLECT_ACTIONS[4].toString(), acceptsFastTpOnFourBytes())); - - checkTracepoints(dataArray.toArray(new TracepointData[dataArray.size()])); - + checkTracepoints(false, false, true, true); } /** @@ -915,60 +828,7 @@ public class GDBRemoteTracepointsTest_7_0 extends BaseTestCase { */ @Test public void createTracepointDisabled() throws Throwable { - Map attributes = null; - int index = 0; - - // First tracepoint will be a normal tracepoint - attributes = new HashMap(); - attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT); - attributes.put(MIBreakpoints.FILE_NAME, SOURCE_FILE); - attributes.put(MIBreakpoints.LINE_NUMBER, LINE_LOOP_2); - attributes.put(MIBreakpoints.IS_ENABLED, false); - fTracepoints[index++] = insertBreakpoint(fBreakpointsDmc, attributes); - - waitForBreakpointEvent(); - assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " - + fBreakpointEventCount, fBreakpointEventCount == 1); - assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " - + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); - clearEventCounters(); - - // Second tracepoint will be a fast tracepoint - attributes = new HashMap(); - attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT); - attributes.put(MIBreakpoints.FILE_NAME, SOURCE_FILE); - attributes.put(MIBreakpoints.LINE_NUMBER, LINE_NUMBER_1); - attributes.put(MIBreakpoints.IS_ENABLED, false); - fTracepoints[index++] = insertBreakpoint(fBreakpointsDmc, attributes); - - waitForBreakpointEvent(); - assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " - + fBreakpointEventCount, fBreakpointEventCount == 1); - assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " - + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); - clearEventCounters(); - - // Third tracepoint (will be a normal tracepoint) - attributes = new HashMap(); - attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT); - attributes.put(MIBreakpoints.FILE_NAME, SOURCE_FILE); - attributes.put(MIBreakpoints.FUNCTION, METHOD_NAME); - attributes.put(MIBreakpoints.IS_ENABLED, false); - fTracepoints[index++] = insertBreakpoint(fBreakpointsDmc, attributes); - - waitForBreakpointEvent(); - assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " - + fBreakpointEventCount, fBreakpointEventCount == 1); - assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " - + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); - clearEventCounters(); - - ArrayList dataArray = new ArrayList(); - dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_2, NO_CONDITION, 0, false, NO_COMMANDS, acceptsFastTpOnFourBytes())); - dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_1, NO_CONDITION, 0, false, NO_COMMANDS, true)); - dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_3, NO_CONDITION, 0, false, NO_COMMANDS, false)); - - checkTracepoints(dataArray.toArray(new TracepointData[dataArray.size()])); + createTracepoints(false, false, false, false); } /** @@ -976,60 +836,7 @@ public class GDBRemoteTracepointsTest_7_0 extends BaseTestCase { */ @Test public void createTracepointWithPasscount() throws Throwable { - Map attributes = null; - int index = 0; - - // First tracepoint will be a normal tracepoint - attributes = new HashMap(); - attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT); - attributes.put(MIBreakpoints.FILE_NAME, SOURCE_FILE); - attributes.put(MIBreakpoints.LINE_NUMBER, LINE_LOOP_2); - attributes.put(MIBreakpoints.PASS_COUNT, PASS_COUNTS[0]); - fTracepoints[index++] = insertBreakpoint(fBreakpointsDmc, attributes); - - waitForBreakpointEvent(); - assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " - + fBreakpointEventCount, fBreakpointEventCount == 1); - assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " - + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); - clearEventCounters(); - - // Second tracepoint will be a fast tracepoint - attributes = new HashMap(); - attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT); - attributes.put(MIBreakpoints.FILE_NAME, SOURCE_FILE); - attributes.put(MIBreakpoints.LINE_NUMBER, LINE_NUMBER_1); - attributes.put(MIBreakpoints.PASS_COUNT, PASS_COUNTS[1]); - fTracepoints[index++] = insertBreakpoint(fBreakpointsDmc, attributes); - - waitForBreakpointEvent(); - assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " - + fBreakpointEventCount, fBreakpointEventCount == 1); - assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " - + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); - clearEventCounters(); - - // Third tracepoint (will be a normal tracepoint) - attributes = new HashMap(); - attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT); - attributes.put(MIBreakpoints.FILE_NAME, SOURCE_FILE); - attributes.put(MIBreakpoints.FUNCTION, METHOD_NAME); - attributes.put(MIBreakpoints.PASS_COUNT, PASS_COUNTS[2]); - fTracepoints[index++] = insertBreakpoint(fBreakpointsDmc, attributes); - - waitForBreakpointEvent(); - assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " - + fBreakpointEventCount, fBreakpointEventCount == 1); - assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " - + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); - clearEventCounters(); - - ArrayList dataArray = new ArrayList(); - dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_2, NO_CONDITION, PASS_COUNTS[0], true, NO_COMMANDS, acceptsFastTpOnFourBytes())); - dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_1, NO_CONDITION, PASS_COUNTS[1], true, NO_COMMANDS, true)); - dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_3, NO_CONDITION, PASS_COUNTS[2], true, NO_COMMANDS, false)); - - checkTracepoints(dataArray.toArray(new TracepointData[dataArray.size()])); + createTracepoints(false, true, true, false); } /** @@ -1037,60 +844,7 @@ public class GDBRemoteTracepointsTest_7_0 extends BaseTestCase { */ @Test public void createTracepointWithCondition() throws Throwable { - Map attributes = null; - int index = 0; - - // First tracepoint will be a normal tracepoint - attributes = new HashMap(); - attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT); - attributes.put(MIBreakpoints.FILE_NAME, SOURCE_FILE); - attributes.put(MIBreakpoints.LINE_NUMBER, LINE_LOOP_2); - attributes.put(MIBreakpoints.CONDITION, CONDITIONS[0]); - fTracepoints[index++] = insertBreakpoint(fBreakpointsDmc, attributes); - - waitForBreakpointEvent(); - assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " - + fBreakpointEventCount, fBreakpointEventCount == 1); - assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " - + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); - clearEventCounters(); - - // Second tracepoint will be a fast tracepoint - attributes = new HashMap(); - attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT); - attributes.put(MIBreakpoints.FILE_NAME, SOURCE_FILE); - attributes.put(MIBreakpoints.LINE_NUMBER, LINE_NUMBER_1); - attributes.put(MIBreakpoints.CONDITION, CONDITIONS[1]); - fTracepoints[index++] = insertBreakpoint(fBreakpointsDmc, attributes); - - waitForBreakpointEvent(); - assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " - + fBreakpointEventCount, fBreakpointEventCount == 1); - assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " - + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); - clearEventCounters(); - - // Third tracepoint (will be a normal tracepoint) - attributes = new HashMap(); - attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT); - attributes.put(MIBreakpoints.FILE_NAME, SOURCE_FILE); - attributes.put(MIBreakpoints.FUNCTION, METHOD_NAME); - attributes.put(MIBreakpoints.CONDITION, CONDITIONS[2]); - fTracepoints[index++] = insertBreakpoint(fBreakpointsDmc, attributes); - - waitForBreakpointEvent(); - assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " - + fBreakpointEventCount, fBreakpointEventCount == 1); - assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " - + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); - clearEventCounters(); - - ArrayList dataArray = new ArrayList(); - dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_2, CONDITIONS[0], 0, true, NO_COMMANDS, acceptsFastTpOnFourBytes())); - dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_1, CONDITIONS[1], 0, true, NO_COMMANDS, true)); - dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_3, CONDITIONS[2], 0, true, NO_COMMANDS, false)); - - checkTracepoints(dataArray.toArray(new TracepointData[dataArray.size()])); + createTracepoints(true, false, true, false); } /** @@ -1098,60 +852,7 @@ public class GDBRemoteTracepointsTest_7_0 extends BaseTestCase { */ @Test public void createTracepointWithCommand() throws Throwable { - Map attributes = null; - int index = 0; - - // First tracepoint will be a normal tracepoint - attributes = new HashMap(); - attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT); - attributes.put(MIBreakpoints.FILE_NAME, SOURCE_FILE); - attributes.put(MIBreakpoints.LINE_NUMBER, LINE_LOOP_2); - attributes.put(MIBreakpoints.COMMANDS, COLLECT_ACTIONS[0].getName()); - fTracepoints[index++] = insertBreakpoint(fBreakpointsDmc, attributes); - - waitForBreakpointEvent(); - assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " - + fBreakpointEventCount, fBreakpointEventCount == 1); - assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " - + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); - clearEventCounters(); - - // Second tracepoint will be a fast tracepoint - attributes = new HashMap(); - attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT); - attributes.put(MIBreakpoints.FILE_NAME, SOURCE_FILE); - attributes.put(MIBreakpoints.LINE_NUMBER, LINE_NUMBER_1); - attributes.put(MIBreakpoints.COMMANDS, COLLECT_ACTIONS[1].getName()); - fTracepoints[index++] = insertBreakpoint(fBreakpointsDmc, attributes); - - waitForBreakpointEvent(); - assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " - + fBreakpointEventCount, fBreakpointEventCount == 1); - assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " - + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); - clearEventCounters(); - - // Third tracepoint (will be a normal tracepoint) - attributes = new HashMap(); - attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT); - attributes.put(MIBreakpoints.FILE_NAME, SOURCE_FILE); - attributes.put(MIBreakpoints.FUNCTION, METHOD_NAME); - attributes.put(MIBreakpoints.COMMANDS, COLLECT_ACTIONS[2].getName()); - fTracepoints[index++] = insertBreakpoint(fBreakpointsDmc, attributes); - - waitForBreakpointEvent(); - assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " - + fBreakpointEventCount, fBreakpointEventCount == 1); - assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " - + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); - clearEventCounters(); - - ArrayList dataArray = new ArrayList(); - dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_2, NO_CONDITION, 0, true, COLLECT_ACTIONS[0].toString(), acceptsFastTpOnFourBytes())); - dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_1, NO_CONDITION, 0, true, COLLECT_ACTIONS[1].toString(), true)); - dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_3, NO_CONDITION, 0, true, COLLECT_ACTIONS[2].toString(), false)); - - checkTracepoints(dataArray.toArray(new TracepointData[dataArray.size()])); + createTracepoints(false, false, true, true); } /** @@ -1159,78 +860,64 @@ public class GDBRemoteTracepointsTest_7_0 extends BaseTestCase { */ @Test public void createTracepointWithMultipleCommands() throws Throwable { - Map attributes = null; - int index = 0; - - // First tracepoint will be a normal tracepoint - attributes = new HashMap(); - attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT); - attributes.put(MIBreakpoints.FILE_NAME, SOURCE_FILE); - attributes.put(MIBreakpoints.LINE_NUMBER, LINE_LOOP_2); + String commandsNames1 = COLLECT_ACTIONS[0].getName() + TracepointActionManager.TRACEPOINT_ACTION_DELIMITER + COLLECT_ACTIONS[1].getName() + TracepointActionManager.TRACEPOINT_ACTION_DELIMITER + - COLLECT_ACTIONS[2].getName(); + COLLECT_ACTIONS[3].getName(); String commandsResult1 = COLLECT_ACTIONS[0].toString() + TracepointActionManager.TRACEPOINT_ACTION_DELIMITER + COLLECT_ACTIONS[1].toString() + TracepointActionManager.TRACEPOINT_ACTION_DELIMITER + - COLLECT_ACTIONS[2].toString(); - attributes.put(MIBreakpoints.COMMANDS, commandsNames1); - fTracepoints[index++] = insertBreakpoint(fBreakpointsDmc, attributes); + COLLECT_ACTIONS[3].toString(); - waitForBreakpointEvent(); - assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " - + fBreakpointEventCount, fBreakpointEventCount == 1); - assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " - + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); - clearEventCounters(); - - // Second tracepoint will be a fast tracepoint - attributes = new HashMap(); - attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT); - attributes.put(MIBreakpoints.FILE_NAME, SOURCE_FILE); - attributes.put(MIBreakpoints.LINE_NUMBER, LINE_NUMBER_1); String commandsNames2 = COLLECT_ACTIONS[2].getName() + TracepointActionManager.TRACEPOINT_ACTION_DELIMITER + COLLECT_ACTIONS[2].getName() + TracepointActionManager.TRACEPOINT_ACTION_DELIMITER + COLLECT_ACTIONS[1].getName(); String commandsResult2 = COLLECT_ACTIONS[2].toString() + TracepointActionManager.TRACEPOINT_ACTION_DELIMITER + COLLECT_ACTIONS[2].toString() + TracepointActionManager.TRACEPOINT_ACTION_DELIMITER + COLLECT_ACTIONS[1].toString(); - attributes.put(MIBreakpoints.COMMANDS, commandsNames2); - fTracepoints[index++] = insertBreakpoint(fBreakpointsDmc, attributes); - waitForBreakpointEvent(); - assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " - + fBreakpointEventCount, fBreakpointEventCount == 1); - assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " - + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); - clearEventCounters(); - - // Third tracepoint (will be a normal tracepoint) - attributes = new HashMap(); - attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT); - attributes.put(MIBreakpoints.FILE_NAME, SOURCE_FILE); - attributes.put(MIBreakpoints.FUNCTION, METHOD_NAME); - String commandsNames3 = COLLECT_ACTIONS[2].getName() + TracepointActionManager.TRACEPOINT_ACTION_DELIMITER + - COLLECT_ACTIONS[2].getName() + TracepointActionManager.TRACEPOINT_ACTION_DELIMITER + + String commandsNames3 = COLLECT_ACTIONS[4].getName() + TracepointActionManager.TRACEPOINT_ACTION_DELIMITER + + COLLECT_ACTIONS[0].getName() + TracepointActionManager.TRACEPOINT_ACTION_DELIMITER + COLLECT_ACTIONS[1].getName(); - String commandsResult3 = COLLECT_ACTIONS[2].toString() + TracepointActionManager.TRACEPOINT_ACTION_DELIMITER + - COLLECT_ACTIONS[2].toString() + TracepointActionManager.TRACEPOINT_ACTION_DELIMITER + + String commandsResult3 = COLLECT_ACTIONS[4].toString() + TracepointActionManager.TRACEPOINT_ACTION_DELIMITER + + COLLECT_ACTIONS[0].toString() + TracepointActionManager.TRACEPOINT_ACTION_DELIMITER + COLLECT_ACTIONS[1].toString(); - attributes.put(MIBreakpoints.COMMANDS, commandsNames3); - fTracepoints[index++] = insertBreakpoint(fBreakpointsDmc, attributes); + + String cmdNames[] = new String[] { commandsNames1, COLLECT_ACTIONS[0].getName(), commandsNames2, COLLECT_ACTIONS[2].getName(), commandsNames3 }; + String cmdResults[] = new String[] { commandsResult1, COLLECT_ACTIONS[0].toString(), commandsResult2, COLLECT_ACTIONS[2].toString(), commandsResult3}; + + Map attributes = null; - waitForBreakpointEvent(); - assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " - + fBreakpointEventCount, fBreakpointEventCount == 1); - assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " - + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); - clearEventCounters(); + int[] lineNumbers = { + LINE_NUMBER_1_BYTE_INSTR, + LINE_NUMBER_2_BYTE_INSTR, + LINE_NUMBER_3_BYTE_INSTR, + LINE_NUMBER_4_BYTE_INSTR, + LINE_NUMBER_5_BYTE_INSTR }; + + for (int i = 0; i < lineNumbers.length; i++) { + attributes = new HashMap(); + attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT); + attributes.put(MIBreakpoints.FILE_NAME, SOURCE_FILE); + attributes.put(MIBreakpoints.LINE_NUMBER, lineNumbers[i]); + attributes.put(MIBreakpoints.COMMANDS, cmdNames[i]); + + fTracepoints[i] = insertBreakpoint(fBreakpointsDmc, attributes); - ArrayList dataArray = new ArrayList(); - dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_2, NO_CONDITION, 0, true, commandsResult1, acceptsFastTpOnFourBytes())); - dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_1, NO_CONDITION, 0, true, commandsResult2, true)); - dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_3, NO_CONDITION, 0, true, commandsResult3, false)); + waitForBreakpointEvent(); + assertEquals("Incorrect number of breakpoint events", 1, fBreakpointEventCount); + assertEquals("Incorrect number of breakpoint added events", 1, getBreakpointEventCount(BP_ADDED)); + clearEventCounters(); + } - checkTracepoints(dataArray.toArray(new TracepointData[dataArray.size()])); + TracepointData[] dataArray = new TracepointData[] { + new TracepointData(LINE_NUMBER_1_BYTE_INSTR, NO_CONDITION, 0, true, cmdResults[0], false), + new TracepointData(LINE_NUMBER_2_BYTE_INSTR, NO_CONDITION, 0, true, cmdResults[1], false), + new TracepointData(LINE_NUMBER_3_BYTE_INSTR, NO_CONDITION, 0, true, cmdResults[2], false), + new TracepointData(LINE_NUMBER_4_BYTE_INSTR, NO_CONDITION, 0, true, cmdResults[3], acceptsFastTpOnFourBytes()), + new TracepointData(LINE_NUMBER_5_BYTE_INSTR, NO_CONDITION, 0, true, cmdResults[4], true), + }; + + checkTracepoints(dataArray); } /** @@ -1238,69 +925,7 @@ public class GDBRemoteTracepointsTest_7_0 extends BaseTestCase { */ @Test public void createTracepointEnabledWithCommandsConditionPasscount() throws Throwable { - Map attributes = null; - int index = 0; - - // First tracepoint will be a normal tracepoint - attributes = new HashMap(); - attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT); - attributes.put(MIBreakpoints.FILE_NAME, SOURCE_FILE); - attributes.put(MIBreakpoints.LINE_NUMBER, LINE_LOOP_2); - attributes.put(MIBreakpoints.COMMANDS, COLLECT_ACTIONS[0].getName()); - attributes.put(MIBreakpoints.CONDITION, CONDITIONS[0]); - attributes.put(MIBreakpoints.IS_ENABLED, true); - attributes.put(MIBreakpoints.PASS_COUNT, PASS_COUNTS[0]); - fTracepoints[index++] = insertBreakpoint(fBreakpointsDmc, attributes); - - waitForBreakpointEvent(); - assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " - + fBreakpointEventCount, fBreakpointEventCount == 1); - assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " - + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); - clearEventCounters(); - - // Second tracepoint will be a fast tracepoint - attributes = new HashMap(); - attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT); - attributes.put(MIBreakpoints.FILE_NAME, SOURCE_FILE); - attributes.put(MIBreakpoints.LINE_NUMBER, LINE_NUMBER_1); - attributes.put(MIBreakpoints.COMMANDS, COLLECT_ACTIONS[1].getName()); - attributes.put(MIBreakpoints.CONDITION, CONDITIONS[1]); - attributes.put(MIBreakpoints.IS_ENABLED, true); - attributes.put(MIBreakpoints.PASS_COUNT, PASS_COUNTS[1]); - fTracepoints[index++] = insertBreakpoint(fBreakpointsDmc, attributes); - - waitForBreakpointEvent(); - assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " - + fBreakpointEventCount, fBreakpointEventCount == 1); - assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " - + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); - clearEventCounters(); - - // Third tracepoint (will be a normal tracepoint) - attributes = new HashMap(); - attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT); - attributes.put(MIBreakpoints.FILE_NAME, SOURCE_FILE); - attributes.put(MIBreakpoints.FUNCTION, METHOD_NAME); - attributes.put(MIBreakpoints.COMMANDS, COLLECT_ACTIONS[2].getName()); - attributes.put(MIBreakpoints.CONDITION, CONDITIONS[2]); - attributes.put(MIBreakpoints.IS_ENABLED, true); - attributes.put(MIBreakpoints.PASS_COUNT, PASS_COUNTS[2]); - fTracepoints[index++] = insertBreakpoint(fBreakpointsDmc, attributes); - - waitForBreakpointEvent(); - assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " - + fBreakpointEventCount, fBreakpointEventCount == 1); - assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " - + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); - clearEventCounters(); - - ArrayList dataArray = new ArrayList(); - dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_2, CONDITIONS[0], PASS_COUNTS[0], true, COLLECT_ACTIONS[0].toString(), acceptsFastTpOnFourBytes())); - dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_1, CONDITIONS[1], PASS_COUNTS[1], true, COLLECT_ACTIONS[1].toString(), true)); - dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_3, CONDITIONS[2], PASS_COUNTS[2], true, COLLECT_ACTIONS[2].toString(), false)); - - checkTracepoints(dataArray.toArray(new TracepointData[dataArray.size()])); + createTracepoints(true, true, true, true); } /** @@ -1308,71 +933,9 @@ public class GDBRemoteTracepointsTest_7_0 extends BaseTestCase { */ @Test public void createTracepointDisabledWithCommandsConditionPasscount() throws Throwable { - Map attributes = null; - int index = 0; - - // First tracepoint will be a normal tracepoint - attributes = new HashMap(); - attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT); - attributes.put(MIBreakpoints.FILE_NAME, SOURCE_FILE); - attributes.put(MIBreakpoints.LINE_NUMBER, LINE_LOOP_2); - attributes.put(MIBreakpoints.COMMANDS, COLLECT_ACTIONS[0].getName()); - attributes.put(MIBreakpoints.CONDITION, CONDITIONS[0]); - attributes.put(MIBreakpoints.IS_ENABLED, false); - attributes.put(MIBreakpoints.PASS_COUNT, PASS_COUNTS[0]); - fTracepoints[index++] = insertBreakpoint(fBreakpointsDmc, attributes); - - waitForBreakpointEvent(); - assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " - + fBreakpointEventCount, fBreakpointEventCount == 1); - assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " - + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); - clearEventCounters(); - - // Second tracepoint will be a fast tracepoint - attributes = new HashMap(); - attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT); - attributes.put(MIBreakpoints.FILE_NAME, SOURCE_FILE); - attributes.put(MIBreakpoints.LINE_NUMBER, LINE_NUMBER_1); - attributes.put(MIBreakpoints.COMMANDS, COLLECT_ACTIONS[1].getName()); - attributes.put(MIBreakpoints.CONDITION, CONDITIONS[1]); - attributes.put(MIBreakpoints.IS_ENABLED, false); - attributes.put(MIBreakpoints.PASS_COUNT, PASS_COUNTS[1]); - fTracepoints[index++] = insertBreakpoint(fBreakpointsDmc, attributes); - - waitForBreakpointEvent(); - assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " - + fBreakpointEventCount, fBreakpointEventCount == 1); - assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " - + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); - clearEventCounters(); - - // Third tracepoint (will be a normal tracepoint) - attributes = new HashMap(); - attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.TRACEPOINT); - attributes.put(MIBreakpoints.FILE_NAME, SOURCE_FILE); - attributes.put(MIBreakpoints.FUNCTION, METHOD_NAME); - attributes.put(MIBreakpoints.COMMANDS, COLLECT_ACTIONS[2].getName()); - attributes.put(MIBreakpoints.CONDITION, CONDITIONS[2]); - attributes.put(MIBreakpoints.IS_ENABLED, false); - attributes.put(MIBreakpoints.PASS_COUNT, PASS_COUNTS[2]); - fTracepoints[index++] = insertBreakpoint(fBreakpointsDmc, attributes); - - waitForBreakpointEvent(); - assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT event(s), received " - + fBreakpointEventCount, fBreakpointEventCount == 1); - assertTrue("BreakpointEvent problem: expected " + 1 + " BREAKPOINT_ADDED event(s), received " - + getBreakpointEventCount(BP_ADDED), getBreakpointEventCount(BP_ADDED) == 1); - clearEventCounters(); - - ArrayList dataArray = new ArrayList(); - dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_2, CONDITIONS[0], PASS_COUNTS[0], false, COLLECT_ACTIONS[0].toString(), acceptsFastTpOnFourBytes())); - dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_1, CONDITIONS[1], PASS_COUNTS[1], false, COLLECT_ACTIONS[1].toString(), true)); - dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_3, CONDITIONS[2], PASS_COUNTS[2], false, COLLECT_ACTIONS[2].toString(), false)); - - checkTracepoints(dataArray.toArray(new TracepointData[dataArray.size()])); + createTracepoints(true, true, false, true); } - + // /** // * This test sets the different types of tracepoints and then sets some eval actions // */ diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_4/GDBRemoteTracepointsTest_7_4.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_4/GDBRemoteTracepointsTest_7_4.java index 83986848f46..b59b11a632a 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_4/GDBRemoteTracepointsTest_7_4.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_4/GDBRemoteTracepointsTest_7_4.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012 Ericsson and others. + * Copyright (c) 2012, 2014 Ericsson and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -11,7 +11,6 @@ package org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_4; -import java.util.ArrayList; import java.util.HashMap; import java.util.Map; @@ -21,6 +20,7 @@ import org.eclipse.cdt.dsf.mi.service.MIBreakpoints; import org.eclipse.cdt.tests.dsf.gdb.framework.BackgroundRunner; import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants; import org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_3.GDBRemoteTracepointsTest_7_3; +import org.eclipse.core.runtime.Platform; import org.junit.Test; import org.junit.runner.RunWith; @@ -34,8 +34,11 @@ public class GDBRemoteTracepointsTest_7_4 extends GDBRemoteTracepointsTest_7_3 { @Override protected boolean acceptsFastTpOnFourBytes() { // With GDB 7.4, fast tracepoints only need an - // instruction of 4 bytes or more, instead of 5. - return true; + // instruction of 4 bytes or more when on a 32bit architecture, instead of 5. + if (Platform.getOS().equals(Platform.ARCH_X86)) { + return true; + } + return false; } /** @@ -70,13 +73,14 @@ public class GDBRemoteTracepointsTest_7_4 extends GDBRemoteTracepointsTest_7_3 { delta.put(MIBreakpoints.COMMANDS, action2.getName()); updateBreakpoint(fTracepoints[4], delta); - ArrayList dataArray = new ArrayList(); - dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_2, NO_CONDITION, 0, true, action1.toString(), false)); - dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_3, NO_CONDITION, 0, true, action2.toString(), false)); - dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_4, NO_CONDITION, 0, true, action1.toString(), true)); - dataArray.add(new TracepointData(SOURCE_FILE, LINE_NUMBER_1, NO_CONDITION, 0, true, action1.toString(), true)); - dataArray.add(new TracepointData(SOURCE_FILE, LINE_LOOP_2, NO_CONDITION, 0, true, action2.toString(), acceptsFastTpOnFourBytes())); + TracepointData[] dataArray = new TracepointData[] { + new TracepointData(LINE_NUMBER_1_BYTE_INSTR, NO_CONDITION, 0, true, action1.toString(), false), + new TracepointData(LINE_NUMBER_2_BYTE_INSTR, NO_CONDITION, 0, true, action2.toString(), false), + new TracepointData(LINE_NUMBER_3_BYTE_INSTR, NO_CONDITION, 0, true, action1.toString(), false), + new TracepointData(LINE_NUMBER_4_BYTE_INSTR, NO_CONDITION, 0, true, action1.toString(), acceptsFastTpOnFourBytes()), + new TracepointData(LINE_NUMBER_5_BYTE_INSTR, NO_CONDITION, 0, true, action2.toString(), true), + }; - checkTracepoints(dataArray.toArray(new TracepointData[dataArray.size()])); + checkTracepoints(dataArray); } } diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_4/TraceFileTest_7_4.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_4/TraceFileTest_7_4.java index 0a317f561bd..c54ba055d87 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_4/TraceFileTest_7_4.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_4/TraceFileTest_7_4.java @@ -65,10 +65,12 @@ import org.junit.runners.MethodSorters; public class TraceFileTest_7_4 extends BaseTestCase { private final static String FILE_NAME = "TracepointTestApp.cc"; - private final static int LINE_NUMBER_1 = 97; - private final static int LINE_NUMBER_2 = 102; - private final static String TEVAL_STRING = "lBoolPtr2"; - private final static String COLLECT_STRING1 = "counter"; + private final static String EXECUTABLE_PATH = "data/launch/bin/TracepointTestApp.exe"; + private final static int LINE_NUMBER_1 = 17; + private final static int LINE_NUMBER_2 = 24; + private final static String END_FUNCTION = "lastCall"; + private final static String TEVAL_STRING = "a"; + private final static String COLLECT_STRING1 = "x"; private final static String COLLECT_STRING2 = "$regs"; private final static String TRACE_FILE = "data/launch/bin/trace"; @@ -119,9 +121,8 @@ public class TraceFileTest_7_4 extends BaseTestCase { /** * This test implements the following steps. * 1. Starts a remote session - * 2. Sets two tracepoints at data/launch/src/TracepointTestApp.cc:97 - * and data/launch/src/TracepointTestApp.cc:102. - * The first tracepoint's command is "teval lBoolPtr2". + * 2. Sets two tracepoints in data/launch/src/TracepointTestApp.cc + * The first tracepoint's command is "teval a". * The second tracepoint's commands are "collect counter" and "collect $regs". * 3. Sets a regular breakpoint at the end of the source file. * 4. Starts tracing @@ -261,7 +262,7 @@ public class TraceFileTest_7_4 extends BaseTestCase { private void startRemoteSession() throws Throwable { // Set launch attributes super.setLaunchAttributes(); - setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, "data/launch/bin/TracepointTestApp.exe"); + setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, EXECUTABLE_PATH); // GDB tracepoints are only supported on a remote target (e.g., using gdbserver) setLaunchAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE, IGDBLaunchConfigurationConstants.DEBUGGER_MODE_REMOTE); @@ -347,7 +348,7 @@ public class TraceFileTest_7_4 extends BaseTestCase { Map attributes = new HashMap(); attributes.put(MIBreakpoints.BREAKPOINT_TYPE, MIBreakpoints.BREAKPOINT); attributes.put(MIBreakpoints.FILE_NAME, FILE_NAME); - attributes.put(MIBreakpoints.LINE_NUMBER, 152); + attributes.put(MIBreakpoints.FUNCTION, END_FUNCTION); IBreakpointDMContext bptDMC = insertBreakpoint(fBreakpointsDmc, attributes); assertTrue(bptDMC instanceof MIBreakpointDMContext); return (MIBreakpointDMContext)bptDMC;