GT-ghizard_MDMang more ExtendedDataTypes

This commit is contained in:
ghizard 2020-05-15 21:46:04 -04:00
parent f9c76fcaed
commit f7bcece047
9 changed files with 308 additions and 0 deletions

View file

@ -316,6 +316,27 @@ public class MDDataTypeParser {
// is a "ModifiedType")--investigate further // is a "ModifiedType")--investigate further
dt = new MDArrayBasicType(dmang); dt = new MDArrayBasicType(dmang);
break; break;
case 'P':
dt = new MDUnknownPExtendedDataType(dmang);
break;
case 'Q':
dt = new MDChar8DataType(dmang);
break;
case 'R':
dt = new MDUnknownRExtendedDataType(dmang);
break;
case 'S':
dt = new MDChar16DataType(dmang);
break;
case 'T':
dt = new MDUnknownTExtendedDataType(dmang);
break;
case 'U':
dt = new MDChar32DataType(dmang);
break;
case 'V':
dt = new MDUnknownVExtendedDataType(dmang);
break;
case 'W': case 'W':
dt = new MDWcharDataType(dmang); dt = new MDWcharDataType(dmang);
break; break;

View file

@ -0,0 +1,33 @@
/* ###
* IP: GHIDRA
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package mdemangler.datatype.extended;
import mdemangler.MDMang;
/**
* This class represents an char16_t data type within a Microsoft mangled symbol.
*/
public class MDChar16DataType extends MDExtendedType {
public MDChar16DataType(MDMang dmang) {
super(dmang);
}
@Override
public String getTypeName() {
return "char16_t";
}
}

View file

@ -0,0 +1,33 @@
/* ###
* IP: GHIDRA
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package mdemangler.datatype.extended;
import mdemangler.MDMang;
/**
* This class represents an char32_t data type within a Microsoft mangled symbol.
*/
public class MDChar32DataType extends MDExtendedType {
public MDChar32DataType(MDMang dmang) {
super(dmang);
}
@Override
public String getTypeName() {
return "char32_t";
}
}

View file

@ -0,0 +1,33 @@
/* ###
* IP: GHIDRA
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package mdemangler.datatype.extended;
import mdemangler.MDMang;
/**
* This class represents an char8_t data type within a Microsoft mangled symbol.
*/
public class MDChar8DataType extends MDExtendedType {
public MDChar8DataType(MDMang dmang) {
super(dmang);
}
@Override
public String getTypeName() {
return "char8_t";
}
}

View file

@ -0,0 +1,33 @@
/* ###
* IP: GHIDRA
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package mdemangler.datatype.extended;
import mdemangler.MDMang;
/**
* This class represents an _P Extended data type within a Microsoft mangled symbol.
*/
public class MDUnknownPExtendedDataType extends MDExtendedType {
public MDUnknownPExtendedDataType(MDMang dmang) {
super(dmang);
}
@Override
public String getTypeName() {
return "UNKNOWN";
}
}

View file

@ -0,0 +1,33 @@
/* ###
* IP: GHIDRA
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package mdemangler.datatype.extended;
import mdemangler.MDMang;
/**
* This class represents an _R Extended data type within a Microsoft mangled symbol.
*/
public class MDUnknownRExtendedDataType extends MDExtendedType {
public MDUnknownRExtendedDataType(MDMang dmang) {
super(dmang);
}
@Override
public String getTypeName() {
return "<unknown>";
}
}

View file

@ -0,0 +1,33 @@
/* ###
* IP: GHIDRA
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package mdemangler.datatype.extended;
import mdemangler.MDMang;
/**
* This class represents an _T Extended data type within a Microsoft mangled symbol.
*/
public class MDUnknownTExtendedDataType extends MDExtendedType {
public MDUnknownTExtendedDataType(MDMang dmang) {
super(dmang);
}
@Override
public String getTypeName() {
return "UNKNOWN";
}
}

View file

@ -0,0 +1,33 @@
/* ###
* IP: GHIDRA
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package mdemangler.datatype.extended;
import mdemangler.MDMang;
/**
* This class represents an _V Extended data type within a Microsoft mangled symbol.
*/
public class MDUnknownVExtendedDataType extends MDExtendedType {
public MDUnknownVExtendedDataType(MDMang dmang) {
super(dmang);
}
@Override
public String getTypeName() {
return "UNKNOWN";
}
}

View file

@ -1557,6 +1557,62 @@ public class MDMangBaseTest extends AbstractGenericTest {
demangleAndTest(); demangleAndTest();
} }
@Test
public void testExtendedTypes__P() throws Exception {
mangled = "?Name@@3_PA";
msTruth = "UNKNOWN Name";
mdTruth = msTruth;
demangleAndTest();
}
@Test
public void testExtendedTypes__Q() throws Exception {
mangled = "?Name@@3_QA";
msTruth = "char8_t Name";
mdTruth = msTruth;
demangleAndTest();
}
@Test
public void testExtendedTypes__R() throws Exception {
mangled = "?Name@@3_RA";
msTruth = "<unknown> Name";
mdTruth = msTruth;
demangleAndTest();
}
@Test
public void testExtendedTypes__S() throws Exception {
mangled = "?Name@@3_SA";
msTruth = "char16_t Name";
mdTruth = msTruth;
demangleAndTest();
}
@Test
public void testExtendedTypes__T() throws Exception {
mangled = "?Name@@3_TA";
msTruth = "UNKNOWN Name";
mdTruth = msTruth;
demangleAndTest();
}
@Test
public void testExtendedTypes__U() throws Exception {
mangled = "?Name@@3_UA";
msTruth = "char32_t Name";
mdTruth = msTruth;
demangleAndTest();
}
@Test
public void testExtendedTypes__V() throws Exception {
mangled = "?Name@@3_VA";
msTruth = "UNKNOWN Name";
mdTruth = msTruth;
demangleAndTest();
}
@Test @Test
public void testExtendedTypes__W() throws Exception { public void testExtendedTypes__W() throws Exception {
mangled = "?Name@@3_WA"; mangled = "?Name@@3_WA";