Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Error parser for external tool
Error parser for external tool [message #204076] Mon, 05 November 2007 10:35 Go to next message
Eclipse UserFriend
Originally posted by: ups_genius.gmx.net

Hi everyone!

I created an error parser using the existing CDT stuff by basically
copying some of the GNU / make / ... error parsers' code. I also added the
extension point for the new error parser, and by debugging I see, that
when activated, the new error parser is actually used to parse the regular
build output.

The reason for writing this error parser though was to parse the output
produced by a batch file, run as "external tool". And this is what does
not work. The batch output is written to what seems to be another
"instance" of the console than the regular make/build output. And the
output to this console is not parsed by any of the error parsers.

Can anyone tell me how to run the error parser on this output? It does not
necessarily have to be in the way I tried it so far, any solution would be
helpful.

By the way: Is there maybe already a plugin that provides a configurable
output/error parser (e.g. like in textpad: regex for error output is
configurable per "external tool")

Thanks in advance,
Christian
Re: Error parser for external tool [message #204153 is a reply to message #204076] Tue, 06 November 2007 02:00 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: ronbermejo.yahoo.com

Hello Christian!

Christian Opitz wrote:

> Hi everyone!

> I created an error parser using the existing CDT stuff by basically
> copying some of the GNU / make / ... error parsers' code. I also added the
> extension point for the new error parser, and by debugging I see, that
> when activated, the new error parser is actually used to parse the regular
> build output.

> The reason for writing this error parser though was to parse the output
> produced by a batch file, run as "external tool". And this is what does
> not work. The batch output is written to what seems to be another
> "instance" of the console than the regular make/build output. And the
> output to this console is not parsed by any of the error parsers.

> Can anyone tell me how to run the error parser on this output? It does not
> necessarily have to be in the way I tried it so far, any solution would be
> helpful.

Yup, the "External Tool" function is contributed by the org.eclipse.debug
plug-ins. You can try which extension points below are suitable for your
needs:
org.eclipse.debug.ui.consoleLineTrackers
org.eclipse.ui.console.consolePatternMatchListeners

Hth!
Ron
Re: Error parser for external tool [message #204166 is a reply to message #204153] Tue, 06 November 2007 09:08 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: ups_genius.gmx.net

Ron Bermejo wrote:

> Hello Christian!

> Christian Opitz wrote:

>> Hi everyone!

>> I created an error parser using the existing CDT stuff by basically
>> copying some of the GNU / make / ... error parsers' code. I also added the
>> extension point for the new error parser, and by debugging I see, that
>> when activated, the new error parser is actually used to parse the regular
>> build output.

>> The reason for writing this error parser though was to parse the output
>> produced by a batch file, run as "external tool". And this is what does
>> not work. The batch output is written to what seems to be another
>> "instance" of the console than the regular make/build output. And the
>> output to this console is not parsed by any of the error parsers.

>> Can anyone tell me how to run the error parser on this output? It does not
>> necessarily have to be in the way I tried it so far, any solution would be
>> helpful.

> Yup, the "External Tool" function is contributed by the org.eclipse.debug
> plug-ins. You can try which extension points below are suitable for your
> needs:
> org.eclipse.debug.ui.consoleLineTrackers
> org.eclipse.ui.console.consolePatternMatchListeners

> Hth!
> Ron


This helps a lot! Thank you very much!
I am not quite sure how to use the existing functionality and what to add
myself yet, but at least now I have a point to start.

Have you done something similar before?

Thanks again!
Christian
Re: Error parser for external tool [message #204180 is a reply to message #204166] Tue, 06 November 2007 10:34 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: ronbermejo.yahoo.com

Hello Christian!

Christian Opitz wrote:

> Ron Bermejo wrote:

>> Yup, the "External Tool" function is contributed by the org.eclipse.debug
>> plug-ins. You can try which extension points below are suitable for your
>> needs:
>> org.eclipse.debug.ui.consoleLineTrackers
>> org.eclipse.ui.console.consolePatternMatchListeners

>> Hth!
>> Ron


> This helps a lot! Thank you very much!
> I am not quite sure how to use the existing functionality and what to add
> myself yet, but at least now I have a point to start.

> Have you done something similar before?

Not really :-) I have only used the cdt errorparser extension point before.

BTW, are you sure you can't just use a CDT build console for this? e.g.,
create a custom make target to run the batch file (for makefile projects).
The reason I'm asking is that you will "lose" some features (such as
problem marker generation) if you use the generic console extension
points, and will have to reimplement them in your plug-in. You can take a
look at ErrorParserManager#generateMarker() and ACBuilder#addMarker() on
how this is done.

Hth!
Ron
Re: Error parser for external tool [message #204187 is a reply to message #204180] Tue, 06 November 2007 12:12 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: ups_genius.gmx.net

Hi Ron!

Ron Bermejo wrote:

> Hello Christian!

> Christian Opitz wrote:

>> Ron Bermejo wrote:

>>> Yup, the "External Tool" function is contributed by the org.eclipse.debug
>>> plug-ins. You can try which extension points below are suitable for your
>>> needs:
>>> org.eclipse.debug.ui.consoleLineTrackers
>>> org.eclipse.ui.console.consolePatternMatchListeners

>>> Hth!
>>> Ron


>> This helps a lot! Thank you very much!
>> I am not quite sure how to use the existing functionality and what to add
>> myself yet, but at least now I have a point to start.

>> Have you done something similar before?

> Not really :-) I have only used the cdt errorparser extension point before.

> BTW, are you sure you can't just use a CDT build console for this? e.g.,
> create a custom make target to run the batch file (for makefile projects).
> The reason I'm asking is that you will "lose" some features (such as
> problem marker generation) if you use the generic console extension
> points, and will have to reimplement them in your plug-in. You can take a
> look at ErrorParserManager#generateMarker() and ACBuilder#addMarker() on
> how this is done.

> Hth!
> Ron


Thanks again!
I am not sure if this works, since I have at least 2 different batch
files, that I would like to run, both needing the selected directory/file
as parameter. One of the batch files is for a special build, the other one
is for a kind of code evaluation - so both do not really have the actual
project build functionality...
I am not so familiar with target configurations, but I will try it - it
seems to be the easier way compared to doing everything by myself in a new
plugin. I don't know where to start yet, but we will see...

Christian
Re: Error parser for external tool [message #204249 is a reply to message #204166] Wed, 07 November 2007 09:01 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mba.cosmigo.ru

Hi Christian,

I've got some experience with
org.eclipse.ui.console.consolePatternMatchListeners extension point. I
was able to parse output of our project to find lines with
__FILE__:__LINE__ output and even make links from console to code. But
as Ron had written in next post, I haven't yet found a way to add a
marker to Problems view. If you find a solution - please share your
experience.

Christian Opitz wrote:
> Ron Bermejo wrote:
>
>> Hello Christian!
>
>> Christian Opitz wrote:
>
>>> Hi everyone!
>
>>> I created an error parser using the existing CDT stuff by basically
>>> copying some of the GNU / make / ... error parsers' code. I also
>>> added the extension point for the new error parser, and by debugging
>>> I see, that when activated, the new error parser is actually used to
>>> parse the regular build output.
>
>>> The reason for writing this error parser though was to parse the
>>> output produced by a batch file, run as "external tool". And this is
>>> what does not work. The batch output is written to what seems to be
>>> another "instance" of the console than the regular make/build output.
>>> And the output to this console is not parsed by any of the error
>>> parsers.
>
>>> Can anyone tell me how to run the error parser on this output? It
>>> does not necessarily have to be in the way I tried it so far, any
>>> solution would be helpful.
>
>> Yup, the "External Tool" function is contributed by the
>> org.eclipse.debug plug-ins. You can try which extension points below
>> are suitable for your needs:
>> org.eclipse.debug.ui.consoleLineTrackers
>> org.eclipse.ui.console.consolePatternMatchListeners
>
>> Hth!
>> Ron
>
>
> This helps a lot! Thank you very much!
> I am not quite sure how to use the existing functionality and what to
> add myself yet, but at least now I have a point to start.
>
> Have you done something similar before?
>
> Thanks again!
> Christian
>
>

--
Best regards
Mikhail Barg


ICQ: 132560784
Re: Error parser for external tool [message #204266 is a reply to message #204249] Wed, 07 November 2007 13:16 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: ups_genius.gmx.net

Hi Mikhail,

I certainly will let you know whenever it works. Right now, I don't even
get my plugin using the
org.eclipse.ui.console.consolePatternMatchListeners extension point to
work, it just does not get called.
Did you release the work you have done somewhere? Is there a possibility
to have a look at it? Could you maybe have a look at the following things?

1. Created a simple new plugin project
2. Used the mentioned extension:
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.2"?>
<plugin>
<extension
point="org.eclipse.ui.console.consolePatternMatchListeners" >
<consolePatternMatchListener
class="de.mystuff.console.parser.QacConsoleTracker"
id="de.mystuff.console.parser.QacConsoleTracker"
regex=".*?">
</consolePatternMatchListener>
</extension>

</plugin>



3. Created Class to process the console activity:

package de.mystuff.console.parser;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

import org.eclipse.ui.console.*;

/**
* Implementation of the
org.eclipse.ui.console.consolePatternMatchListeners
* extension point.
*/
public class QacConsoleTracker implements IPatternMatchListenerDelegate
{
private final Pattern FILE_LINE_PATTERN =
Pattern.compile(".*?");

private TextConsole console;

public void connect(TextConsole console)
{
this.console = console;
}

public void disconnect()
{
this.console = null;
}

public void matchFound(PatternMatchEvent event)
{
...
}
}






Mikhail Barg wrote:

> Hi Christian,

> I've got some experience with
> org.eclipse.ui.console.consolePatternMatchListeners extension point. I
> was able to parse output of our project to find lines with
> __FILE__:__LINE__ output and even make links from console to code. But
> as Ron had written in next post, I haven't yet found a way to add a
> marker to Problems view. If you find a solution - please share your
> experience.
Re: Error parser for external tool [message #204306 is a reply to message #204266] Wed, 07 November 2007 17:12 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: ups_genius.gmx.net

Christian Opitz wrote:

> Right now, I don't even
> get my plugin using the
> org.eclipse.ui.console.consolePatternMatchListeners extension point to
> work, it just does not get called.


Ok, stupid mistake. Plugin works. I'll update you on any news
Re: Error parser for external tool [message #204337 is a reply to message #204306] Thu, 08 November 2007 08:38 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mba.cosmigo.ru

Hi Christian,

Christian Opitz wrote:
> Christian Opitz wrote:
>
>> Right now, I don't even get my plugin using the
>> org.eclipse.ui.console.consolePatternMatchListeners extension point to
>> work, it just does not get called.
>
>
> Ok, stupid mistake. Plugin works. I'll update you on any news
>

Much appreciated.

Regarding your previous letter - I'll send you my code if you need it,
but as you managed to make it work yourself, there would be nothing
really interesting in my code for you then.

--
Best regards
Mikhail Barg


ICQ: 132560784
Re: Error parser for external tool [message #204472 is a reply to message #204249] Fri, 09 November 2007 07:03 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: ronbermejo.yahoo.com

Mikhail Barg wrote:

> Hi Christian,

> I've got some experience with
> org.eclipse.ui.console.consolePatternMatchListeners extension point. I
> was able to parse output of our project to find lines with
> __FILE__:__LINE__ output and even make links from console to code. But
> as Ron had written in next post, I haven't yet found a way to add a
> marker to Problems view. If you find a solution - please share your
> experience.

Hello Mikhail!

Regarding adding markers to the Problems view, you can do this using
IResource#addMarker(). So, the real problem is converting the (String)
filename that you would get from the regexp, to the correct IResource
object.

You can have a look at how ErrorParserManager does this. Or, maybe you
could even just create an instance of ErrorParserManager somewhere (e.g.
during connect(IConsole)) and write() all matching lines to it.

Hth!
Ron
Re: Error parser for external tool [message #204479 is a reply to message #204472] Fri, 09 November 2007 09:04 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mba.cosmigo.ru

Hi Ron,

Ron Bermejo wrote:

> Regarding adding markers to the Problems view, you can do this using
> IResource#addMarker().

Wow, it works! Thanks a lot! Now it'll have to think of when I want to
remove the markers... But it's a my design problems..


> So, the real problem is converting the (String)
> filename that you would get from the regexp, to the correct IResource
> object.
> You can have a look at how ErrorParserManager does this. Or, maybe you
> could even just create an instance of ErrorParserManager somewhere (e.g.
> during connect(IConsole)) and write() all matching lines to it.

I've already managed to do this with ISourceLookupDirector, but it works
only for files which actually exist in the project, not in /includes, as
I wrote in "ISourceLookupDirector and included files" thread.. I'll try
checking ErrorParserManager a bit deeper. Thanks again.

--
Best regards
Mikhail Barg


ICQ: 132560784
Re: Error parser for external tool [message #897591 is a reply to message #204479] Tue, 24 July 2012 16:10 Go to previous messageGo to next message
camelia valuch is currently offline camelia valuchFriend
Messages: 6
Registered: May 2012
Junior Member
Hei,

I see that here are only experienced people ... but I hope that a silly question will not bother anyone.

I have a problem with ErrorParser. I use this link to create an ErrorParser plugin:

publib.boulder.ibm.com/infocenter/iadthelp/v8r0/index.jsp?topic=%2Fcom.ibm.etools.aix.cpp.doc.user%2Fhtml%2Ferror_parser_help%2Fhtml%2Ferror_parser .html

I disable all the default error parsers and at this moment in the C/C++ -> Build-> Settings page there is only my error parser.

When I build the project, the Console View contains the entire process trace, but the errors are NOT parsed. And I think this is right, because between the my error parser and the output text from the correspondent tool there is NO link. (no correspondence). I just have an error parser class and nothing more. Except that proccessLine method contains a sample implementation.

However, I will have 3 tools whose outputs must the parsed. And all this outputs are written to the Console. How each parser will know to search the correspondent output in order to apply the regex expressions.

If someone can help me with this logic, it would help a lot, because in this moment I'm stuck.

Camelia
Re: Error parser for external tool [message #900349 is a reply to message #897591] Mon, 06 August 2012 15:08 Go to previous messageGo to next message
camelia valuch is currently offline camelia valuchFriend
Messages: 6
Registered: May 2012
Junior Member
Hello,

it seems like the problem is related to the project nature. Mine have a particular nature, not the default C nature.

I think so because if I create a C Project the error parser works, but when I create a particular project the Console View is not parsed.

More than that, my project doesn't have the C/C++ -> Build sub menu (when right click -> Properties on the project). So, no chance to set a specific error parser.

Please, if someone has an advice ...
Re: Error parser for external tool [message #1219165 is a reply to message #900349] Mon, 02 December 2013 12:57 Go to previous message
Gajendra Panwar is currently offline Gajendra PanwarFriend
Messages: 2
Registered: December 2013
Junior Member
I am also new to eclipse and i want to use custom compiler with ECLIPSE and show errors and warnings on eclipse.
Errors and Warnings jump on file.
Previous Topic:CDT preprocessor settings
Next Topic:Custom Error Parser for external build tool
Goto Forum:
  


Current Time: Tue Apr 16 23:33:52 GMT 2024

Powered by FUDForum. Page generated in 0.71315 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top