Deduce base class function types/names from inheriting ones
See original GitHub issuestruct Bar {
virtual int a(int x) = 0;
virtual int b(double x, double y) = 0;
virtual int get() = 0;
};
struct Foo : public Bar {
int a(int ax) override {
x = ax;
return x;
}
int b(double ax, double ay) override {
x = ax;
y = ay;
return y;
}
virtual int get() {
return y;
}
int x;
int y;
};
int main() {
Bar* b = new Foo;
b->a(4);
b->b(6, 7);
return b->get();
}
is currently decompiled as:
void main(void)
{
code *pcVar1;
Foo *this;
this = (Foo *)operator.new(0x10);
Foo::Foo(this);
pcVar1 = (code *)((this->super_Bar)._vptr)->__cxa_pure_virtual;
(*pcVar1)(this,4,pcVar1);
(*(code *)((this->super_Bar)._vptr)->__cxa_pure_virtual)
(0x4018000000000000,0x401c000000000000,this);
(*(code *)((this->super_Bar)._vptr)->__cxa_pure_virtual)(this);
return;
}
It should be possible to improve the info in the Bar vtable struct by using the types and names from the Foo vtable struct.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:5 (4 by maintainers)
Top Results From Across the Web
RecoverClassesFromRTTIScript: Deduce base class function ...
The script currently only figures out which class the functions in the vftable originated in if they are inherited.
Read more >Deduce parent class of inherited method in C++ - Stack Overflow
If I understand the problem correctly, it is possible to deduce the class a member function is defined in, using the following trait:...
Read more >17.7 — Calling inherited functions and overriding behavior
By default, derived classes inherit all of the behaviors defined in a base class. In this lesson, we'll examine in more detail how...
Read more >Ghidra-Cpp-Class-Analyzer - Bountysource
Ghidra C++ Class and Run Time Type Information Analyzer. Become a Bounty Hunter ... Deduce base class function types/names from inheriting ones $...
Read more >Car class java
Write a Java program for creating one base class for student personal details ... Method references can make the language more compact and...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I filed a similar issue for Ghidra’s class recovery script: https://github.com/NationalSecurityAgency/ghidra/issues/3417
I haven’t done so yet. You are more then welcome to give it a shot. Collecting all the abstract classes and using
ClassTypeInfo::isAbstract
as a filter should give you a head start.hashCode
is implemented using the typename’shashCode
but if you want to use a red black based collection I’d recommend using(a, b) -> Long.compare(a.getKey(), b.getKey())
as the comparator.getKey
comes fromDatabaseObject::getKey
Those are the only thoughts I’ve had yet. I started setting up nodes for the graphing but vscode kept “not responding” so I stopped working on Java stuff until it is resolved.