| Summary: | Error parsers easily get confused when compilation directory is not known | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Tools] CDT | Reporter: | Sergey Prigogin <eclipse.sprigogin> | ||||
| Component: | cdt-core | Assignee: | Project Inbox <cdt-core-inbox> | ||||
| Status: | RESOLVED FIXED | QA Contact: | |||||
| Severity: | normal | ||||||
| Priority: | P3 | CC: | cdtdoug, gong_ys2004, ken.ryall | ||||
| Version: | 4.0.1 | ||||||
| Target Milestone: | 4.0.3 | ||||||
| Hardware: | PC | ||||||
| OS: | Linux | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
|
Description
Sergey Prigogin
Created attachment 82044 [details]
Proposed fix
Doug, I'm still waiting for the committer paperwork to be signed on our side. Could you please review this change and check it in on my behalf. Thanks a lot.
The patch applied to HEAD. Are there any objections to putting this into 4.0.3 too? Nope, go ahead. and thanks! Also fixed in cdt_4_0 branch. Sergey - This change comments out ErrorParserManager.isConflictingName. Our error parser calls this method so our build broke after I updated to the latest CDT sources. Was the removal of isConflictingName intentional? Any guidance to how we should update our error parser? Thanks - Ken (In reply to comment #6) > Sergey - This change comments out ErrorParserManager.isConflictingName. Our > error parser calls this method so our build broke after I updated to the latest > CDT sources. Was the removal of isConflictingName intentional? Any guidance to > how we should update our error parser? > > Thanks - Ken > Sorry, it was an oversight on my part. The method is restored. It does not fix the path resolve problem when "Entering directory `D:/test/code_opt/app'" and "Leaving directory `D:/test/code_opt/app'" messages happen in build console. and working directory is `D:/test/code_opt/app'.
below is the code from ErrorParserManager:
public IPath getWorkingDirectory() {
if (fDirectoryStack.size() != 0) {
return (IPath) fDirectoryStack.lastElement();
}
// Fallback to the Project Location
return fBaseDirectory;
}
public void pushDirectory(IPath dir) {
if (dir != null) {
IPath pwd = null;
if (fBaseDirectory.isPrefixOf(dir)) {
int segments = fBaseDirectory.matchingFirstSegments(dir);
pwd = dir.removeFirstSegments(segments);
} else {
pwd = dir;
}
fDirectoryStack.addElement(pwd);
}
}
/**
* Called by the error parsers.
*/
public IFile findFilePath(String filePath) {
IPath path = null;
IPath fp = new Path(filePath);
if (fp.isAbsolute()) {
if (fBaseDirectory.isPrefixOf(fp)) {
int segments = fBaseDirectory.matchingFirstSegments(fp);
path = fp.removeFirstSegments(segments);
} else {
path = fp;
}
} else {
path = getWorkingDirectory().append(filePath);
}
IFile file = null;
// The workspace may throw an IllegalArgumentException
// Catch it and the parser should fallback to scan the entire project.
try {
file = findFileInWorkspace(path);
} catch (Exception e) {
}
...
when parsing "Entering Directory", MakeErrorParser will push the `D:/test/code_opt/app' into ErrorParserManager, but ErrorParserManager just keeps the 'd:';
If I have a conflicked file test.c in `D:/test/code_opt/app' and there are some errors in it, ErrorParserManager's getWorkingDirectory().append("test.c") will output d:test.c path. as a result, this path can not be found anywhere.
(In reply to comment #8) Does you example work in 4.0.2? > when parsing "Entering Directory", MakeErrorParser will push > the `D:/test/code_opt/app' into ErrorParserManager, but ErrorParserManager > just keeps the 'd:'; This doesn't look right. If your problem is reproducible with 4.0.2, please file a separate bug, if it's not, I'll reopen this one. (In reply to comment #9) > (In reply to comment #8) > Does you example work in 4.0.2? > > when parsing "Entering Directory", MakeErrorParser will push > > the `D:/test/code_opt/app' into ErrorParserManager, but ErrorParserManager > > just keeps the 'd:'; > This doesn't look right. If your problem is reproducible with 4.0.2, please > file a separate bug, if it's not, I'll reopen this one. Yes, I am using 4.0.2. and I will file a separate bug |