GP-5014 - MDMang - add tests for vxtable parentage coded as backref

This commit is contained in:
ghizard 2024-10-15 11:37:01 +00:00
parent d4a3e7d4bf
commit 6ff6b26cb7
2 changed files with 31 additions and 0 deletions

View File

@ -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";

View File

@ -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 {