Skip to content

Commit

Permalink
GP-4574 - Added support to create transient symbol tables from the
Browse files Browse the repository at this point in the history
Symbol Tree, Symbol Table and other transient symbol tables
  • Loading branch information
dragonmacher committed May 21, 2024
1 parent 9911db9 commit 2ffb82d
Show file tree
Hide file tree
Showing 49 changed files with 2,153 additions and 1,595 deletions.
1 change: 1 addition & 0 deletions Ghidra/Features/Base/certification.manifest
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,7 @@ src/main/help/help/topics/SymbolTablePlugin/images/Refs_To.png||GHIDRA||||END|
src/main/help/help/topics/SymbolTablePlugin/images/Symbol_Table.png||GHIDRA||||END|
src/main/help/help/topics/SymbolTablePlugin/symbol_references.htm||GHIDRA||||END|
src/main/help/help/topics/SymbolTablePlugin/symbol_table.htm||GHIDRA||||END|
src/main/help/help/topics/SymbolTablePlugin/symbol_table_transient.htm||GHIDRA||||END|
src/main/help/help/topics/SymbolTreePlugin/SymbolTree.htm||GHIDRA||||END|
src/main/help/help/topics/SymbolTreePlugin/images/CreateExternalLocation.png||GHIDRA||||END|
src/main/help/help/topics/SymbolTreePlugin/images/EditExternalLocation.png||GHIDRA||||END|
Expand Down
1 change: 1 addition & 0 deletions Ghidra/Features/Base/src/main/help/help/TOC_Source.xml
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@
<tocdef id="Symbol Table" text="Symbol Table" target="help/topics/SymbolTablePlugin/symbol_table.htm">
<tocdef id="Symbol References" sortgroup="a" text="Symbol References" target="help/topics/SymbolTablePlugin/symbol_references.htm" />
<tocdef id="Symbol Tree" sortgroup="b" text="Symbol Tree" target="help/topics/SymbolTreePlugin/SymbolTree.htm" />
<tocdef id="Temporary Symbol Table" sortgroup="c" text="Temporary Symbol Table" target="help/topics/SymbolTablePlugin/symbol_table_transient.htm" />
</tocdef>

<tocdef id="Relocation Table" text="Relocation Table" target="help/topics/RelocationTablePlugin/relocation_table.htm" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<HTML>
<HEAD>

<TITLE>Temporary Symbol Table</TITLE>
<LINK rel="stylesheet" type="text/css" href="help/shared/DefaultStyle.css">
</HEAD>

<BODY>
<H1><A name="Temporary_Symbol_Table"></A>Temporary Symbol Table</H1>

<P>The Temporary Symbol Table is a table created by providers that have the <B>Create Table</B>
action, such as the <A href="help/topics/SymbolTreePlugin/SymbolTree.htm">Symbol Tree</A> or
the <A href="help/topics/SymbolTablePlugin/symbol_table.htm">Symbol Table</A>. It contains the
same columns as the Symbol Table.
</P>

<P>This table functions much like the <A HREF="help/topics/Search/Query_Results_Dialog.htm">
Search Results Table</A>. For example, this table supports the ability to remove rows.
</P>

<H2>Drag and Drop</H2>

<BLOCKQUOTE>
<P>This table supports the dragging of symbols into the table. This allows you to add to
the table as you are using the tool. The source of a drag can be a provider that knows how
to drag symbols, such as the Symbol Tree, the Symbol Table and other temporary symbol tables.
</P>
</BLOCKQUOTE>

<H2>Actions</H2>

<BLOCKQUOTE>
<P>
This table supports the general actions of the
<A href="help/topics/Search/Query_Results_Dialog.htm">Search Results Window</A>.
</P>

<H3>Create Table From Selection</H3>

<BLOCKQUOTE>
<P>
This table supports the ability to create a new table with the selected rows.
</P>
</BLOCKQUOTE>

</BLOCKQUOTE>


<P class="relatedtopic">Related Topics:</P>

<BLOCKQUOTE>
<UL>
<LI>
<A href="help/topics/Search/Query_Results_Dialog.htm">Search Results Window</A>
</LI>
<LI>
<A href="help/topics/SymbolTablePlugin/symbol_table.htm">Symbol Table</A>
</LI>
<LI>
<A href="help/topics/SymbolTreePlugin/SymbolTree.htm">Symbol Tree</A>
</LI>
</UL>
</BLOCKQUOTE>

<BR>
<BR>
<BR>
</BODY>
</HTML>
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,17 @@ <H2>View Qualified Names in Code Browser</H2>
</BLOCKQUOTE>


<H2><A NAME="Create_Table"></A>Create Table From Selection</H2>

<BLOCKQUOTE>
<P>Create a new temporary
<A HREF="help/topics/SymbolTablePlugin/symbol_table_transient.htm">Symbol Table</A> with the symbols
in the current selection. The table's features are similar to the
<A HREF="help/topics/Search/Query_Results_Dialog.htm">search results table.</A>
</P>
</BLOCKQUOTE>



<H2>Symbol Tree Snapshots</H2>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/* ###
* IP: GHIDRA
* REVIEWED: YES
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -18,13 +17,18 @@

import docking.ActionContext;
import docking.action.DockingAction;
import docking.action.KeyBindingType;

public abstract class ProgramSymbolContextAction extends DockingAction {

public ProgramSymbolContextAction(String name, String owner) {
super(name, owner);
}

public ProgramSymbolContextAction(String name, String owner, KeyBindingType kbType) {
super(name, owner, kbType);
}

@Override
public final boolean isEnabledForContext(ActionContext actionContext) {
if (!(actionContext instanceof ProgramSymbolActionContext)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import ghidra.framework.plugintool.ComponentProviderAdapter;
import ghidra.program.model.address.Address;
import ghidra.program.model.listing.Program;
import ghidra.program.util.ProgramSelection;
import ghidra.util.HelpLocation;
import ghidra.util.table.*;

Expand Down Expand Up @@ -148,10 +147,6 @@ private void notifyContextChanged() {
tool.contextChanged(this);
}

ProgramSelection selectComment() {
return commentTable.getProgramSelection();
}

void reload() {
if (isVisible()) {
commentModel.reload(plugin.getProgram());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import ghidra.framework.plugintool.ComponentProviderAdapter;
import ghidra.program.model.address.Address;
import ghidra.program.model.listing.Program;
import ghidra.program.util.ProgramSelection;
import ghidra.util.HelpLocation;
import ghidra.util.table.*;

Expand Down Expand Up @@ -153,10 +152,6 @@ private void notifyContextChanged() {
tool.contextChanged(this);
}

ProgramSelection selectData() {
return dataTable.getProgramSelection();
}

private void setDataTableRenderer() {
dataTable.getColumnModel()
.getColumn(DataTableModel.LOCATION_COL)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import ghidra.framework.plugintool.ComponentProviderAdapter;
import ghidra.program.model.address.Address;
import ghidra.program.model.listing.*;
import ghidra.program.util.ProgramSelection;
import ghidra.util.HelpLocation;
import ghidra.util.table.*;

Expand Down Expand Up @@ -156,10 +155,6 @@ private JComponent createWorkPanel() {
return container;
}

ProgramSelection selectFunctions() {
return functionTable.getProgramSelection();
}

private void setFunctionTableRenderer() {
TableColumnModel columnModel = functionTable.getColumnModel();
TableColumn column = columnModel.getColumn(FunctionTableModel.LOCATION_COL);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@

import ghidra.framework.plugintool.PluginTool;
import ghidra.program.model.address.Address;
import ghidra.program.util.ProgramSelection;
import ghidra.util.table.*;

/**
Expand Down Expand Up @@ -73,10 +72,6 @@ GhidraTable getTable() {
return table;
}

ProgramSelection getSelection() {
return table.getProgramSelection();
}

/**
* Causes the model to update the table. This differs from {@link #reloadModel()} in that if
* there is data cached, then this call will use that cached data.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,7 @@ else if (!isDefaultFilterRange(minValueText, maxValueText)) {
buffy.append(" [filter: ")
.append(minValueText)
.append(" - ")
.append(
maxValueText)
.append(maxValueText)
.append(']');
}

Expand Down Expand Up @@ -181,10 +180,6 @@ void dispose() {
filter.dispose();
}

ProgramSelection getSelection() {
return scalarTable.getProgramSelection();
}

void reload() {
if (isVisible()) {
scalarModel.reload();
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public class GhidraScriptComponentProvider extends ComponentProviderAdapter {
private JPanel component;
private RootNode scriptRoot;
private GTree scriptCategoryTree;
private DraggableScriptTable scriptTable;
private GTable scriptTable;
private final GhidraScriptInfoManager infoManager;
private GhidraScriptTableModel tableModel;
private BundleStatusComponentProvider bundleStatusComponentProvider;
Expand Down Expand Up @@ -185,7 +185,7 @@ private void build() {

tableModel = new GhidraScriptTableModel(this, infoManager);

scriptTable = new DraggableScriptTable(this, tableModel);
scriptTable = new GTable(tableModel);
scriptTable.setAutoLookupColumn(tableModel.getNameColumnIndex());
scriptTable.setRowSelectionAllowed(true);
scriptTable.setAutoCreateColumnsFromModel(false);
Expand Down Expand Up @@ -461,11 +461,11 @@ private void renameScriptByCopying(ResourceFile script, GhidraScriptProvider pro
setSelectedScript(renameFile);
}

JTable getTable() {
public GTable getTable() {
return scriptTable;
}

GTree getTree() {
public GTree getTree() {
return scriptCategoryTree;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
import ghidra.program.model.listing.Data;
import ghidra.program.model.listing.Program;
import ghidra.program.util.ProgramLocation;
import ghidra.program.util.ProgramSelection;
import ghidra.util.HelpLocation;
import ghidra.util.table.*;

Expand Down Expand Up @@ -171,10 +170,6 @@ private void notifyContextChanged() {
tool.contextChanged(this);
}

ProgramSelection getProgramSelection() {
return table.getProgramSelection();
}

void add(Data data) {
if (isVisible()) {
stringModel.addDataInstance(currentProgram, data);
Expand Down
Loading

0 comments on commit 2ffb82d

Please sign in to comment.