Merge remote-tracking branch 'origin/GP-6490_ghizard_MDMang_create_MDObjectUnknownReserved'

This commit is contained in:
Ryan Kurtz
2026-02-26 05:12:58 -05:00
4 changed files with 58 additions and 16 deletions

View File

@@ -182,15 +182,11 @@ public class MicrosoftDemanglerUtil {
return result;
}
private static DemangledObject processObjectReserved(
MDObjectReserved objectReserved,
private static DemangledObject processObjectReserved(MDObjectReserved objectReserved,
String mangled, String demangledSource) {
DemangledObject object = null;
if (objectReserved.getClass().equals(MDObjectReserved.class)) {
//Testing if the class is not a derived class of MDObjectReserved;
// In other words, is it exactly a MDObjectReserved?
// If so, then return null, which will allow it to get processed
// outside of the demangler.
if (objectReserved instanceof MDObjectUnknownReserved) {
// Return null to allow it to get processed outside of demangler
return null;
}
if (objectReserved instanceof MDObjectBracket objectBracket) {

View File

@@ -4,9 +4,9 @@
* 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.
@@ -267,7 +267,7 @@ public class MDMangObjectParser {
__real@0000000000000000
__real@3f1a36e2eb1c432d
*/
item = new MDObjectReserved(dmang);
item = new MDObjectUnknownReserved(dmang);
}
return item;
}

View File

@@ -4,9 +4,9 @@
* 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.
@@ -23,7 +23,7 @@ import mdemangler.MDMang;
* to parse. If just this base class is assigned, then we plan to allow a fall-through for
* other processing outside of the demangler.
*/
public class MDObjectReserved extends MDObject {
public abstract class MDObjectReserved extends MDObject {
public MDObjectReserved(MDMang dmang) {
super(dmang);
@@ -55,6 +55,3 @@ public class MDObjectReserved extends MDObject {
return ret;
}
}
/******************************************************************************/
/******************************************************************************/

View File

@@ -0,0 +1,49 @@
/* ###
* 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.object;
import mdemangler.MDException;
import mdemangler.MDMang;
/**
* This class represents MSFT Reserved Symbols that have unknown purpose. Whenever an object
* that falls into this class is later recognizable, a new child of {@link MDObjectReserved}
* should be created for it
*/
public class MDObjectUnknownReserved extends MDObjectReserved {
private String remainder;
public MDObjectUnknownReserved(MDMang dmang) {
super(dmang);
}
@Override
public void insert(StringBuilder builder) {
super.insert(builder);
builder.append(remainder);
}
@Override
protected void parseInternal() throws MDException {
String m = dmang.getMangledSymbol();
int index = dmang.getIndex();
remainder = m.substring(index);
//Go to end of string.
dmang.increment(dmang.getMangledSymbol().length() - dmang.getIndex());
}
}