Merge remote-tracking branch 'origin/GP-5014_ghizard_MDMang_add_tests_for_vxtable_parentage_coded_as_backref'

This commit is contained in:
Ryan Kurtz 2024-10-15 13:48:58 -04:00
commit 9d67b8c6ef
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 {