Merge remote-tracking branch 'origin/GP-0-dragonmacher-patch-test-fixes-4-2-25' into patch

This commit is contained in:
Ryan Kurtz 2025-04-03 09:33:46 -04:00
commit f3cd8f54b8
4 changed files with 41 additions and 20 deletions

View file

@ -28,14 +28,14 @@
//
//
// Note: these have been disabled. Some binaries have a class namespace with the same name in more
// than one namespace that may include these values. In that case, if we drop these values, then
// instead of 2 distinct namespaces, we will have only 1, which is incorrect. If we decide that
// Note: some of these have been disabled. Some binaries have a class namespace with the same name
// in more than one namespace that may include these values. In that case, if we drop these values,
// then instead of 2 distinct namespaces, we will have only 1, which is incorrect. If we decide that
// these values are not desired, then we will have to figure out a way to create 2 distinct
// namespaces after we apply the simplification.
//
// current tests show this is a non-leading mangled namespace placeholder
//"" ::__1
"" ::__1
// current tests show this is a non-leading mangled namespace placeholder
//"" ::__cxx11

View file

@ -1550,17 +1550,16 @@ public class GnuDemanglerParser {
for (ResourceFile file : files) {
List<String> lines = getReplacementLines(file);
for (String line : lines) {
GnuDemanglerReplacement replacement = parseReplacement(line, file);
if (replacement != null) {
results.add(replacement);
}
parseReplacement(line, file, results);
}
}
return results;
}
private static GnuDemanglerReplacement parseReplacement(String line, ResourceFile file) {
private static void parseReplacement(String line, ResourceFile file,
List<GnuDemanglerReplacement> results) {
for (int i = 0; i < line.length(); i++) {
char c = line.charAt(i);
if (Character.isWhitespace(c)) {
@ -1572,13 +1571,35 @@ public class GnuDemanglerParser {
}
String find = line.substring(i).trim();
return new GnuDemanglerReplacement(find, replace, file);
results.add(new GnuDemanglerReplacement(find, replace, file));
//
// We have disabled some global text replacements. Instead of globally replacing
// them, we will update each replacement to handle the special case when it starts
// at the beginning of the replacement.
//
createAlternateReplacement("std::__cxx11::", find, replace, file, results);
createAlternateReplacement("__gnu_cxx::", find, replace, file, results);
return;
}
}
Msg.warn(GnuDemanglerParser.class,
"Malformed replacement line. No spaces found: " + line + ". In file: " + file);
return null;
}
private static void createAlternateReplacement(String alternate, String find, String replace,
ResourceFile file, List<GnuDemanglerReplacement> results) {
if (!(find.startsWith("std::") && replace.startsWith("std::"))) {
return;
}
String altFind = find.replaceFirst("std::", alternate);
String altReplace = replace.replaceFirst("std::", alternate);
results.add(new GnuDemanglerReplacement(altFind, altReplace, file));
}
private static List<String> getReplacementLines(ResourceFile file) {

View file

@ -197,15 +197,15 @@ public class GnuDemanglerParserTest extends AbstractGenericTest {
List<DemangledParameter> parameters = function.getParameters();
assertEquals(
"__insertion_sort<__normal_iterator<std::pair<unsigned_long,PcodeOp*>*,std::vector<std::pair<unsigned_long,PcodeOp*>,std::allocator<std::pair<unsigned_long,PcodeOp*>>>>,bool(*)(std::pair<unsigned_long,PcodeOp*>const&,std::pair<unsigned_long,PcodeOp*>const&)>",
"__insertion_sort<__gnu_cxx::__normal_iterator<std::pair<unsigned_long,PcodeOp*>*,std::vector<std::pair<unsigned_long,PcodeOp*>,std::allocator<std::pair<unsigned_long,PcodeOp*>>>>,bool(*)(std::pair<unsigned_long,PcodeOp*>const&,std::pair<unsigned_long,PcodeOp*>const&)>",
function.getName());
assertEquals("std", function.getNamespace().getName());
assertEquals(
"__normal_iterator<std::pair<unsigned long,PcodeOp *> *,std::vector<std::pair<unsigned long,PcodeOp *>,std::allocator<std::pair<unsigned long,PcodeOp *>>>>",
"__gnu_cxx::__normal_iterator<std::pair<unsigned long,PcodeOp *> *,std::vector<std::pair<unsigned long,PcodeOp *>,std::allocator<std::pair<unsigned long,PcodeOp *>>>>",
parameters.get(0).toString());
assertEquals(
"__normal_iterator<std::pair<unsigned long,PcodeOp *> *,std::vector<std::pair<unsigned long,PcodeOp *>,std::allocator<std::pair<unsigned long,PcodeOp *>>>>",
"__gnu_cxx::__normal_iterator<std::pair<unsigned long,PcodeOp *> *,std::vector<std::pair<unsigned long,PcodeOp *>,std::allocator<std::pair<unsigned long,PcodeOp *>>>>",
parameters.get(1).toString());
assertEquals(
"bool (*)(std::pair<unsigned long,PcodeOp *> const &,std::pair<unsigned long,PcodeOp *> const &)",
@ -1112,7 +1112,7 @@ public class GnuDemanglerParserTest extends AbstractGenericTest {
String signature = object.getSignature(false);
assertEquals(
"std::string std::_Bind<std::string(EduAppConfigs::*(EduAppConfigs_const*))()const>::operator()<missing_argument,std::string>(void)",
"std::__cxx11::string std::_Bind<std::__cxx11::string(EduAppConfigs::*(EduAppConfigs_const*))()const>::operator()<missing_argument,std::__cxx11::string>(void)",
signature);
}
@ -1145,7 +1145,7 @@ public class GnuDemanglerParserTest extends AbstractGenericTest {
String signature = object.getSignature(false);
assertEquals(
"std::string gsl::to_string<char_const,-1l>(gsl::basic_string_span<char const,long>)",
"std::__cxx11::string gsl::to_string<char_const,-1l>(gsl::basic_string_span<char const,long>)",
signature);
}
@ -1630,7 +1630,7 @@ public class GnuDemanglerParserTest extends AbstractGenericTest {
"vector<boost::function<void()>,std::allocator<boost::function<void()>>>");
assertEquals(
"undefined std::vector<boost::function<void()>,std::allocator<boost::function<void()>>>::_M_insert_aux(__normal_iterator<boost::function<void ()> *,std::vector<boost::function<void ()>,std::allocator<boost::function<void ()>>>>,boost::function<void ()> const &)",
"undefined std::vector<boost::function<void()>,std::allocator<boost::function<void()>>>::_M_insert_aux(__gnu_cxx::__normal_iterator<boost::function<void ()> *,std::vector<boost::function<void ()>,std::allocator<boost::function<void ()>>>>,boost::function<void ()> const &)",
object.getSignature(false));
}
@ -1770,7 +1770,7 @@ public class GnuDemanglerParserTest extends AbstractGenericTest {
String signature = object.getSignature(false);
assertEquals("undefined " +
"__stoa<long,int,char,int>(long(*)(char_const*,char**,int),char_const*,char_const*,unsigned_long*,int)" +
"__gnu_cxx::__stoa<long,int,char,int>(long(*)(char_const*,char**,int),char_const*,char_const*,unsigned_long*,int)" +
"::_Save_errno::_Save_errno(void)", signature);
}

View file

@ -154,14 +154,14 @@ public class GnuDemanglerTest extends AbstractGenericTest {
assertNotNull(dobj);
String signature = dobj.getSignature();
assertEquals("undefined Greeter::greet(std::string)", signature);
assertEquals("undefined Greeter::greet(std::__cxx11::string)", signature);
DemangledParameter demangledParameter = dobj.getParameters().get(0);
DemangledDataType type = demangledParameter.getType();
DataType dt = type.getDataType(program.getDataTypeManager());
assertTrue(dt.isNotYetDefined());
//@formatter:off
assertEquals("/Demangler/std/string\n" +
assertEquals("/Demangler/std/__cxx11/string\n" +
"pack(disabled)\n" +
"Structure string {\n" +
"}\n" +