mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-09-28 17:11:11 -09:00
Merge remote-tracking branch
'origin/GP-1-dragonmacher-gnu-demangler-template-pointer-cast' into patch (#8900)
This commit is contained in:
@@ -162,13 +162,27 @@ public class GnuDemanglerParser {
|
|||||||
* --the text can have "::" namespace separators (non-capturing group) and
|
* --the text can have "::" namespace separators (non-capturing group) and
|
||||||
* must be followed by more text
|
* must be followed by more text
|
||||||
* --the text can have multiple words, such as (unsigned long)
|
* --the text can have multiple words, such as (unsigned long)
|
||||||
|
* --the text may be followed by 0 or more asterisks
|
||||||
|
*
|
||||||
|
* \(
|
||||||
|
* (?:\\w+\s)* non-capturing letters with a space, optional
|
||||||
|
* \\w+[*]* 1 or more letters
|
||||||
|
* [*]* optional asterisk
|
||||||
|
* (?:::\w+[*]*)* namespace delimiter with 1 or more word characters, optional
|
||||||
|
* [*]* optional asterisk
|
||||||
|
* \)
|
||||||
|
*
|
||||||
|
* \s* optional space
|
||||||
|
* -{0,1} 0 or 1 minus sign
|
||||||
|
* \\w+ 1 or more letters
|
||||||
|
*
|
||||||
* -optional space
|
* -optional space
|
||||||
* -optional '-' character (a negative sign character)
|
* -optional '-' character (a negative sign character)
|
||||||
* -followed by more text (with optional spaces)
|
* -followed by more text (with optional spaces)
|
||||||
* </pre>
|
* </pre>
|
||||||
*/
|
*/
|
||||||
private static final Pattern CAST_PATTERN =
|
private static final Pattern CAST_PATTERN =
|
||||||
Pattern.compile("\\((?:\\w+\\s)*\\w+(?:::\\w+)*\\)\\s*-{0,1}\\w+");
|
Pattern.compile("\\((?:\\w+\\s)*\\w+[*]*(?:::\\w+[*]*)*\\)\\s*-{0,1}\\w+");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Sample: Magick::operator<(Magick::Coordinate const&, Magick::Coordinate const&)
|
* Sample: Magick::operator<(Magick::Coordinate const&, Magick::Coordinate const&)
|
||||||
|
|||||||
@@ -107,6 +107,26 @@ public class GnuDemanglerParserTest extends AbstractGenericTest {
|
|||||||
object.getSignature(false));
|
object.getSignature(false));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testParse_CastInTemplates_ToPointer() throws Exception {
|
||||||
|
|
||||||
|
String mangled =
|
||||||
|
"_ZN3ndk4impl15ScopedAResourceIP7AStatusXadL_Z14AStatus_deleteEELS3_0EEaSEOS4_";
|
||||||
|
String demangled = process.demangle(mangled);
|
||||||
|
assertEquals(
|
||||||
|
"ndk::impl::ScopedAResource<AStatus*, &AStatus_delete, (AStatus*)0>::operator=(ndk::impl::ScopedAResource<AStatus*, &AStatus_delete, (AStatus*)0>&&)",
|
||||||
|
demangled);
|
||||||
|
|
||||||
|
DemangledObject object = parser.parse(mangled, demangled);
|
||||||
|
assertType(object, DemangledFunction.class);
|
||||||
|
assertName(object, "operator=", "ndk", "impl",
|
||||||
|
"ScopedAResource<AStatus*,&AStatus_delete,(AStatus*)0>");
|
||||||
|
|
||||||
|
assertEquals(
|
||||||
|
"undefined ndk::impl::ScopedAResource<AStatus*,&AStatus_delete,(AStatus*)0>::operator=(ndk::impl::ScopedAResource<AStatus *,&AStatus_delete,(AStatus*)0> &&)",
|
||||||
|
object.getSignature(false));
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testParse_MultiDimensionalArray() throws Exception {
|
public void testParse_MultiDimensionalArray() throws Exception {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user