diff --git a/Ghidra/Debug/Debugger-rmi-trace/src/main/help/help/TOC_Source.xml b/Ghidra/Debug/Debugger-rmi-trace/src/main/help/help/TOC_Source.xml index f1cf058f62..601c01c4bf 100644 --- a/Ghidra/Debug/Debugger-rmi-trace/src/main/help/help/TOC_Source.xml +++ b/Ghidra/Debug/Debugger-rmi-trace/src/main/help/help/TOC_Source.xml @@ -1,13 +1,16 @@ - - + + + - - + + + + diff --git a/Ghidra/Debug/Debugger/src/main/help/help/TOC_Source.xml b/Ghidra/Debug/Debugger/src/main/help/help/TOC_Source.xml index df3643637d..749040e985 100644 --- a/Ghidra/Debug/Debugger/src/main/help/help/TOC_Source.xml +++ b/Ghidra/Debug/Debugger/src/main/help/help/TOC_Source.xml @@ -6,7 +6,7 @@ target="help/topics/Debugger/Debugger.html"> + sortgroup="b" + target="help/topics/Debugger/Troubleshooting.html" /> + sortgroup="c" + target="help/topics/DebuggerConsolePlugin/DebuggerConsolePlugin.html" /> + sortgroup="d" + target="help/topics/DebuggerCopyActionsPlugin/DebuggerCopyActionsPlugin.html" /> + sortgroup="e" + target="help/topics/DebuggerModelPlugin/DebuggerModelPlugin.html" /> - + + sortgroup="h" + target="help/topics/DebuggerEmulationServicePlugin/DebuggerEmulationServicePlugin.html" /> - + - + - + - + - + - + - + - + + sortgroup="r" + target="help/topics/DebuggerWatchesPlugin/DebuggerWatchesPlugin.html" /> + sortgroup="s" + target="help/topics/VariableValueHoverPlugin/VariableValueHoverPlugin.html" /> + sortgroup="t" + target="help/topics/DebuggerControlPlugin/DebuggerControlPlugin.html" /> + sortgroup="u" + target="help/topics/DebuggerMemviewPlugin/DebuggerMemviewPlugin.html" /> + sortgroup="v" + target="help/topics/DebuggerPcodeStepperPlugin/DebuggerPcodeStepperPlugin.html" /> - + sortgroup="w" + target="help/topics/DebuggerTraceViewDiffPlugin/DebuggerTraceViewDiffPlugin.html" /> + + sortgroup="x" + target="help/topics/DebuggerPlatformPlugin/DebuggerPlatformPlugin.html" /> diff --git a/Ghidra/Features/Base/src/main/help/help/TOC_Source.xml b/Ghidra/Features/Base/src/main/help/help/TOC_Source.xml index 0fbf5ed0d9..822cdadb25 100644 --- a/Ghidra/Features/Base/src/main/help/help/TOC_Source.xml +++ b/Ghidra/Features/Base/src/main/help/help/TOC_Source.xml @@ -140,8 +140,8 @@ - - + + @@ -166,10 +166,10 @@ - - - - + + + + @@ -189,7 +189,7 @@ - + @@ -198,7 +198,7 @@ - + @@ -222,23 +222,23 @@ - + - + - - + + - + - + @@ -256,14 +256,14 @@ - + - + @@ -276,7 +276,7 @@ - + @@ -292,7 +292,7 @@ - + @@ -307,24 +307,24 @@ - - - - - - + + + + + + - + - + @@ -336,7 +336,7 @@ - + @@ -347,18 +347,18 @@ - - - - - - - - - - - - + + + + + + + + + + + + diff --git a/Ghidra/Features/PDB/src/main/help/help/TOC_Source.xml b/Ghidra/Features/PDB/src/main/help/help/TOC_Source.xml index 3f5a75b04e..cd29ebf273 100644 --- a/Ghidra/Features/PDB/src/main/help/help/TOC_Source.xml +++ b/Ghidra/Features/PDB/src/main/help/help/TOC_Source.xml @@ -50,7 +50,7 @@ - + diff --git a/Ghidra/Features/Sarif/src/main/help/help/TOC_Source.xml b/Ghidra/Features/Sarif/src/main/help/help/TOC_Source.xml index 5e2d0e0008..d88893ccd2 100644 --- a/Ghidra/Features/Sarif/src/main/help/help/TOC_Source.xml +++ b/Ghidra/Features/Sarif/src/main/help/help/TOC_Source.xml @@ -50,7 +50,7 @@ - + diff --git a/Ghidra/Framework/Help/src/main/java/help/OverlayHelpTree.java b/Ghidra/Framework/Help/src/main/java/help/OverlayHelpTree.java index 9a82521dfc..4dd3441313 100644 --- a/Ghidra/Framework/Help/src/main/java/help/OverlayHelpTree.java +++ b/Ghidra/Framework/Help/src/main/java/help/OverlayHelpTree.java @@ -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. @@ -224,6 +224,8 @@ public class OverlayHelpTree { writer.println(item.generateTOCItemTag(linkDatabase, children.isEmpty(), indentLevel)); if (!children.isEmpty()) { + validateChildrenSortGroups(); + for (OverlayNode node : children) { node.print(sourceFileID, writer, indentLevel + 1); } @@ -231,6 +233,35 @@ public class OverlayHelpTree { } } + // Note: this method will validate all TOC files for a given module, including its + // dependencies. If module A has a dependent B, A and B will be checked for re-used sort + // groups. This will not get sibling TOC issues that are found at runtime. In this case, + // considering module A with dependents B1 and B2, in separate unrelated modules, then if + // B1 and B2 share a sort group, this method will not detected that. This is because when + // building either B1 or B2, the other module is not available, since it is not a dependent + // module. + private void validateChildrenSortGroups() { + Map sortPreferences = new HashMap<>(); + for (OverlayNode child : children) { + String sortPreference = child.item.getSortPreference(); + OverlayNode existingNode = sortPreferences.get(sortPreference); + if (existingNode != null) { + + String message = """ + Found multiple child nodes with the same 'sortgroup' value. + Sort values must be unique. Duplicated value: '%s' + Parent: %s + First child: %s + Second child: %s + """.formatted(sortPreference, toString(), existingNode.toString(), + child.toString()); + throw new RuntimeException(message); + } + + sortPreferences.put(sortPreference, child); + } + } + void addChild(OverlayNode overlayNode) { children.add(overlayNode); } @@ -256,7 +287,6 @@ public class OverlayHelpTree { } } - // TODO LOOKIE private static final Comparator CHILD_SORT_COMPARATOR = new Comparator() { @Override