Book a Demo

Author Topic: Reverse engineering C++  (Read 5371 times)

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Reverse engineering C++
« on: February 09, 2016, 09:48:34 pm »
I almost never have used reverse engineering with EA except for databases. But now I have a little private project where I wanted to document the sources before going into code. Saying "Hey, I got EA. It can do that for me!" was my first thought and I fired it up. But disappointment struck at once. I get parse errors which are, well, as I expected :( EA-like.
Code: [Select]
There was an error parsing Z:\Marlin\Marlin\configuration_store.cpp  on line 96.  Unexpected symbol: void
There was an error parsing Z:\Marlin\Marlin\MarlinSerial.h  on line 122.  Unexpected symbol: )
...
This code is nothing extraordinary. The CPP compiles with no issues.

So what is the EA RE worth? Nothing at all in the end?

q.

Helmut Ortmann

  • EA User
  • **
  • Posts: 970
  • Karma: +42/-1
    • View Profile
Re: Reverse engineering C++
« Reply #1 on: February 09, 2016, 11:00:00 pm »
Hi,

often macros in C/C++ are the problem. You can configure them to be ignored in EA.

Until release 10. I used Reverse Engeneering a lot (mostly C) and if I got around macros there was no big deal.

Regards,

Helmut
Coaching, Training, Workshop (Addins: hoTools, Search&Replace, LineStyle)

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Reverse engineering C++
« Reply #2 on: February 09, 2016, 11:06:27 pm »
I guesses so. But Unexpected symbol: void does not help much. There is no macro nearby. So I guess the parser isn't worth much. Probably I have to run the preprocessor to eliminate any macros first.

q.

P.S. After running the preprocessor this piece of EA parser still throws errors. Well, I have to throw it - into the dump >:(
« Last Edit: February 09, 2016, 11:25:19 pm by qwerty »

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Reverse engineering C++
« Reply #3 on: February 10, 2016, 08:50:51 am »
The symbol reported is the first one that can't be matched by any parser rule.

Usually the real error is a couple of lines before that. If you want to post (or send to support) some samples of the code before that we can probably find the issue.

Having said that, the error message you're getting suggests that EA doesn't think the file is C or C++. It recommends adding a preprocessor macro when parse errors are encountered for those languages.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Reverse engineering C++
« Reply #4 on: February 10, 2016, 09:39:12 am »
Thanks for the offer, but I don't know whether it makes much sense since I did most of the work manually now. The error is somewhere in the middle of the code (line 200 or so) and nothing suspect around. Indeed it's more C than C++ (but that's a valid subset as you know). I have written a real compiler (although 30 years ago) for Modula2 so I know that giving good error messages can be tricky. I also know that EA is in the lower price segment and do not expect any bling-bling. And I also know that EA's error support is -  hmmm - you know. I had several rants about that in various areas. Nevertheless, I always hope for the best but the disappointment when expectations are not met is no less...

q.