diff --git a/Ghidra/Features/Base/certification.manifest b/Ghidra/Features/Base/certification.manifest index 6fbeea6a06..c1f70ee0b7 100644 --- a/Ghidra/Features/Base/certification.manifest +++ b/Ghidra/Features/Base/certification.manifest @@ -798,7 +798,6 @@ src/main/resources/images/field.header.up.png||GHIDRA||||END| src/main/resources/images/fingerPointer.png||GHIDRA||||END| src/main/resources/images/flag-green.png||Oxygen Icons - LGPL 3.0|||Oxygen icon theme (dual license; LGPL or CC-SA-3.0)|END| src/main/resources/images/flag-yellow.png||Oxygen Icons - LGPL 3.0|||Oxygen icon theme (dual license; LGPL or CC-SA-3.0)|END| -src/main/resources/images/font.png||FAMFAMFAM Icons - CC 2.5||||END| src/main/resources/images/format-text-bold.png||Tango Icons - Public Domain|||tango icon set|END| src/main/resources/images/functionDef.png||GHIDRA||||END| src/main/resources/images/function_graph.png||FAMFAMFAM Icons - CC 2.5|||famfamfam silk icon set|END| diff --git a/Ghidra/Features/Base/src/main/help/help/topics/Navigation/Navigation.htm b/Ghidra/Features/Base/src/main/help/help/topics/Navigation/Navigation.htm index 739b731d61..d29d4dd35a 100644 --- a/Ghidra/Features/Base/src/main/help/help/topics/Navigation/Navigation.htm +++ b/Ghidra/Features/Base/src/main/help/help/topics/Navigation/Navigation.htm @@ -25,6 +25,9 @@
- - - -diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/navigation/NextPrevAddressPlugin.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/navigation/NextPrevAddressPlugin.java index 6c548044b9..272beab831 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/navigation/NextPrevAddressPlugin.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/navigation/NextPrevAddressPlugin.java @@ -69,8 +69,7 @@ public class NextPrevAddressPlugin extends Plugin { private static final String PREVIOUS_ACTION_NAME = "Previous Location in History"; private static final String NEXT_ACTION_NAME = "Next Location in History"; - private static final String PREVIOUS_FUNCTION_ACTION_NAME = - "Previous Function in History"; + private static final String PREVIOUS_FUNCTION_ACTION_NAME = "Previous Function in History"; private static final String NEXT_FUNCTION_ACTION_NAME = "Next Function in History"; private static final String[] CLEAR_MENUPATH = { "Navigation", "Clear History" }; @@ -114,6 +113,10 @@ public class NextPrevAddressPlugin extends Plugin { return nextFunctionAction; } + DockingAction getClearHistoryAction() { + return clearAction; + } + //================================================================================================== // Private Methods //================================================================================================== diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/navigation/ProgramStartingLocationOptions.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/navigation/ProgramStartingLocationOptions.java new file mode 100644 index 0000000000..e898877589 --- /dev/null +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/navigation/ProgramStartingLocationOptions.java @@ -0,0 +1,175 @@ +/* ### + * 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 ghidra.app.plugin.core.navigation; + +import java.util.ArrayList; +import java.util.List; + +import ghidra.GhidraOptions; +import ghidra.framework.options.*; +import ghidra.framework.plugintool.PluginTool; +import ghidra.util.HelpLocation; + +/** + * Class for managing the options associated with the {@link ProgramStartingLocationPlugin} + */ +public class ProgramStartingLocationOptions implements OptionsChangeListener { + + static final String NAVIGATION_TOPIC = "Navigation"; + public static final String SUB_OPTION = "Starting Program Location"; + public static final String START_LOCATION_TYPE_OPTION = SUB_OPTION + ".Start At: "; + public static final String START_SYMBOLS_OPTION = SUB_OPTION + ".Start Symbols: "; + public static final String UNDERSCORE_OPTION = SUB_OPTION + ".Use Underscores:"; + + private static final String START_LOCATION_DESCRIPTION = + "Determines the start location for newly opened programs.\n" + + "Either lowest address, lowest code address, or symbol name.\nEach higher " + + "option will revert to the next lower option if that option can't be satisfied."; + private static final String STARTING_SYSMBOLS_DESCRIPTION = + "A comma separated list of symbol names in preference order. " + + "(Used when option above is set to \"Preferred Symbol Name\")"; + private static final String SYMBOL_PREFIX_DESCRIPTION = + "When searching for symbols, also search for the names prepended with \"_\" and \"__\"."; + + private static final String DEFAULT_STARTING_SYMBOLS = + "main, WinMain, libc_start_main, WinMainStartup, start, entry"; + + public static enum StartLocationType { + LOWEST_ADDRESS("Lowest Address"), + LOWEST_CODE_BLOCK("Lowest Code Block Address"), + SYMBOL_NAME("Preferred Symbol Name"); + + private String label; + + private StartLocationType(String label) { + this.label = label; + } + + @Override + public String toString() { + return label; + } + } + + private StartLocationType startLocationType; + private List'Go To' in Current Program Only - @@ -788,6 +787,32 @@ range being navigated.
+Starting Program Location Options
+The staring location for newly opened programs can be configured using the following + options:
+++Start At - Choose a starting program location option: +
+
+ +- Lowest Address - The program will open at the lowest address.
+- Lowest Code Block Address - The program will open at the firest executable + memory block. If no executable block found, it will go to lowest address.
+- Preferred Symbol Name - The program will open at the first symbol name it + finds that matches a name in the "Start Symbols" option. If no symbol is found, + it will try the lowest code block, and finally the lowest address.
+Start Symbols - A comma separated list of symbol names to be be used as the + starting location for the program if the "Preferred Symbol Name" option is selected + above. The first matching symbol found will be used as the starting location for + newly opened programs.
+ +Use Underscores - If selected, each of the preferred symbols listed above + will also be searched for with either one or two underscores prepended to the name. For + example, if selected, it will search for "_main" and "__main" in addition to "main" + when trying to find a starting symbol.
+ +
NOTE: This method will not return a default thunk (i.e., thunk function symbol with default source type) + * since it mirrors the name and parent namespace of the function it thunks.
+ * + * @param name the name of the symbols to search for. + * @param namespace the namespace to search. If null, then the global namespace is assumed. + * @return a list of all the label or function symbols with the given name in the given namespace. + * @throws IllegalArgumentException namespace which does not correspond to this + * symbol table's program. +>>>>>>> ba3dc0f GP-2141 adding feature for better starting location when opening a program. */ public ListNOTE: The resulting iterator will not return default thunks (i.e., + * thunk function symbol with default source type).
+ * + * @param name the name of the symbols to retrieve. + * @param namespace the namespace to search for symbols. + * @return all symbols which satisfy specified criteria + * @throws IllegalArgumentException namespace which does not correspond to this + * symbol table's program. +>>>>>>> ba3dc0f GP-2141 adding feature for better starting location when opening a program. */ public List* The returned namespace can be a generic namespace ({@link SymbolType#NAMESPACE}, @@ -310,6 +374,16 @@ public interface SymbolTable { * @return the namespace with the given name in the given parent namespace * @throws IllegalArgumentException if the given parent namespace is from a different program * than that of this symbol table +======= + * Returns the namespace with the given name in the given parent namespace. The namespace + * returned can be either a generic namespace or a class or library. It does not include + * functions. + * @param name the name of the namespace to be retrieved. + * @param namespace the parent namespace of the namespace to be retrieved. + * @return the namespace with the given name in the given parent namespace. + * @throws IllegalArgumentException namespace which does not correspond to this + * symbol table's program. +>>>>>>> ba3dc0f GP-2141 adding feature for better starting location when opening a program. */ public Namespace getNamespace(String name, Namespace namespace); @@ -405,10 +479,20 @@ public interface SymbolTable { * NOTE: The resulting iterator will not return default thunks (i.e., thunk function * symbol with default source type). * +<<<<<<< Upstream, based on origin/master * @param namespace the namespace to search for symbols * @return an iterator over the symbols * @throws IllegalArgumentException if the given parent namespace is from a different program * than that of this symbol table +======= + *
NOTE: The resulting iterator will not return default thunks (i.e., + * thunk function symbol with default source type).
+ * + * @param namespace the namespace to search for symbols. + * @return symbol iterator + * @throws IllegalArgumentException namespace which does not correspond to this + * symbol table's program. +>>>>>>> ba3dc0f GP-2141 adding feature for better starting location when opening a program. */ public SymbolIterator getSymbols(Namespace namespace);