GP-1872: one more pass

GP-1872: slight refactor
GP-1872: removing Project column
GP-1872: use domain file - more cases
GP-1872: use domain file name where possible
This commit is contained in:
d-millar 2022-03-31 14:24:21 -04:00
parent 5f2d874bdd
commit 3f76ae6add
8 changed files with 49 additions and 19 deletions

View File

@ -29,6 +29,7 @@ import docking.DialogComponentProvider;
import docking.widgets.model.GAddressRangeField;
import docking.widgets.model.GLifespanField;
import ghidra.app.services.DebuggerStaticMappingService;
import ghidra.framework.model.DomainFile;
import ghidra.program.model.address.*;
import ghidra.program.model.listing.Program;
import ghidra.program.util.ProgramLocation;
@ -360,7 +361,15 @@ public class DebuggerAddMappingDialog extends DialogComponentProvider {
public void setProgram(Program program) {
this.program = program;
if (program != null) {
labelProg.setText(program.getName());
String name;
DomainFile df = program.getDomainFile();
if (df != null) {
name = df.getName();
}
else {
name = program.getName();
}
labelProg.setText(name);
fieldProgRange.setAddressFactory(program.getAddressFactory());
}
else {

View File

@ -29,6 +29,7 @@ import docking.widgets.table.*;
import docking.widgets.table.ColumnSortState.SortDirection;
import docking.widgets.table.DefaultEnumeratedColumnTableModel.EnumeratedTableColumn;
import ghidra.app.services.DebuggerStaticMappingService;
import ghidra.framework.model.DomainFile;
import ghidra.framework.plugintool.PluginTool;
import ghidra.program.model.address.Address;
import ghidra.program.model.listing.Program;
@ -57,6 +58,10 @@ public class DebuggerBlockChooserDialog extends DialogComponentProvider {
}
public String getProgramName() {
DomainFile df = program.getDomainFile();
if (df != null) {
return df.getName();
}
return program.getName();
}

View File

@ -43,7 +43,9 @@ public class DebuggerModuleMapProposalDialog
MODULE_NAME("Module", String.class, e -> e.getModule().getName()),
DYNAMIC_BASE("Dynamic Base", Address.class, e -> e.getModule().getBase()),
CHOOSE("Choose", String.class, e -> "Choose Program", (e, v) -> nop()),
PROGRAM_NAME("Program", String.class, e -> e.getProgram().getName()),
PROGRAM_NAME("Program", String.class, e -> (e.getProgram().getDomainFile() == null
? e.getProgram().getName()
: e.getProgram().getDomainFile().getName())),
STATIC_BASE("Static Base", Address.class, e -> e.getProgram().getImageBase()),
SIZE("Size", Long.class, e -> e.getModuleRange().getLength());

View File

@ -1132,7 +1132,19 @@ public class DebuggerModulesProvider extends ComponentProviderAdapter {
public void setProgram(Program program) {
currentProgram = program;
String name = (program == null ? "..." : program.getName());
String name;
if (program != null) {
DomainFile df = program.getDomainFile();
if (df != null) {
name = df.getName();
}
else {
name = program.getName();
}
}
else {
name = "...";
}
actionMapModuleTo.getPopupMenuData().setMenuItemName(MapModuleToAction.NAME_PREFIX + name);
actionMapSectionsTo.getPopupMenuData()
.setMenuItemName(MapSectionsToAction.NAME_PREFIX + name);
@ -1158,7 +1170,13 @@ public class DebuggerModulesProvider extends ComponentProviderAdapter {
if (block == null) {
return "...";
}
return location.getProgram().getName() + ":" + block.getName();
Program program = location.getProgram();
String name = program.getName();
DomainFile df = program.getDomainFile();
if (df != null) {
name = df.getName();
}
return name + ":" + block.getName();
}
public void setLocation(ProgramLocation location) {

View File

@ -35,11 +35,6 @@ public class DbgDebuggerProgramLaunchOpinion implements DebuggerProgramLaunchOpi
super(program, tool, factory);
}
@Override
public String getMenuParentTitle() {
return "Debug " + program.getName();
}
@Override
protected List<String> getLauncherPath() {
return PathUtils.parse("");

View File

@ -36,11 +36,6 @@ public class GdbDebuggerProgramLaunchOpinion implements DebuggerProgramLaunchOpi
super(program, tool, factory);
}
@Override
public String getMenuParentTitle() {
return "Debug " + program.getName();
}
@Override
protected List<String> getLauncherPath() {
return PathUtils.parse("Inferiors[1]");

View File

@ -35,11 +35,6 @@ public class LldbDebuggerProgramLaunchOpinion implements DebuggerProgramLaunchOp
super(program, tool, factory);
}
@Override
public String getMenuParentTitle() {
return "Debug " + program.getName();
}
@Override
protected List<String> getLauncherPath() {
return PathUtils.parse("");

View File

@ -34,6 +34,7 @@ import ghidra.dbg.target.TargetMethod.ParameterDescription;
import ghidra.dbg.target.TargetObject;
import ghidra.dbg.target.schema.TargetObjectSchema;
import ghidra.dbg.util.PathUtils;
import ghidra.framework.model.DomainFile;
import ghidra.framework.options.SaveState;
import ghidra.framework.plugintool.AutoConfigState.ConfigStateField;
import ghidra.framework.plugintool.PluginTool;
@ -59,6 +60,16 @@ public abstract class AbstractDebuggerProgramLaunchOffer implements DebuggerProg
this.factory = factory;
}
@Override
public String getMenuParentTitle() {
String name = program.getName();
DomainFile df = program.getDomainFile();
if (df != null) {
name = df.getName();
}
return "Debug " + name;
}
protected List<String> getLauncherPath() {
return PathUtils.parse("");
}