Debug C++ project in eclipse

22 views
Skip to first unread message

Marty Burns

unread,
Sep 20, 2018, 11:57:24 AM9/20/18
to NAR Maven plugin
I am looking for a procedure to set up a debug configuration in eclipse for a C++ project packaged as a maven nar file. I am using the m2e-nar plugin in eclipse CDT. I want to be able to set break points in the source and debug accordingly. Anyone have experience doing this?

I have a C++ project that produces a nar file with depnedencies in pom.xml:

<plugin>
    <groupId>com.github.maven-nar</groupId>
    <artifactId>nar-maven-plugin</artifactId>
    <version>${nar.version}</version>
    <extensions>true</extensions>
    <executions>
<execution>
<id>nar-download</id>
<goals>
<goal>nar-download</goal>
</goals>
</execution>
<execution>
<id>nar-unpack</id>
<goals>
<goal>nar-unpack</goal>
</goals>
</execution>
<execution>
<id>nar-test-unpack</id>
<goals>
<goal>nar-test-unpack</goal>
</goals>
</execution>
<execution>
<id>nar-integration-test</id>
<goals>
<goal>nar-integration-test</goal>
</goals>
</execution>
</executions>
  </plugin>


Here is the profile for the Cpp program:
<profile>
<id>CppFed</id>
<build>
<plugins>
        <plugin>
        <groupId>com.github.maven-nar</groupId>
        <artifactId>nar-maven-plugin</artifactId>
        <version>${nar.version}</version>
        <configuration>
          <classifiers>
            <classifier>amd64-Linux-gpp</classifier>
          </classifiers>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>nar-download</goal>
              <goal>nar-download-dependencies</goal>
              <goal>nar-unpack</goal>
              <goal>nar-unpack-dependencies</goal>
              <goal>nar-assembly</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
        <plugin>
          <artifactId>maven-assembly-plugin</artifactId>
          <version>2.6</version>
          <dependencies>
          <dependency><!-- The depenency for CPP execution assembly script-->
<groupId>org.cpswt</groupId>
<artifactId>ExecutionAssembler</artifactId>
<version>${cpswt.version}</version>
</dependency>
  </dependencies>
          <configuration>
            <finalName>bin</finalName>
            <descriptorRefs>
              <descriptorRef>executionAssembly</descriptorRef>
            </descriptorRefs>
          </configuration>
          <executions>
              <execution>
                <id>make-assembly</id> <!-- this is used for inheritance merges -->
                <phase>package</phase> <!-- bind to the packaging phase -->
                <goals>
                  <goal>single</goal>
                </goals>
              </execution>
        </executions>
        </plugin>
        <plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.4.0</version>
<configuration>
<workingDirectory>${project.basedir}/target/bin-exec</workingDirectory>
              <executable>./PingCpp-${federate.name}-cpp</executable>
<arguments>
<argument>--configFile</argument>
                                <argument>${project.basedir}/conf/${experiment.name}/${federate.configFile}</argument>
    </arguments>
    <environmentVariables>
                    <EXEDIR>${project.basedir}/target/${federate.name}</EXEDIR>
                    <LD_LIBRARY_PATH>${project.basedir}/target/nar/lib/amd64-Linux-gpp/shared/:${env.RTI_HOME}/lib/gcc4/:${env.RTI_HOME}/jre/lib/amd64/server</LD_LIBRARY_PATH>
                </environmentVariables>
</configuration>
</plugin>
    </plugins>
</build>
</profile>

I can run this project successfully with:

```mvn exec:exec -P CppFed,Ping```


Reply all
Reply to author
Forward
0 new messages