Package ghidra.trace.database.program
Class DBTraceProgramViewRootModule
java.lang.Object
ghidra.trace.database.program.DBTraceProgramViewRootModule
- All Implemented Interfaces:
Group,ProgramModule
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ProgramModule[]protected final AbstractDBTraceProgramViewListingprotected final DBTraceProgramView -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(ProgramFragment fragment) Adds the given fragment as a child of this module.voidadd(ProgramModule module) Adds the given module as a child of this module.booleanReturns whether this fragment contains the given code unit.booleancontains(ProgramFragment fragment) Returns whether this module directly contains the given fragment as a child.booleancontains(ProgramModule module) Returns whether this module directly contains the given module as a child.createFragment(String fragmentName) Creates a new fragment and makes it a child of this module.createModule(String moduleName) Creates a new module and makes it a child of this module.Returns the set of addresses for this module which will be the combined set of addresses from the set of all fragments which are descendants of this module.Group[]Returns an array containing this module's children.Obtains the comment that has been associated with this fragment or module.Returns the first address of this module which will be the minimum address of the first descendant fragment which is non-empty.intGet the index of the child with the given name.Returns the last address of this module which will be the maximum address of the last descendant fragment which is non-empty.Returns the maximum address of this module which will be the maximum address from the set of all fragments which are descendants of this module.Returns the minimum address of this module which will be the minimum address from the set of all fragments which are descendants of this module.longGet the current modification number of the module tree; the number is updated when ever a change is made to any module or fragment that is part of this module's root tree.getName()Obtains the name that has been associated with this fragment.intReturns the number of children of this module.intObtains the number of parent's of this fragment.String[]Returns the names of the modules which are parents to this fragment.Returns a list of the modules which are parents for this group.longGet the ID for the tree that this module belongs to.Returns the name of the tree that this group belongs to.Returns an object that can be used to detect when the module tree has been affected by an undo or redo.booleanReturns true if this group has been deleted from the programbooleanisDescendant(ProgramFragment fragment) Returns whether the given fragment is a descendant of this module.booleanisDescendant(ProgramModule module) Returns whether the given module is a descendant of this module.voidChanges the ordering of this module's children by moving the child with the given name to position given by index.protected <T> TreduceRegions(Function<TraceMemoryRegion, T> func, BiFunction<T, T, T> reducer) booleanremoveChild(String name) Removes a child module or fragment from this Module.voidreparent(String name, ProgramModule oldParent) Reparents child with the given name to this Module; removes the child from oldParent.voidsetComment(String comment) Sets the comment to associate with this fragment.voidSets the name of this fragment.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ghidra.program.model.listing.Group
getGroupPath
-
Field Details
-
EMPTY_MODULE_ARRAY
-
program
-
listing
-
-
Constructor Details
-
DBTraceProgramViewRootModule
-
-
Method Details
-
getComment
Description copied from interface:GroupObtains the comment that has been associated with this fragment or module.- Specified by:
getCommentin interfaceGroup- Returns:
- may be null.
-
setComment
Description copied from interface:GroupSets the comment to associate with this fragment.- Specified by:
setCommentin interfaceGroup- Parameters:
comment- the comment.
-
getName
Description copied from interface:GroupObtains the name that has been associated with this fragment. A fragment will always have a name and it will be unique within the set of all fragment and module names. -
setName
Description copied from interface:GroupSets the name of this fragment.- Specified by:
setNamein interfaceGroup- Parameters:
name- the string to use for the fragment's name.- Throws:
DuplicateNameException- thrown if the name being set is already in use by another fragment or a module.
-
contains
Description copied from interface:GroupReturns whether this fragment contains the given code unit. -
getNumParents
public int getNumParents()Description copied from interface:GroupObtains the number of parent's of this fragment. If a fragment is in a module then the module is a parent of the fragment and the fragment is a child of the module. A fragment must have at least one parent and it may have multiple parents.- Specified by:
getNumParentsin interfaceGroup- Returns:
- the number of parents of this fragment.
-
getParents
Description copied from interface:GroupReturns a list of the modules which are parents for this group.- Specified by:
getParentsin interfaceGroup
-
getParentNames
Description copied from interface:GroupReturns the names of the modules which are parents to this fragment.- Specified by:
getParentNamesin interfaceGroup
-
getTreeName
Description copied from interface:GroupReturns the name of the tree that this group belongs to.- Specified by:
getTreeNamein interfaceGroup
-
contains
Description copied from interface:ProgramModuleReturns whether this module directly contains the given fragment as a child.- Specified by:
containsin interfaceProgramModule- Parameters:
fragment- the fragment to check.
-
contains
Description copied from interface:ProgramModuleReturns whether this module directly contains the given module as a child.- Specified by:
containsin interfaceProgramModule- Parameters:
module- the module to check.- Returns:
- true if module is the same as this module, or if module is a child of this module.
-
getNumChildren
public int getNumChildren()Description copied from interface:ProgramModuleReturns the number of children of this module.- Specified by:
getNumChildrenin interfaceProgramModule
-
getChildren
Description copied from interface:ProgramModuleReturns an array containing this module's children.- Specified by:
getChildrenin interfaceProgramModule
-
getIndex
Description copied from interface:ProgramModuleGet the index of the child with the given name.- Specified by:
getIndexin interfaceProgramModule- Parameters:
name- name of child- Returns:
- int index or -1 if this Module does not have a child with the given name
-
add
Description copied from interface:ProgramModuleAdds the given module as a child of this module.- Specified by:
addin interfaceProgramModule- Parameters:
module- the module to be added.- Throws:
CircularDependencyException- thrown if the module being added is an ancestor of this module. The module structure of a program does not allow "cycles" of this sort to be created.DuplicateGroupException- thrown if the module being added is already a child of this module.
-
add
Description copied from interface:ProgramModuleAdds the given fragment as a child of this module.- Specified by:
addin interfaceProgramModule- Throws:
DuplicateGroupException- thrown if the fragment being added is already a child of this module.
-
createModule
Description copied from interface:ProgramModuleCreates a new module and makes it a child of this module.- Specified by:
createModulein interfaceProgramModule- Parameters:
moduleName- the name to use for the new module.- Returns:
- the newly created module.
- Throws:
DuplicateNameException- thrown if the given name is already used by an existing module or fragment.
-
createFragment
Description copied from interface:ProgramModuleCreates a new fragment and makes it a child of this module.- Specified by:
createFragmentin interfaceProgramModule- Parameters:
fragmentName- the name to use for the new fragment.- Returns:
- the newly created fragment.
- Throws:
DuplicateNameException- thrown if the given name is already used by an existing module or fragment.
-
reparent
Description copied from interface:ProgramModuleReparents child with the given name to this Module; removes the child from oldParent.- Specified by:
reparentin interfaceProgramModule- Parameters:
name- name of child to reparentoldParent- old parent- Throws:
NotFoundException- if name is not the name of a child in oldParent
-
moveChild
Description copied from interface:ProgramModuleChanges the ordering of this module's children by moving the child with the given name to position given by index.- Specified by:
moveChildin interfaceProgramModule- Parameters:
name- the name of the child to move.index- the index to move it to.- Throws:
NotFoundException- thrown if a child with the given name cannot be found in this module.
-
removeChild
Description copied from interface:ProgramModuleRemoves a child module or fragment from this Module.- Specified by:
removeChildin interfaceProgramModule- Returns:
- true if successful, false if no child in this module has the given name.
- Throws:
NotEmptyException- thrown if the module appears in no other modules and it is not empty.
-
isDescendant
Description copied from interface:ProgramModuleReturns whether the given module is a descendant of this module.- Specified by:
isDescendantin interfaceProgramModule- Parameters:
module- the module to check.- Returns:
- true if the module is a descendant, false otherwise.
-
isDescendant
Description copied from interface:ProgramModuleReturns whether the given fragment is a descendant of this module.- Specified by:
isDescendantin interfaceProgramModule- Parameters:
fragment- the fragment to check.- Returns:
- true if the fragment is a descendant, false otherwise.
-
reduceRegions
-
getMinAddress
Description copied from interface:ProgramModuleReturns the minimum address of this module which will be the minimum address from the set of all fragments which are descendants of this module.- Specified by:
getMinAddressin interfaceGroup- Specified by:
getMinAddressin interfaceProgramModule- Returns:
- the minimum address, this will be null if all of the module's descendant fragments are empty.
-
getMaxAddress
Description copied from interface:ProgramModuleReturns the maximum address of this module which will be the maximum address from the set of all fragments which are descendants of this module.- Specified by:
getMaxAddressin interfaceGroup- Specified by:
getMaxAddressin interfaceProgramModule- Returns:
- the maximum address, this will be null if all of the module's descendant fragments are empty.
-
getFirstAddress
Description copied from interface:ProgramModuleReturns the first address of this module which will be the minimum address of the first descendant fragment which is non-empty. In other words this returns the first address for this module as defined by the user ordering of the module's children.- Specified by:
getFirstAddressin interfaceProgramModule- Returns:
- the first address, this will be null if all of the module's descendant fragments are empty.
-
getLastAddress
Description copied from interface:ProgramModuleReturns the last address of this module which will be the maximum address of the last descendant fragment which is non-empty. In other words this returns the last address for this module as defined by the user ordering of the module's children.- Specified by:
getLastAddressin interfaceProgramModule- Returns:
- the last address, this will be null if all of the module's descendant fragments are empty.
-
getAddressSet
Description copied from interface:ProgramModuleReturns the set of addresses for this module which will be the combined set of addresses from the set of all fragments which are descendants of this module.- Specified by:
getAddressSetin interfaceProgramModule- Returns:
- the complete address set for this module.
-
getVersionTag
Description copied from interface:ProgramModuleReturns an object that can be used to detect when the module tree has been affected by an undo or redo. After an undo/redo, if this module was affected, then a new verionTag object is created.- Specified by:
getVersionTagin interfaceProgramModule
-
getModificationNumber
public long getModificationNumber()Description copied from interface:ProgramModuleGet the current modification number of the module tree; the number is updated when ever a change is made to any module or fragment that is part of this module's root tree.- Specified by:
getModificationNumberin interfaceProgramModule
-
getTreeID
public long getTreeID()Description copied from interface:ProgramModuleGet the ID for the tree that this module belongs to.- Specified by:
getTreeIDin interfaceProgramModule- Returns:
- ID for the tree
-
isDeleted
public boolean isDeleted()Description copied from interface:GroupReturns true if this group has been deleted from the program
-