Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IDEA 2016 + GDB 7.11 #28

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions CppTools.iml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/testSrc" isTestSource="true" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="jdk" jdkName="IntelliJ IDEA IU-162.2228.15" jdkType="IDEA JDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="JUnit" level="project" />
</component>
</module>

</module>
19 changes: 3 additions & 16 deletions CppTools_Cardea.ipr
Original file line number Diff line number Diff line change
@@ -1,15 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AntConfiguration">
<buildFile url="file://$PROJECT_DIR$/build.xml">
<customJdkName value="IDEA" />
<maximumStackSize value="32" />
<properties>
<property name="IDEA_SANDBOX_HOME_PATH" value="$SANDBOX_HOME$" />
</properties>
<executeOn event="afterCompilation" target="copy_files" />
</buildFile>
</component>
<component name="BuildJarProjectSettings">
<option name="BUILD_JARS_ON_MAKE" value="false" />
</component>
Expand Down Expand Up @@ -67,9 +57,7 @@
</profile>
</annotationProcessing>
</component>
<component name="CopyrightManager" default="">
<module2copyright />
</component>
<component name="CopyrightManager" default="" />
<component name="CppTools.Loader" reportImplicitCastToBool="false" reportNameReferencedOnce="false" warnedAboutFileOutOfSourceRoot="true" version="3" currentProject="$PROJECT_DIR$/testData/project_files/A.dsp" compilerSelect="AUTO">
<ignored-file path="C:\MinGW\1.0\home\Maxim\CF-C\idea\testData\completion\A.cpp" />
</component>
Expand Down Expand Up @@ -292,7 +280,7 @@
<component name="ProjectResources">
<default-html-doctype>http://www.w3.org/1999/xhtml</default-html-doctype>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_5" assert-keyword="true" jdk-15="true" project-jdk-name="IDEA" project-jdk-type="IDEA JDK" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_5" default="false" assert-keyword="true" jdk-15="true" project-jdk-name="IntelliJ IDEA IU-162.2228.15" project-jdk-type="IDEA JDK" />
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Idea" type="#org.jetbrains.idea.devkit.run.PluginConfigurationType" factoryName="Plugin">
<module name="CppTools" />
Expand Down Expand Up @@ -332,5 +320,4 @@
</value>
</option>
</component>
</project>

</project>
2 changes: 1 addition & 1 deletion META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<idea-plugin>
<name>C/C++</name>
<version>0.8 build 8</version>
<idea-version since-build="139.1" until-build="142.0"/>
<idea-version since-build="145" until-build="170"/>
<depends>com.intellij.modules.lang</depends>
<depends optional="true" config-file="exended_platform.xml">com.intellij.modules.java</depends>
<vendor url="http://bugs.cpptools.com" email="[email protected]">AdvancedTools</vendor>
Expand Down
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
# Update 2016/01/19

- Hardcoded IDEA sandbox into ant.xml
- Fixed GDB 7.11 debugging under linux
- Commented out crash with Alarm (TODO: understand what I did)

# Original readme


1. Plugin needs IntelliJ IDEA Plugin SDK defined and named as "IDEA", or you will need to modify the customJdkName
field in the CppTools_Cardea.ipr with the name of your plugin SDK.
2. Ant file needs IDEA_SANDBOX_HOME_PATH variable defined in settings, that is location defined in Idea plugin sdk.
3. Ant file assumes that native analyzer binaries and its resources are located in paret directory of the project.
When developing plugin stand-alone these binaries and resources are located in "lib" directory of existing plugin.
4. Ant will also require a "DOC" directory exists in the parent directory of the project, so you will want to create it.
4. Ant will also require a "DOC" directory exists in the parent directory of the project, so you will want to create it.
6 changes: 3 additions & 3 deletions build.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!-- AdvancedTools, 2007, all rights reserved -->
<project name="CppTools plugin deploy" default="copy_files">
<property name="idea.sandbox.home.path" value="${IDEA_SANDBOX_HOME_PATH}"/>
<property name="idea.sandbox.home.path" value="/home/mike/.IntelliJIdea2016.2/system/plugins-sandbox"/>
<property name="project.path" value="${basedir}" />

<target name="copy_files">
Expand All @@ -10,10 +10,10 @@
<fileset dir="${project.path}/.." includes="lib.tcl,profile.tcl,defs.h,cfserver.exe,cfserver.mac,cfserver.linux,cfserver.*.syms"/>
</copy>

<copy todir="${idea.sandbox.home.path}/plugins/CppTools" >
<!-- <copy todir="${idea.sandbox.home.path}/plugins/CppTools" >
<fileset dir="${project.path}/../DOC" includes="readme.*"/>
</copy>

-->
<mkdir dir="${idea.sandbox.home.path}/plugins/CppTools/META-INF" />

<copy todir="${idea.sandbox.home.path}/plugins/CppTools/META-INF" >
Expand Down
5 changes: 3 additions & 2 deletions src/com/advancedtools/cpp/CppFormattingModelBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ public TextRange replaceWhiteSpace(TextRange textRange, String whiteSpace) {
return myModel.replaceWhiteSpace(textRange, whiteSpace);
}

public TextRange shiftIndentInsideRange(TextRange range, int indent) {
return myModel.shiftIndentInsideRange(range, indent);
@Override
public TextRange shiftIndentInsideRange(ASTNode astNode, TextRange range, int indent) {
return myModel.shiftIndentInsideRange(astNode, range, indent);
}

public void commitChanges() {
Expand Down
16 changes: 8 additions & 8 deletions src/com/advancedtools/cpp/CppSupportLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -1064,16 +1064,16 @@ public void documentChanged(DocumentEvent event) {
ApplicationManager.getApplication().invokeLater(new Runnable() {
public void run() {
try {
((Alarm)autoPopupControllerAlarmField.get(AutoPopupController.getInstance(project))).addRequest(
new Runnable() {
public void run() {
//((Alarm)autoPopupControllerAlarmField.get(AutoPopupController.getInstance(project))).addRequest(
//new Runnable() {
// public void run() {
PsiDocumentManager.getInstance(project).commitAllDocuments();
new CodeCompletionHandlerBase(CompletionType.BASIC).invokeCompletion(project, selectedEditor);
}
},
lookupDelay
);
} catch (IllegalAccessException e) {
// }
// },
// lookupDelay
//);
} catch (Throwable e) {//IllegalAccessException
e.printStackTrace();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ private String getBasePath() {
String s = PathManager.getPluginsPath() + File.separatorChar + CPP_TOOLS;

if (!new File(s).exists()) {
s = PathManager.getPreinstalledPluginsPath() + File.separatorChar + CPP_TOOLS;
s = PathManager.getPreInstalledPluginsPath() + File.separatorChar + CPP_TOOLS;

if (!new File(s).exists()) {
throw new RuntimeException("Plugin home is not found");
Expand Down
14 changes: 7 additions & 7 deletions src/com/advancedtools/cpp/debugger/CppBaseDebugRunner.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ protected RunContentDescriptor doExecute(Project project, RunProfileState runPro
final RunProfile runProfile = env.getRunProfile();

final XDebugSession debugSession =
XDebuggerManager.getInstance(project).startSession(this, env, runContentDescriptor, new XDebugProcessStarter() {
@NotNull
public XDebugProcess start(@NotNull final XDebugSession session) {
return new CppDebugProcess(session, CppBaseDebugRunner.this, (BaseCppConfiguration)runProfile);
}
});

XDebuggerManager.getInstance(project).startSession(env, new XDebugProcessStarter() {
@NotNull
@Override
public XDebugProcess start(@NotNull XDebugSession session) throws ExecutionException {
return new CppDebugProcess(session, CppBaseDebugRunner.this, (BaseCppConfiguration)runProfile);
}
});
return debugSession.getRunContentDescriptor();
}

Expand Down
6 changes: 6 additions & 0 deletions src/com/advancedtools/cpp/debugger/CppDebugProcess.java
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,13 @@ public void run() {
}

private boolean processOneCommand() throws IOException {
if(commandsToWrite.size()==0) {
//System.out.println("commandsToWrite Empty");
try{Thread.sleep(500);}catch(InterruptedException e){}
return false;
}
final DebuggerCommand command = commandsToWrite.removeFirst();
System.out.println(command);
command.post(context);
if (command instanceof QuitCommand) return true;
command.readResponse(context);
Expand Down
9 changes: 0 additions & 9 deletions src/com/advancedtools/cpp/debugger/CppStackFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,6 @@ public Object getEqualityObject() {
@Override
public XDebuggerEvaluator getEvaluator() {
return new XDebuggerEvaluator() {
@Override
public boolean evaluateCondition(@NotNull String s) {
return false;
}

@Override
public String evaluateMessage(@NotNull String s) {
return null;
}

@Override
public void evaluate(@NotNull final String evaluated, final @NotNull XEvaluationCallback xEvaluationCallback, @Nullable XSourcePosition xSourcePosition) {
Expand Down
16 changes: 12 additions & 4 deletions src/com/advancedtools/cpp/debugger/CppSuspendContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,29 @@ public CppSuspendContext(final CppStackFrame stackFrame, final CppDebuggerContex
myContext.sendAndProcessOneCommand(new DebuggerCommand("info threads") {
@Override
protected void processToken(String token, CppDebuggerContext context) {
if (token.indexOf("thread") != -1) {
if (token.indexOf("thread") != -1 || token.indexOf("Thread") != -1 || token.indexOf("process") != -1) {
CppThreadStackInfo info;
// "* "?6 thread 3020.0x890 0x7c90e514 in ntdll!LdrAccessResource () from C:\WINDOWS\system32\ntdll.dll
// old format:
//* "?6 thread 3020.0x890 0x7c90e514 in ntdll!LdrAccessResource () from C:\WINDOWS\system32\ntdll.dll
// new format (single threaded apps):
//* 1 process 7059 "test" main () at test.c:10
boolean activeThread = token.charAt(0) == '*';
int startOffset = activeThread ? 2 : 0;
int threadIdEnd = token.indexOf(' ', startOffset);
int startOfFunPos = token.indexOf(' ', token.indexOf(' ', threadIdEnd + 1) + 1);
int threadNo = Integer.parseInt(token.substring(startOffset, threadIdEnd));

startOffset = threadIdEnd;
while(startOffset<token.length() && token.charAt(startOffset)==' ')
startOffset++;

int startOfFunPos = token.indexOf(' ', token.indexOf(' ', startOffset + 1) + 1);
String displayName = token.substring(startOffset, startOfFunPos);

if (activeThread) {
info = new CppThreadStackInfo(CppSuspendContext.this, stackFrame, context, displayName, threadNo);
myActiveThreadStack = info;
} else {
CppStackFrame cppStackFrame = CppStackFrame.parseStackFrame("#0"+token.substring(startOfFunPos + 1), null, context);
CppStackFrame cppStackFrame = CppStackFrame.parseStackFrame("#0 "+token.substring(startOfFunPos + 1), null, context);
info = new CppThreadStackInfo(CppSuspendContext.this, cppStackFrame, context, displayName, threadNo);
}
threads.add(info);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ protected void processToken(String token, CppDebuggerContext context) {
context.getSession().positionReached(
new CppSuspendContext(stackFrame, context)
);
} else if (token.indexOf("Program exited") != -1) {
} else if (token.indexOf("Program exited") != -1 || token.indexOf("exited with code") != -1) {
context.printToConsole(token, ConsoleViewContentType.SYSTEM_OUTPUT);
if (!context.getSession().isStopped()) {
context.getProcessHandler().detachProcess();
Expand Down
3 changes: 2 additions & 1 deletion src/com/advancedtools/cpp/facade/EnvironmentFacade.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ public static VirtualFile getSdkHomeDirectory(Sdk projectJdk) {
public Object createLookupElement(String s) {
final MyLookupItem item = new MyLookupItem(s);
LookupItem<MyLookupItem> lookupItem = new LookupItem<MyLookupItem>(item, item.getPresentation());
lookupItem.setTypeText(item.getTypeHint()).setInsertHandler(new BasicInsertHandler<LookupElement>() {
lookupItem.setAttribute(LookupItem.TYPE_TEXT_ATTR, item.getTypeHint());
lookupItem.setInsertHandler(new BasicInsertHandler<LookupElement>() {
@Override
public void handleInsert(InsertionContext insertionContext, LookupElement lookupElement) {
super.handleInsert(insertionContext, lookupElement);
Expand Down
2 changes: 1 addition & 1 deletion testSrc/tests/BaseCppTestCase.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ abstract class BaseCppTestCase extends TestCase {
protected void setUp() throws Exception {
super.setUp();
final IdeaTestFixtureFactory fixtureFactory = IdeaTestFixtureFactory.getFixtureFactory();
final TestFixtureBuilder<IdeaProjectTestFixture> testFixtureBuilder = fixtureFactory.createFixtureBuilder();
final TestFixtureBuilder<IdeaProjectTestFixture> testFixtureBuilder = fixtureFactory.createFixtureBuilder("cpp");

myFixture = fixtureFactory.createCodeInsightFixture(testFixtureBuilder.getFixture());
myFixture.setTestDataPath(new File("").getAbsolutePath() + File.separatorChar + getTestDataPath());
Expand Down