Skip to content

Commit

Permalink
ide; fixes to Debug Precompile, Debug Compile and Debug Generate Symb…
Browse files Browse the repository at this point in the history
…ols. closes #777
  • Loading branch information
redj authored and jerstlouis committed May 2, 2013
1 parent fc19a12 commit b25bc6e
Show file tree
Hide file tree
Showing 2 changed files with 84 additions and 13 deletions.
61 changes: 59 additions & 2 deletions ide/src/ide.ec
Expand Up @@ -2685,18 +2685,29 @@ class IDEWorkSpace : Window
int c;
bool passThrough = false;
bool debugStart = false;
bool debugWorkDir = false;
char * passDebugWorkDir = null;
bool openAsText = false;
DynamicString passArgs { };
for(c = 1; c<app.argc; c++)
{
if(!strcmp(app.argv[c], "-debug-start"))
debugStart = true;
else if(!strcmp(app.argv[c], "-debug-work-dir"))
debugWorkDir = true;
else if(!passThrough && !strcmp(app.argv[c], "-@"))
passThrough = true;
else if(passThrough)
{
passArgs.concat(" ");
passArgs.concat(app.argv[c]);
}
else if(debugWorkDir)
{
passDebugWorkDir = CopyString(app.argv[c]);
StripQuotes(passDebugWorkDir, passDebugWorkDir);
debugWorkDir = false;
}
else
{
char fullPath[MAX_LOCATION];
Expand Down Expand Up @@ -2764,8 +2775,54 @@ class IDEWorkSpace : Window
}
}
if(passThrough && projectView && projectView.project && workspace)
workspace.commandLineArgs = passArgs;
delete passArgs;
{
char * fixSpacing = new char[Max(passArgs.size * 1.5, 32)];
{
int c, d = 0;
char j = 0;
char k = ' ';
char l = 0;
bool inQuote = false;
for(c=0; c<passArgs.size; c++)
{
l = passArgs[c];
if(inQuote && k != '\\' && l == ' ')
{
fixSpacing[d++] = '\"';
fixSpacing[d++] = ' ';
inQuote = false;
}
else if(inQuote && l == '\0')
{
fixSpacing[d++] = '\"';
fixSpacing[d++] = '\0';
inQuote = false;
}
else if(!inQuote && j != '\\' && k == ' ' && l != '-' && l != ' ')
{
fixSpacing[d++] = '\"';
fixSpacing[d++] = l;
inQuote = true;
}
else if(k == '\\' && l == ' ')
fixSpacing[d++] = ' ';
else if(k == '\\' && l == '\\')
fixSpacing[d++] = '\\';
else if(l != '\\')
fixSpacing[d++] = l;
j = k;
k = l;
}
fixSpacing[d] = '\0';
}
delete passArgs;
workspace.commandLineArgs = fixSpacing;
}
if(passDebugWorkDir)
{
workspace.debugDir = passDebugWorkDir;
delete passDebugWorkDir;
}
if(debugStart)
;//MenuDebugStart(debugStartResumeItem, 0); // <-- how TODO this without getting into the app.Wait lock

Expand Down
36 changes: 25 additions & 11 deletions ide/src/project/Project.ec
Expand Up @@ -2056,12 +2056,8 @@ private:
if((f = DualPipeOpen(PipeOpenMode { output = true, error = true, input = true }, command)))
{
bool found = false;
if(justPrint)
{
ProcessPipeOutputRaw(f);
result = true;
}
else if(mode != normal && mode != cObject)
bool error = false;
if(mode != normal && mode != cObject)
{
char line[65536];
while(!f.Eof())
Expand All @@ -2071,19 +2067,33 @@ private:
{
if((result = f.Peek()) && (result = f.GetLine(line, sizeof(line)-1)))
{
if(!found && strstr(line, "ide ") == line)
if(!error && !found && strstr(line, "echo ") == line)
{
strcpy(command, line+5);
error = true;
}
if(!error && !found && strstr(line, "ide ") == line)
{
strcpy(command, line);
found = true;
}
}
}
}
if(found)
result = true;
}
else if(justPrint)
{
ProcessPipeOutputRaw(f);
result = true;
}
else
result = ProcessBuildPipeOutput(f, objDirExp, isARun, onlyNodes, compiler, config, bitDepth);
delete f;
if(found)
if(error || (justPrint && found))
ide.outputView.buildBox.Logf("%s\n", command);
else if(found)
Execute(command);
}
else
Expand Down Expand Up @@ -2359,9 +2369,9 @@ private:
f.Printf("CPP := $(CCACHE_COMPILE)$(DISTCC_COMPILE)$(GCC_PREFIX)%s$(_SYSROOT)\n", compiler.cppCommand);
f.Printf("CC := $(CCACHE_COMPILE)$(DISTCC_COMPILE)$(GCC_PREFIX)%s$(_SYSROOT)\n", compiler.ccCommand);
f.Printf("CXX := $(CCACHE_COMPILE)$(DISTCC_COMPILE)$(GCC_PREFIX)%s$(_SYSROOT)\n", compiler.cxxCommand);
f.Printf("ECP := $(if $(ECP_DEBUG),ide -debug-start $(ECERE_SDK_SRC)/compiler/ecp/ecp.epj -@,%s)\n", compiler.ecpCommand);
f.Printf("ECC := $(if $(ECC_DEBUG),ide -debug-start $(ECERE_SDK_SRC)/compiler/ecc/ecc.epj -@,%s)$(if $(CROSS_TARGET), -t $(TARGET_PLATFORM),)\n", compiler.eccCommand);
f.Printf("ECS := $(if $(ECS_DEBUG),ide -debug-start $(ECERE_SDK_SRC)/compiler/ecs/ecs.epj -@,%s)$(if $(CROSS_TARGET), -t $(TARGET_PLATFORM),)\n", compiler.ecsCommand);
f.Printf("ECP := $(if $(ECP_DEBUG),ide -debug-start \"$(ECERE_SDK_SRC)/compiler/ecp/ecp.epj\" -debug-work-dir \"${CURDIR}\" -@,%s)\n", compiler.ecpCommand);
f.Printf("ECC := $(if $(ECC_DEBUG),ide -debug-start \"$(ECERE_SDK_SRC)/compiler/ecc/ecc.epj\" -debug-work-dir \"${CURDIR}\" -@,%s)$(if $(CROSS_TARGET), -t $(TARGET_PLATFORM),)\n", compiler.eccCommand);
f.Printf("ECS := $(if $(ECS_DEBUG),ide -debug-start \"$(ECERE_SDK_SRC)/compiler/ecs/ecs.epj\" -debug-work-dir \"${CURDIR}\" -@,%s)$(if $(CROSS_TARGET), -t $(TARGET_PLATFORM),)\n", compiler.ecsCommand);
f.Printf("EAR := %s\n", compiler.earCommand);

f.Puts("AS := $(GCC_PREFIX)as\n");
Expand Down Expand Up @@ -3007,6 +3017,10 @@ private:

f.Puts("objdir:\n");
f.Puts("\t$(if $(wildcard $(OBJ)),,$(call mkdirq,$(OBJ)))\n");
f.Puts("\t$(if $(ECERE_SDK_SRC),$(if $(wildcard $(call escspace,$(ECERE_SDK_SRC)/crossplatform.mk)),,@$(call echo,Ecere SDK Source Warning: The value of ECERE_SDK_SRC is pointing to an incorrect ($(ECERE_SDK_SRC)/crossplatform.mk) location.)),)\n");
f.Puts("\t$(if $(ECERE_SDK_SRC),,$(if $(ECP_DEBUG),@$(call echo,ECC Debug Warning: Please define ECERE_SDK_SRC before using ECP_DEBUG),))\n");
f.Puts("\t$(if $(ECERE_SDK_SRC),,$(if $(ECC_DEBUG),@$(call echo,ECC Debug Warning: Please define ECERE_SDK_SRC before using ECC_DEBUG),))\n");
f.Puts("\t$(if $(ECERE_SDK_SRC),,$(if $(ECS_DEBUG),@$(call echo,ECC Debug Warning: Please define ECERE_SDK_SRC before using ECS_DEBUG),))\n");
//f.Puts("# PRE-BUILD COMMANDS\n");
if(options && options.prebuildCommands)
{
Expand Down

0 comments on commit b25bc6e

Please sign in to comment.