Skip to content

Ghidra is a software reverse engineering (SRE) framework

GP-1734 - fix camel case logic, doc, and add enum to PdbKind

ghizardb151802b05a9
diff --git a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb/PdbKind.java b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb/PdbKind.java
index 61a5339487..52c1d6bfe2 100644
--- a/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb/PdbKind.java
+++ b/Ghidra/Features/PDB/src/main/java/ghidra/app/util/bin/format/pdb/PdbKind.java
@@ -18,13 +18,14 @@ package ghidra.app.util.bin.format.pdb;
public enum PdbKind {
//@formatter:off
- STRUCTURE,
- UNION,
- MEMBER,
- STATIC_LOCAL,
- OBJECT_POINTER,
- PARAMETER,
- LOCAL,
+ STRUCTURE,
+ UNION,
+ MEMBER,
+ STATIC_LOCAL,
+ STATIC_MEMBER,
+ OBJECT_POINTER,
+ PARAMETER,
+ LOCAL,
UNKNOWN;
//@formatter:on
@@ -42,6 +43,13 @@ public enum PdbKind {
return camelName;
}
+ /**
+ * Converts a string to (upper) camel case by converting all letters to lower case except the
+ * first letter of the string and any letter following an underscore; these are converted to
+ * upper case. All underscores are removed from the final string.
+ * @param name the input string
+ * @return the converted string
+ */
private static String toCamel(String name) {
StringBuilder buf = new StringBuilder();
boolean makeUpper = true;
@@ -54,6 +62,9 @@ public enum PdbKind {
c = Character.toUpperCase(c);
makeUpper = false;
}
+ else {
+ c = Character.toLowerCase(c);
+ }
buf.append(c);
}
return buf.toString();
@@ -61,7 +72,7 @@ public enum PdbKind {
/**
* Parse case-insensitive kind string and return corresponding PdbKind.
- * It is expected that kind strings will be camel notation (e.g., OBJECT_POINTER
+ * It is expected that kind strings will be camel notation (e.g., OBJECT_POINTER
* kind string would be ObjectPointer).
* If not identified UNKNOWN will be returned.
* @param kind kind string (underscores not permitted)