Book a Demo

Author Topic: C++ reverse engineering  (Read 3462 times)

jopock

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
C++ reverse engineering
« on: March 10, 2006, 03:28:14 pm »
Hello,

i have a question in reverse engineering c++ source.

I have a source code like this:

class X
{ int a;
}

defineSmartPointer(X);

class Y
{  XSmartPointer aMemberOfY;
}

defineSmartPointer(Y);


The macro defineSmartPointer(X) defines a class XSmartPointer that realize a Smart Pointer for the class X.

Wenn I reverse engineer this source code, the relation  Y -> XSmartPointer is not visible in the diagramm.

Is this a problem in Enterprise Architect or is something missing?

lg
jopock

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: C++ reverse engineering
« Reply #1 on: March 13, 2006, 04:28:38 pm »
EA doesn't evaluate macros, so no class XSmartPointer can or will be created.

There isn't really much that can be done about this.

mikewhit

  • EA User
  • **
  • Posts: 608
  • Karma: +0/-0
  • Accessing ....
    • View Profile
Re: C++ reverse engineering: use the power of C++
« Reply #2 on: March 14, 2006, 01:12:08 am »
The relation X->XSmartPointer is only a convention at the level of your macro.

If the macro also had a parameter which was the name of the smart pointer type, you could perhaps create an EA definition to associate the smart pointer and its associated 'pointee'.

In any case, I thought that C++ users didn't need to use the preprocessor when they could use the class [or template] mechanism to achieve the same (or better!) results ... surely better to do this here, and EA will then (I hope) know about the relationship too.

Code: [Select]
class Y
{  SmartPointer<X> aMemberOfY;
}
?
« Last Edit: March 14, 2006, 08:48:25 am by mikewhit »

jopock

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: C++ reverse engineering
« Reply #3 on: March 16, 2006, 04:20:06 pm »
Thanks for the good replies. The macro defines a huge number of Smart Pointers, so an EA definiton for each Smart Pointer is a challenge. Can I define a generic EA definition that i can get a Smart Pointer definition for each class with one EA definition?

With a Smart Pointer realization via macro you can avoid the use of templates in your application code. The macro Definition for the Smart Pointer realization exists in legacy code.

I try a reverse engineering with the .i Files. When I parse the Files that are generated by the Precompiler the performance is so low that I cancel this request. Has anyone the same effect or is this a special effect on my files. Each generated .i Files is about 1 MB.

My currently favorite method is the implementation of a small tool that parse und change the source code that EA can correct reverse engineer the source code.

Perhaps there exists other methods in solving my problem with the Smart Pointer relations.

Thanks for further answers.