GdbThread gdbThread { debugger = this };
bool entryPoint;
+ Map<String, bool> projectsLibraryLoaded { };
Timer gdbTimer
{
codeEditor = null;
entryPoint = false;
+ projectsLibraryLoaded.Free();
/*GdbThread gdbThread
Timer gdbTimer*/
}
}
ide.workspace.bpCount++;
- bp = { line = lineNumber, type = user, enabled = true, level = -1 };
+ bp = { line = lineNumber, type = user, enabled = true, level = -1, project = prj };
ide.workspace.breakpoints.Add(bp);
bp.absoluteFilePath = absolutePath;
bp.relativeFilePath = relativePath;
{
char * s; _dpl2(_dpct, dplchan::debuggerBreakpoints, 0, "Debugger::SetBreakpoint(", s=bp.CopyLocationString(false), ", ", removePath ? "**** removePath(true) ****" : "", ") -- ", bp.type); delete s;
breakpointError = false;
- if(symbols && bp.enabled)
+ if(symbols && bp.enabled && (!bp.project || bp.project == ide.project || projectsLibraryLoaded[bp.project.name]))
{
char * location = bp.CopyLocationString(removePath);
sentBreakInsert = true;
targeted = false;
modules = false;
needReset = false;
-
+ projectsLibraryLoaded.Free();
+
ide.outputView.ShowClearSelectTab(debug);
ide.outputView.debugBox.Logf($"Starting debug mode\n");
match = !fstrcmp(prjTargetPath, path);
}
}
- if(!match)
+ if(match)
+ projectsLibraryLoaded[prj.name] = true;
+ else
ide.outputView.debugBox.Logf($"Loaded library %s doesn't match the %s target of the %s added project.\n", path, prjTargetPath, prj.topNode.name);
break;
}
property char * relativeFilePath { set { delete relativeFilePath; if(value) relativeFilePath = CopyString(value); } }
char * absoluteFilePath;
property char * absoluteFilePath { set { delete absoluteFilePath; if(value) absoluteFilePath = CopyString(value); } }
+ char * location;
+ property char * location { set { delete location; if(value) location = CopyString(value); } }
int line;
bool enabled;
int hits;
BreakpointType type;
DataRow row;
GdbDataBreakpoint bp;
+ Project project;
+
+ void ParseLocation()
+ {
+ char * prjName = null;
+ char * filePath = null;
+ char * file;
+ char * line;
+ char fullPath[MAX_LOCATION];
+ ProjectNode node;
+ if(location[0] == '\(' && location[1] && (file = strchr(location+2, '\)')) && file[1])
+ {
+ prjName = new char[file-location];
+ strncpy(prjName, location+1, file-location-1);
+ prjName[file-location-1] = '\0';
+ file++;
+ }
+ else
+ file = location;
+ if((line = strchr(file+1, ':')))
+ {
+ filePath = new char[strlen(file)+1];
+ strncpy(filePath, file, line-file);
+ filePath[line-file] = '\0';
+ line++;
+ }
+ else
+ filePath = CopyString(file);
+ property::relativeFilePath = filePath;
+ if(prjName)
+ {
+ for(prj : ide.workspace.projects)
+ {
+ if(!strcmp(prjName, prj.name))
+ {
+ node = prj.topNode.FindWithPath(filePath, false);
+ if(node)
+ {
+ node.GetFullFilePath(fullPath);
+ property::absoluteFilePath = fullPath;
+ project = prj;
+ break;
+ }
+ }
+ }
+ if(line[0])
+ this.line = atoi(line);
+ }
+ else
+ {
+ node = ide.projectView.project.topNode.Find(filePath, false);
+ if(node)
+ {
+ node.GetFullFilePath(fullPath);
+ property::absoluteFilePath = fullPath;
+ }
+ project = ide.project;
+ }
+ if(!absoluteFilePath)
+ property::absoluteFilePath = "";
+ delete prjName;
+ delete filePath;
+ }
char * CopyLocationString(bool removePath)
{
char * location;
char * loc = CopyLocationString(false);
Project prj = null;
- for(p : ide.workspace.projects)
+ for(p : ide.workspace.projects; p != ide.workspace.projects.firstIterator.data)
{
if(p.topNode.FindByFullPath(absoluteFilePath, false))
{
{
if(relativeFilePath && relativeFilePath[0])
{
- f.Printf(" * %d,%d,%d,%d,%s\n", enabled ? 1 : 0, ignore, level, line, relativeFilePath);
+ char * location = CopyUserLocationString();
+ f.Printf(" * %d,%d,%d,%d,%s\n", enabled ? 1 : 0, ignore, level, line, location);
+ delete location;
if(condition)
f.Printf(" ~ %s\n", condition.expression);
}
delete function;
delete relativeFilePath;
delete absoluteFilePath;
+ delete location;
}
~Breakpoint()
for(s : dirs)
sourceDirs.Add(CopyString(s));
- DropInvalidBreakpoints();
+ DropInvalidBreakpoints(null);
delete dirs;
}
if(it.Find(project))
it.Remove();
- DropInvalidBreakpoints();
+ for(bp : breakpoints)
+ DropInvalidBreakpoints(project);
modified = true;
ide.findInFilesDialog.RemoveProjectItem(project);
ide.UpdateToolBarActiveConfigs(false);
char * currentLoc = bp.CopyUserLocationString();
if(strcmp(location, currentLoc))
{
- // todo, parse location
- // if good, make changes to breakpoint, according to execution state delete and place breakpoint
- ide.breakpointsView.UpdateBreakpoint(row); // this is the else
- //Save();
+ char * newLoc;
+ bp.location = location;
+ bp.ParseLocation();
+ newLoc = bp.CopyUserLocationString();
+ if(strcmp(newLoc, currentLoc))
+ {
+ ide.breakpointsView.UpdateBreakpoint(row);
+ Save();
+ }
}
delete currentLoc;
}
delete bp;
}
- void DropInvalidBreakpoints()
+ void ParseLoadedBreakpoints()
+ {
+ for(bp : breakpoints; bp.location)
+ {
+ bp.ParseLocation();
+ ide.breakpointsView.UpdateBreakpoint(bp.row);
+ }
+ }
+
+ void DropInvalidBreakpoints(Project removedProject)
{
Link bpLink, next;
for(bpLink = breakpoints.first; bpLink; bpLink = next)
if(bp.type == user)
{
- Project project = null;
- for(p : projects)
+ if(removedProject)
{
- if(FindPath(p.topNode, bp.absoluteFilePath))
- {
- project = p;
- break;
- }
- // Handle symbol loader modules:
+ if(bp.project == removedProject)
{
- char moduleName[MAX_FILENAME];
- char * sl;
- GetLastDirectory(bp.absoluteFilePath, moduleName);
- // Tweak for automatically resolving symbol loader modules
- sl = strstr(moduleName, ".main.ec");
- if(sl && (*sl = 0, !strcmpi(moduleName, p.name)))
- {
- project = p;
- break;
- }
+ ide.breakpointsView.RemoveBreakpoint(bp);
+ RemoveBreakpoint(bp);
}
}
- if(!project)
+ else
{
- bool found = false;
- for(dir : sourceDirs)
+ Project project = bp.project;
+ if(!project)
{
- if(IsPathInsideOf(bp.absoluteFilePath, dir))
+ for(p : projects)
{
- found = true;
- break;
+ if(FindPath(p.topNode, bp.absoluteFilePath))
+ {
+ project = p;
+ break;
+ }
+ // Handle symbol loader modules:
+ {
+ char moduleName[MAX_FILENAME];
+ char * sl;
+ GetLastDirectory(bp.absoluteFilePath, moduleName);
+ // Tweak for automatically resolving symbol loader modules
+ sl = strstr(moduleName, ".main.ec");
+ if(sl && (*sl = 0, !strcmpi(moduleName, p.name)))
+ {
+ project = p;
+ break;
+ }
+ }
}
}
- if(!found)
+ if(!project)
{
- ide.breakpointsView.RemoveBreakpoint(bp);
- RemoveBreakpoint(bp);
+ bool found = false;
+ for(dir : sourceDirs)
+ {
+ if(IsPathInsideOf(bp.absoluteFilePath, dir))
+ {
+ found = true;
+ break;
+ }
+ }
+ if(!found)
+ {
+ ide.breakpointsView.RemoveBreakpoint(bp);
+ RemoveBreakpoint(bp);
+ }
}
}
}
bp = { type = user, enabled = enabled, ignore = ignore, level = level, line = line };
workspace.breakpoints.Add(bp);
- bp.relativeFilePath = strFile;
- bp.absoluteFilePath = workspace.GetAbsolutePathFromRelative(strFile);
- if(!bp.absoluteFilePath)
- bp.absoluteFilePath = CopyString("");
+ bp.location = strFile;
}
}
}
bp = { type = user, enabled = enabled, level = -1 };
workspace.breakpoints.Add(bp);
bp.line = atoi(lineNum);
- bp.relativeFilePath = relPath;
- bp.absoluteFilePath = workspace.GetAbsolutePathFromRelative(relPath);
- if(!bp.absoluteFilePath)
- bp.absoluteFilePath = "";
+ bp.location = relPath;
}
}
}