mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2024-11-21 11:31:43 +00:00
GP-5014 - MDMang - add tests for vxtable parentage coded as backref
This commit is contained in:
parent
d4a3e7d4bf
commit
6ff6b26cb7
@ -4655,6 +4655,15 @@ public class MDMangBaseTest extends AbstractGenericTest {
|
||||
demangleAndTest();
|
||||
}
|
||||
|
||||
// Backref used in parentage
|
||||
@Test
|
||||
public void testUnderscore7f() throws Exception {
|
||||
mangled = "??_7a@b@@6B01@@";
|
||||
msTruth = "const b::a::`vftable'{for `b::a'}";
|
||||
mdTruth = msTruth;
|
||||
demangleAndTest();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSpecialNames_R() throws Exception {
|
||||
mangled = "??_R0X@8";
|
||||
|
@ -56,6 +56,28 @@ public class MDMangExtraTest extends AbstractGenericTest {
|
||||
assertEquals("k::j::i", qualifications.get(2).toString());
|
||||
}
|
||||
|
||||
// Backref used in parentage
|
||||
@Test
|
||||
public void testVxTableNestedQualificationWithBackref() throws Exception {
|
||||
String mangled = "??_7a@b@@6B01@@";
|
||||
String truth = "const b::a::`vftable'{for `b::a'}";
|
||||
|
||||
MDMangGhidra demangler = new MDMangGhidra();
|
||||
demangler.setMangledSymbol(mangled);
|
||||
demangler.setErrorOnRemainingChars(true);
|
||||
demangler.setDemangleOnlyKnownPatterns(true);
|
||||
MDParsableItem item = demangler.demangle();
|
||||
|
||||
String demangled = item.toString();
|
||||
assertEquals(truth, demangled);
|
||||
|
||||
MDObjectCPP cppItem = (MDObjectCPP) item;
|
||||
MDVxTable vxTable = (MDVxTable) cppItem.getTypeInfo();
|
||||
List<MDQualification> qualifications = vxTable.getNestedQualifications();
|
||||
assertEquals(1, qualifications.size());
|
||||
assertEquals("b::a", qualifications.get(0).toString());
|
||||
}
|
||||
|
||||
// Need to test the demangleType() method to make sure it does the retry with LLVM mode
|
||||
@Test
|
||||
public void testDemangleTypeWithRetry() throws Exception {
|
||||
|
Loading…
Reference in New Issue
Block a user