Beginner questions re. Moose analysis of C++ source code

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

Beginner questions re. Moose analysis of C++ source code

smallglt
This post was updated on .
I'm totally new to Moose (and effectively new to Smalltalk) and need a
pointer or two on analyzing an old application that was developed in Visual
C++ 2006. I have the complete sources, including the Visual Studio project
files, resource files, etc.

I've already got Pharo and Moose installed on my Windows system and have
been able to get the Moose playground to run, but that's about it. So far I
don't know how to get Moose to do anything else.

My initial goal is just to get this source code "loaded" into Moose.

I've seen references to VerveineC-Cpp and Famix-C but no explanation of how
to use either one.

I haven't had an opportunity yet to try VerveineC-Cpp on Windows 10 at my
office.

On my personal Mac (i.e. not on the office system where I actually need to
do this work) I installed Eclipse Oxygen and tried to follow the very
limited directions to install VerveineC-Cpp, but Eclipse complains about the
build path.

Maybe Eclipse Mars is needed instead of Oxygen? It also looks like I might
need to use the old, deprecated Java V1.7 for MacOS, instead of a current
version of Java? (Hopefully I won't need an older version of MacOS. I'm
running Sierra V10.12 with all updates as of this writing.)

Maybe that would all be more straightforward somehow on Windows?

(I also have Linux at work, if that would be any easier.)

As for Famix-C, I see that it appears to be "built in" to the Moose
environment that I installed at work and at home. But I don't know how to
make it do anything.

I greatly appreciate any hints or suggestions. I'm very eager to begin using
Moose and to (re)learn Smalltalk, especially in the Pharo environment which
looks really fascinating.

(Trivia: Back in the early 1990's or thereabouts, while taking a graduate
course in operating system design, I learned enough Smalltalk to get me
started on writing an emulator for the simple machine specification the
professor gave us. But a single academic quarter, roughly three months, just
wasn't enough time to both learn a totally new, object oriented programming
paradigm /and/ use it to complete such a program, while also holding down a
full time job and leading a regular life. :-)  But I did write a good paper
explaining my ideas and how far I'd actually been able to carry them. The
professor was understanding, liked my concept, and I managed to get a B+
grade for the course.)





--
Sent from: http://forum.world.st/Moose-f1310756.html
_______________________________________________
Moose-dev mailing list
Moose-dev@list.inf.unibe.ch
https://www.list.inf.unibe.ch/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Beginner questions re. Moose analysis of C++ source code

Fuhrmanator
Hello,

I'm also a relative newbie, but was wanting to try Moose with C++ for a while. So, following the readme at https://github.com/Synectique/VerveineC-Cpp I managed to get the plug-in to build and appear in Eclipse Mars 2 (I had to restart eclipse several times) in Windows 10 and the latest Java 1.8, but with a disclaimer that I didn't manage to run it yet. 

Some things that weren't explicit:
  • I had to install CDT (C / C++) in Eclipse
  • I had to download Apache Ant and point Eclipse to it (there was a problem with the Ant that came by default, perhaps it's a Java 8 problem?)
  • I could not find a "verveineC.sh" shell script as stated in the readme.md so didn't know how to run it.
At this point, I think it's runnable, but couldn't see a way to do it. I couldn't find even a .sh script in the github repo...

Cheers,

C. Fuhrman

On Wed, Apr 18, 2018 at 10:20 AM, smallglt <[hidden email]> wrote:
I'm totally new to Moose (and effectively new to Smalltalk) and need a
pointer or two on analyzing an old application that was developed in Visual
C++ 2006. I have the complete sources, including the Visual Studio project
files, resource files, etc.

I've already got Pharo and Moose installed on my Windows system and have
been able to get the Moose playground to run, but that's about it. So far I
don't know how to get Moose to do anything else.

My initial goal is just to get this source code "loaded" into Moose.

I've seen references to VerveineC-Cpp and Famix-C but no explanation of how
to use either one.

I haven't had an opportunity yet to try VerveineC-Cpp on Windows 10 at my
office.

On my personal Mac (i.e. not on the office system where I actually need to
do this work) I installed Eclipse Oxygen and tried to follow the very
limited directions to install VerveineC-Cpp, but Eclipse complains about the
build path.

Maybe Eclipse Mars is needed instead of Jupiter? It also looks like I might
need to use the old, deprecated Java V1.7 for MacOS, instead of a current
version of Java? (Hopefully I won't need an older version of MacOS. I'm
running Sierra V10.12 with all updates as of this writing.)

Maybe that would all be more straightforward somehow on Windows?

(I also have Linux at work, if that would be any easier.)

As for Famix-C, I see that it appears to be "built in" to the Moose
environment that I installed at work and at home. But I don't know how to
make it do anything.

I greatly appreciate any hints or suggestions. I'm very eager to begin using
Moose and to (re)learn Smalltalk, especially in the Pharo environment which
looks really fascinating.

(Trivia: Back in the early 1990's or thereabouts, while taking a graduate
course in operating system design, I learned enough Smalltalk to get me
started on writing an emulator for the simple machine specification the
professor gave us. But a single academic quarter, roughly three months, just
wasn't enough time to both learn a totally new, object oriented programming
paradigm /and/ use it to complete such a program, while also holding down a
full time job and leading a regular life. :-)  But I did write a good paper
explaining my ideas and how far I'd actually been able to carry them. The
professor was understanding, liked my concept, and I managed to get a B+
grade for the course.)





--
Sent from: http://forum.world.st/Moose-f1310756.html
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.list.inf.unibe.ch/listinfo/moose-dev


_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.list.inf.unibe.ch/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Beginner questions re. Moose analysis of C++ source code

cdelaunay
Hello Chris,

Indeed, the readme lacks some step descriptions.
There is a fork and a branch of the project where the readme has been updated and is more complete: https://github.com/jecisc/VerveineC-Cpp/tree/readmeUpdate
(I guess it should be pushed to the main page).

I followed this readme some times ago and succeeded to build VerveineC plugin and run it without too much issues.
I did not faced the "Ant issue".

Regarding the .sh script, I think it used to be located in a "verveine-launcher" folder, available from the github repo.
But as you, I can not find it from the main project page currently.
However, I see this folder is available from the above fork: https://github.com/jecisc/VerveineC-Cpp/tree/readmeUpdate/verveine-launcher

Note: The last version of the project is actually located in the "noLogger" branch (https://github.com/Synectique/VerveineC-Cpp/tree/noLogger)
Maybe it should be merged to the Master branch


2018-04-19 0:18 GMT+02:00 Cris Fuhrman <[hidden email]>:
Hello,

I'm also a relative newbie, but was wanting to try Moose with C++ for a while. So, following the readme at https://github.com/Synectique/VerveineC-Cpp I managed to get the plug-in to build and appear in Eclipse Mars 2 (I had to restart eclipse several times) in Windows 10 and the latest Java 1.8, but with a disclaimer that I didn't manage to run it yet. 

Some things that weren't explicit:
  • I had to install CDT (C / C++) in Eclipse
  • I had to download Apache Ant and point Eclipse to it (there was a problem with the Ant that came by default, perhaps it's a Java 8 problem?)
  • I could not find a "verveineC.sh" shell script as stated in the readme.md so didn't know how to run it.
At this point, I think it's runnable, but couldn't see a way to do it. I couldn't find even a .sh script in the github repo...

Cheers,

C. Fuhrman

On Wed, Apr 18, 2018 at 10:20 AM, smallglt <[hidden email]> wrote:
I'm totally new to Moose (and effectively new to Smalltalk) and need a
pointer or two on analyzing an old application that was developed in Visual
C++ 2006. I have the complete sources, including the Visual Studio project
files, resource files, etc.

I've already got Pharo and Moose installed on my Windows system and have
been able to get the Moose playground to run, but that's about it. So far I
don't know how to get Moose to do anything else.

My initial goal is just to get this source code "loaded" into Moose.

I've seen references to VerveineC-Cpp and Famix-C but no explanation of how
to use either one.

I haven't had an opportunity yet to try VerveineC-Cpp on Windows 10 at my
office.

On my personal Mac (i.e. not on the office system where I actually need to
do this work) I installed Eclipse Oxygen and tried to follow the very
limited directions to install VerveineC-Cpp, but Eclipse complains about the
build path.

Maybe Eclipse Mars is needed instead of Jupiter? It also looks like I might
need to use the old, deprecated Java V1.7 for MacOS, instead of a current
version of Java? (Hopefully I won't need an older version of MacOS. I'm
running Sierra V10.12 with all updates as of this writing.)

Maybe that would all be more straightforward somehow on Windows?

(I also have Linux at work, if that would be any easier.)

As for Famix-C, I see that it appears to be "built in" to the Moose
environment that I installed at work and at home. But I don't know how to
make it do anything.

I greatly appreciate any hints or suggestions. I'm very eager to begin using
Moose and to (re)learn Smalltalk, especially in the Pharo environment which
looks really fascinating.

(Trivia: Back in the early 1990's or thereabouts, while taking a graduate
course in operating system design, I learned enough Smalltalk to get me
started on writing an emulator for the simple machine specification the
professor gave us. But a single academic quarter, roughly three months, just
wasn't enough time to both learn a totally new, object oriented programming
paradigm /and/ use it to complete such a program, while also holding down a
full time job and leading a regular life. :-)  But I did write a good paper
explaining my ideas and how far I'd actually been able to carry them. The
professor was understanding, liked my concept, and I managed to get a B+
grade for the course.)





--
Sent from: http://forum.world.st/Moose-f1310756.html
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.list.inf.unibe.ch/listinfo/moose-dev


_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.list.inf.unibe.ch/listinfo/moose-dev




--
Cyrille Delaunay

_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.list.inf.unibe.ch/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Beginner questions re. Moose analysis of C++ source code

CyrilFerlicot
On 19/04/2018 10:58, Cyrille Delaunay wrote:
> Hello Chris,
>
> Indeed, the readme lacks some step descriptions.
> There is a fork and a branch of the project where the readme has been
> updated and is more
> complete: https://github.com/jecisc/VerveineC-Cpp/tree/readmeUpdate
> (I guess it should be pushed to the main page).

Hi,

I think it was not merged because we wanted to improve it further, but
in the end we did not found the time.

I guess I'll open a PR to integrate what is already done. Thank you for
the reminder :)

>
> I followed this readme some times ago and succeeded to build VerveineC
> plugin and run it without too much issues.
> I did not faced the "Ant issue".
>
> Regarding the .sh script, I think it used to be located in a
> "verveine-launcher" folder, available from the github repo.
> But as you, I can not find it from the main project page currently.
> However, I see this folder is available from the above
> fork: https://github.com/jecisc/VerveineC-Cpp/tree/readmeUpdate/verveine-launcher
>
> Note: The last version of the project is actually located in the
> "noLogger" branch
> (https://github.com/Synectique/VerveineC-Cpp/tree/noLogger)
> Maybe it should be merged to the Master branch
>
>
>
> --
> Cyrille Delaunay
>
>
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.list.inf.unibe.ch/listinfo/moose-dev
>


--
Cyril Ferlicot
https://ferlicot.fr
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.list.inf.unibe.ch/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Beginner questions re. Moose analysis of C++ source code

smallglt
In reply to this post by cdelaunay
When I try to export the plug-in I get an error window saying:



That error log says this:


Being unfamiliar with Eclipse I don't know how to fix that.



--
Sent from: http://forum.world.st/Moose-f1310756.html
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.list.inf.unibe.ch/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Beginner questions re. Moose analysis of C++ source code

smallglt
In reply to this post by Fuhrmanator
What version of *ant* did you install, and how do you get Eclipse to use it?

Thanks!



--
Sent from: http://forum.world.st/Moose-f1310756.html
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.list.inf.unibe.ch/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Beginner questions re. Moose analysis of C++ source code

Fuhrmanator
On Wed, May 2, 2018 at 10:11 AM, smallglt <[hidden email]> wrote:
What version of *ant* did you install, and how do you get Eclipse to use it?

Context: I don't have Java 7, so with Java 8 there were some troubles using the version of Eclipse mentioned. I googled the error message and wound up following the directions on https://wiki.eclipse.org/Ant/Java8 

Finally, I used Apache Ant 1.9.11 

That said, I've still not managed to find enough time to sort out the build of the tool using the fork mentioned by Cyrille at  https://github.com/jecisc/VerveineC-Cpp/tree/readmeUpdate

Cheers
 

Thanks!



--
Sent from: http://forum.world.st/Moose-f1310756.html
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.list.inf.unibe.ch/listinfo/moose-dev


_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.list.inf.unibe.ch/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Beginner questions re. Moose analysis of C++ source code

smallglt
In reply to this post by CyrilFerlicot
I just got the extractor to run! (Though it logged an error.)

I don't know what was different, except that I updated my Eclipse
installation before building and installing VerveineC this time around.

As sample code I chose the source for gawk v4.1.2, partly because I know my
way around it somewhat.

When I ran the extractor script the output looked okay up until I got an
error message like this:
-------
!ENTRY verveine.extractor.Cpp 1 0 2018-06-24 12:14:41.206
!MESSAGE recording variables declared type and methods/functions return type

!ENTRY org.eclipse.osgi 4 0 2018-06-24 12:14:41.268
!MESSAGE Application error
!STACK 1
java.lang.ClassCastException: eu.synectique.verveine.core.gen.famix.Function
cannot be cast to eu.synectique.verveine.core.gen.famix.Type
        at
eu.synectique.verveine.extractor.visitors.ref.AbstractRefVisitor.referedType(AbstractRefVisitor.java:190)
        at
eu.synectique.verveine.extractor.visitors.ref.AbstractRefVisitor.visit(AbstractRefVisitor.java:98)
.
.
.
---
The vertical ellipsis indicates that I left out the rest of the long
traceback.

I've uploaded the entire log so you can have a look at it:

log.zip <http://forum.world.st/file/t371881/log.zip>  



--
Sent from: http://forum.world.st/Moose-f1310756.html
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.list.inf.unibe.ch/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Beginner questions re. Moose analysis of C++ source code

smallglt
This post was updated on .
In reply to this post by smallglt
It's possible that some interested parties may have missed a significant
update and new query that I posted to this thread a few days ago. Its first
line read "I just got the extractor to run! (Though it logged an error.)"

If you didn't see that, but you would want to read it, see the archive of
this thread
.

I'm posting /this/ update because one subscriber to this list has informed
me that he received notification of that update /in his spam folder/, with
some kind of message about my email address not passing validation by Yahoo
Mail (my email provider).

I changed the email address for my own subscription. Don't know if that will
help.



--
Sent from: http://forum.world.st/Moose-f1310756.html
_______________________________________________
Moose-dev mailing list
Moose-dev@list.inf.unibe.ch
https://www.list.inf.unibe.ch/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Beginner questions re. Moose analysis of C++ source code

Fuhrmanator
On Thu, Jun 28, 2018 at 2:00 PM smallglt <[hidden email]> wrote:
I'm posting /this/ update because one subscriber to this list has informed
me that he received notification of that update /in his spam folder/, with
some kind of message about my email address not passing validation by Yahoo
Mail (my email provider).

I've seen this problem on other lists with some (not all) yahoo accounts. Your last messages did get flagged as spam on my Gmail. The reason: 

This message has a from address in yahoo.com but has failed yahoo.com's required tests for authentication.  

My understanding is that to avoid this problem, you must use Yahoo.com's outgoing SMTP server for sending messages. When I looked at the SMTP headers of your message, it appears to have gone through nabble.com from your localhost. Spammers often spoof the "from" address (technically you're doing the same thing if your email isn't at nabble.com), so it looks suspicious. 

I suggest taking other questions off list (email me directly) if you need more info. Hope it helps.

_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.list.inf.unibe.ch/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Beginner questions re. Moose analysis of C++ source code

Nicolas Anquetil
In reply to this post by smallglt


GREAT !

Indeed, I did not receive your post before (but my subscription to the list may specify weekly update ???)

So first congrats again for your achievement

Second, about the error:

The difficulty of "parsing" any source code is not really in the parsing itself (grammar, building AST, etc.) , but in resolving the identifiers (when one sees an identifier used somewhere, one must guess what it is and where it is defined, for example several methods with the same name may exist, and one has to find the right one that is called at this moment)

For this, verveineC uses CDT, eclipse's plugin for C/C++

But this is difficult for CDT to always guess what entity a name refers to

To improve things a bit, VerveineC makes 2 passes, first pass to define all entities, 2nd pass to record the references to all entities (access to variables, method calls, uses of classes, ...)
This is what
  "!MESSAGE recording variables declared type and methods/functions return type"
means, it is in the 2nd pass, try to record uses of types, either as the type of a declared variable, or as the return type of a method/function.

But even with that, it is still a tough task. Sometimes VerveineC finds a name that it does not know what it is, so it must guess. In your case, at some earlier time it guessed that a given name was a function, but now it sees that it is used to declare a variable or a function/method and deduces it is a type.
So it tries to cast the entity to a type but it was declared earlier as a function and the cast fails.

The 1st solution is to look more precisely at the code you were trying to parse to understand what happened exactly:

  • a some point it though it was a function and that was a mistake
  • or there is a function and a type with the same name and it is mixing the two

A second more generic solution would be to avoid crashing and do something more intelligent, may be like ignoring the use of this type at this point ? And warn the user that it could not resolve that name ?

nicolas


On 24/06/2018 18:37, smallglt wrote:
I just got the extractor to run! (Though it logged an error.)

I don't know what was different, except that I updated my Eclipse
installation before building and installing VerveineC this time around.

As sample code I chose the source for gawk v4.1.2, partly because I know my
way around it somewhat.

When I ran the extractor script the output looked okay up until I got an
error message like this:
-------
!ENTRY verveine.extractor.Cpp 1 0 2018-06-24 12:14:41.206
!MESSAGE recording variables declared type and methods/functions return type

!ENTRY org.eclipse.osgi 4 0 2018-06-24 12:14:41.268
!MESSAGE Application error
!STACK 1
java.lang.ClassCastException: eu.synectique.verveine.core.gen.famix.Function
cannot be cast to eu.synectique.verveine.core.gen.famix.Type
        at
eu.synectique.verveine.extractor.visitors.ref.AbstractRefVisitor.referedType(AbstractRefVisitor.java:190)
        at
eu.synectique.verveine.extractor.visitors.ref.AbstractRefVisitor.visit(AbstractRefVisitor.java:98)
.
.
.
---
The vertical ellipsis indicates that I left out the rest of the long
traceback.

I've uploaded the entire log so you can have a look at it:

log.zip <http://forum.world.st/file/t371881/log.zip>  



--
Sent from: http://forum.world.st/Moose-f1310756.html
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.list.inf.unibe.ch/listinfo/moose-dev

-- 
Nicolas Anquetil
RMod team -- Inria Lille

_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.list.inf.unibe.ch/listinfo/moose-dev