#define strlen _strlen
#include <stdarg.h>
#include <unistd.h>
-#include <ctype.h>
#include <string.h> // For memchr
#ifdef __APPLE__
if(frame.absoluteFile)
editor = (CodeEditor)ide.OpenFile(frame.absoluteFile, false, true, null, no, normal, false);
if(!editor && frame.file)
- frame.absoluteFile = ide.workspace.GetAbsolutePathFromRelative(frame.file);
+ frame.absoluteFile = ide.workspace.CopyAbsolutePathFromRelative(frame.file);
if(!frame.absoluteFile && askForLocation && frame.file)
{
char * s = null;
if(SourceDirDialog(title, ide.workspace.projectDir, frame.file, sourceDir))
{
AddSourceDir(sourceDir);
- frame.absoluteFile = ide.workspace.GetAbsolutePathFromRelative(frame.file);
+ frame.absoluteFile = ide.workspace.CopyAbsolutePathFromRelative(frame.file);
}
}
if(!editor && frame.absoluteFile)
void RunToCursor(CompilerConfig compiler, ProjectConfig config, int bitDepth, bool useValgrind, const char * absoluteFilePath, int lineNumber, bool ignoreBreakpoints, bool atSameLevel, bool oldImplementation)
{
char relativeFilePath[MAX_LOCATION];
+ const char * objectFileExt = compiler ? compiler.objectFileExt : objectDefaultFileExt;
_dpcl(_dpct, dplchan::debuggerCall, 0, "Debugger::RunToCursor()");
_ChangeUserAction(runToCursor);
- WorkspaceGetRelativePath(absoluteFilePath, relativeFilePath, null);
+ ide.workspace.GetRelativePath(absoluteFilePath, relativeFilePath, null, objectFileExt);
if(bpRunToCursor && bpRunToCursor.inserted && symbols)
{
{
Project owner;
char relativePath[MAX_LOCATION];
+ const char * objectFileExt = currentCompiler ? currentCompiler.objectFileExt : objectDefaultFileExt;
- WorkspaceGetRelativePath(absolutePath, relativePath, &owner);
+ ide.workspace.GetRelativePath(absolutePath, relativePath, &owner, objectFileExt);
if(!owner && !FileExists(absolutePath))
{
Workspace ws = ide.workspace;
if(ws)
{
- String path = ide.workspace.GetPathWorkspaceRelativeOrAbsolute(item.value);
+ String path = ide.workspace.CopyUnixPathWorkspaceRelativeOrAbsolute(item.value);
if(strcmp(frame.file, path))
frame.file = path;
delete path;
GdbExecCommon();
if(absoluteFilePath)
{
- WorkspaceGetRelativePath(absoluteFilePath, relativeFilePath, null);
+ const char * objectFileExt = currentCompiler ? currentCompiler.objectFileExt : objectDefaultFileExt;
+ ide.workspace.GetRelativePath(absoluteFilePath, relativeFilePath, null, objectFileExt);
if(!GdbCommand(0.1, true, "-exec-until %s:%d", relativeFilePath, lineNumber))
{
GetLastDirectory(relativeFilePath, relativeFilePath);
GdbExecCommon();
if(lineNumber)
{
- WorkspaceGetRelativePath(absoluteFilePathOrLocation, relativeFilePath, null);
+ const char * objectFileExt = currentCompiler ? currentCompiler.objectFileExt : objectDefaultFileExt;
+ ide.workspace.GetRelativePath(absoluteFilePathOrLocation, relativeFilePath, null, objectFileExt);
if(!GdbCommand(0.1, true, "advance %s:%d", relativeFilePath, lineNumber)) // should use -exec-advance -- GDB/MI implementation missing
{
GetLastDirectory(relativeFilePath, relativeFilePath);
SetInDebugger(true);
SetThisClass(null);
+ // NOTE: DebugFindCtxTree() should be called only once for evaluating all watches in the watch window
if(codeEditor && activeFrame)
DebugFindCtxTree(codeEditor.ast, activeFrame.line, 0);
ProcessExpressionType(exp);
{
Expression memberExp = exp.member.exp;
Identifier memberID = exp.member.member;
- Type type = memberExp.expType;
+ Type type = memberExp ? memberExp.expType : null;
Class _class = (type && memberID) ? (memberID && memberID.classSym) ? memberID.classSym.registered : ((type.kind == classType && type._class) ? type._class.registered : null) : null;
if(_class && memberID && memberID.string)
snprintf(watchmsg, sizeof(watchmsg), $"Missing property evaluation for \"%s\" in class \"%s\"", memberID.string, _class.name);
!strcmp(wh.type._class.registered.name, "String")))
{
- if(exp.expType.kind != arrayType || exp.hasAddress)
+ if(exp.expType && (exp.expType.kind != arrayType || exp.hasAddress))
{
uint64 address;
char value[4196];
result = true;
}
else if(wh.type && (wh.type.kind == charType || (wh.type.kind == classType && wh.type._class &&
- wh.type._class.registered && !strcmp(wh.type._class.registered.fullName, "ecere::com::unichar"))) )
+ wh.type._class.registered && !strcmp(wh.type._class.registered.fullName, "unichar"))) )
{
unichar value;
int signedValue;
else if(value > 256 || wh.type.kind != charType)
{
if(value > 0x10FFFF || !GetCharCategory(value))
- snprintf(string, sizeof(string), $"Invalid Unicode Keypoint (0x%08X)", value);
+ snprintf(string, sizeof(string), $"Invalid Unicode Codepoint (0x%08X)", value);
else
snprintf(string, sizeof(string), "\'%s\' (U+%04X)", charString, value);
}
{
if(!strcmp(prjName, prj.name))
{
- if(ProjectGetAbsoluteFromRelativePath(prj, filePath, fullPath))
+ if(prj.GetAbsoluteFromRelativePath(filePath, fullPath, null))
{
property::absoluteFilePath = fullPath;
project = prj;
else
{
Project prj = ide.project;
- if(ProjectGetAbsoluteFromRelativePath(prj, filePath, fullPath))
+ if(prj.GetAbsoluteFromRelativePath(filePath, fullPath, null))
{
property::absoluteFilePath = fullPath;
project = prj;
{
CodeLocation codloc { line = line };
codloc.file = CopyString(loc);
- codloc.absoluteFile = ide.workspace.GetAbsolutePathFromRelative(loc);
+ codloc.absoluteFile = ide.workspace.CopyAbsolutePathFromRelative(loc);
return codloc;
}
}
exp.type = constantExp;
}
}
-
-static Project WorkspaceGetFileOwner(const char * absolutePath)
-{
- Project owner = null;
- for(prj : ide.workspace.projects)
- {
- if(prj.topNode.FindByFullPath(absolutePath, false))
- {
- owner = prj;
- break;
- }
- }
- if(!owner)
- WorkspaceGetObjectFileNode(absolutePath, &owner);
- return owner;
-}
-
-static ProjectNode WorkspaceGetObjectFileNode(const char * filePath, Project * project)
-{
- ProjectNode node = null;
- char ext[MAX_EXTENSION];
- GetExtension(filePath, ext);
- if(ext[0])
- {
- IntermediateFileType type = IntermediateFileType::FromExtension(ext);
- if(type)
- {
- char fileName[MAX_FILENAME];
- GetLastDirectory(filePath, fileName);
- if(fileName[0])
- {
- DotMain dotMain = DotMain::FromFileName(fileName);
- for(prj : ide.workspace.projects)
- {
- if((node = prj.FindNodeByObjectFileName(fileName, type, dotMain, null)))
- {
- if(project)
- *project = prj;
- break;
- }
- }
- }
- }
- }
- return node;
-}
-
-static ProjectNode ProjectGetObjectFileNode(Project project, const char * filePath)
-{
- ProjectNode node = null;
- char ext[MAX_EXTENSION];
- GetExtension(filePath, ext);
- if(ext[0])
- {
- IntermediateFileType type = IntermediateFileType::FromExtension(ext);
- if(type)
- {
- char fileName[MAX_FILENAME];
- GetLastDirectory(filePath, fileName);
- if(fileName[0])
- {
- DotMain dotMain = DotMain::FromFileName(fileName);
- node = project.FindNodeByObjectFileName(fileName, type, dotMain, null);
- }
- }
- }
- return node;
-}
-
-static void WorkspaceGetRelativePath(const char * absolutePath, char * relativePath, Project * owner)
-{
- Project prj = WorkspaceGetFileOwner(absolutePath);
- if(owner)
- *owner = prj;
- if(!prj)
- prj = ide.workspace.projects.firstIterator.data;
- if(prj)
- {
- MakePathRelative(absolutePath, prj.topNode.path, relativePath);
- MakeSlashPath(relativePath);
- }
- else
- relativePath[0] = '\0';
-}
-
-static bool ProjectGetAbsoluteFromRelativePath(Project project, const char * relativePath, char * absolutePath)
-{
- ProjectNode node = project.topNode.FindWithPath(relativePath, false);
- if(!node)
- node = ProjectGetObjectFileNode(project, relativePath);
- if(node)
- {
- strcpy(absolutePath, node.project.topNode.path);
- PathCat(absolutePath, relativePath);
- MakeSlashPath(absolutePath);
- }
- return node != null;
-}