Merge remote-tracking branch 'origin/patch'

This commit is contained in:
ghidra1 2021-01-14 09:56:21 -05:00
commit 7ba3dc048d
5 changed files with 25 additions and 5 deletions

View file

@ -1,5 +1,6 @@
/* ### /* ###
* IP: GHIDRA * IP: GHIDRA
* REVIEWED: YES
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -51,7 +52,7 @@ public class RttiModelTest extends AbstractRttiTest {
setupRtti4_32(builder, 0x01001340L, 0, 0, 0, "0x01005364", "0x0100137c"); setupRtti4_32(builder, 0x01001340L, 0, 0, 0, "0x01005364", "0x0100137c");
Address address = builder.addr(0x01001340L); Address address = builder.addr(0x01001340L);
checkInvalidModel(new Rtti4Model(program, address, defaultValidationOptions), checkInvalidModel(new Rtti4Model(program, address, defaultValidationOptions),
"No vf table pointer is defined for this TypeDescriptor model."); "TypeDescriptor data type at 01005364 doesn't point to a vfTable address in a loaded and initialized memory block.");
} }
@Test @Test
@ -62,7 +63,7 @@ public class RttiModelTest extends AbstractRttiTest {
setupRtti0_32(builder, 0x01001364, "0x01007700", "0x0", "stuff"); setupRtti0_32(builder, 0x01001364, "0x01007700", "0x0", "stuff");
Address address = builder.addr(0x01001340L); Address address = builder.addr(0x01001340L);
checkInvalidModel(new Rtti4Model(program, address, defaultValidationOptions), checkInvalidModel(new Rtti4Model(program, address, defaultValidationOptions),
"No vf table pointer is defined for this TypeDescriptor model."); "TypeDescriptor data type at 01001364 doesn't point to a vfTable address in a loaded and initialized memory block.");
} }
@Test @Test

View file

@ -1,6 +1,5 @@
/* ### /* ###
* IP: GHIDRA * IP: GHIDRA
* REVIEWED: YES
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -31,6 +30,13 @@ public class DockingCheckBoxMenuItem extends JCheckBoxMenuItem {
@Override @Override
protected boolean processKeyBinding(KeyStroke ks, KeyEvent e, int condition, boolean pressed) { protected boolean processKeyBinding(KeyStroke ks, KeyEvent e, int condition, boolean pressed) {
return true; // we will take care of the action ourselves // TODO this note doesn't really make sense. I think this idea is outdated. Leaving this
// here for a bit, in case there is something we missed. This code is also in
// DockingMenuItem.
// return true; // we will take care of the action ourselves
// Our KeyBindingOverrideKeyEventDispatcher processes actions for us, so there is no
// need to have the menu item do it
return false;
} }
} }

View file

@ -33,7 +33,8 @@ public class DockingMenuItem extends JMenuItem implements GComponent {
@Override @Override
protected boolean processKeyBinding(KeyStroke ks, KeyEvent e, int condition, boolean pressed) { protected boolean processKeyBinding(KeyStroke ks, KeyEvent e, int condition, boolean pressed) {
// TODO this note doesn't really make sense. I think this idea is outdated. Leaving this // TODO this note doesn't really make sense. I think this idea is outdated. Leaving this
// here for a bit, in case there is something we missed // here for a bit, in case there is something we missed. This code is also in
// DockingCheckboxMenuItemUI.
// return true; // we will take care of the action ourselves // return true; // we will take care of the action ourselves
// Our KeyBindingOverrideKeyEventDispatcher processes actions for us, so there is no // Our KeyBindingOverrideKeyEventDispatcher processes actions for us, so there is no

View file

@ -2724,6 +2724,7 @@ public class FunctionDB extends DatabaseObject implements Function {
@Override @Override
public Set<Function> getCallingFunctions(TaskMonitor monitor) { public Set<Function> getCallingFunctions(TaskMonitor monitor) {
monitor = TaskMonitor.dummyIfNull(monitor);
Set<Function> set = new HashSet<>(); Set<Function> set = new HashSet<>();
ReferenceIterator iter = program.getReferenceManager().getReferencesTo(getEntryPoint()); ReferenceIterator iter = program.getReferenceManager().getReferencesTo(getEntryPoint());
while (iter.hasNext()) { while (iter.hasNext()) {
@ -2742,6 +2743,7 @@ public class FunctionDB extends DatabaseObject implements Function {
@Override @Override
public Set<Function> getCalledFunctions(TaskMonitor monitor) { public Set<Function> getCalledFunctions(TaskMonitor monitor) {
monitor = TaskMonitor.dummyIfNull(monitor);
Set<Function> set = new HashSet<>(); Set<Function> set = new HashSet<>();
Set<Reference> references = getReferencesFromBody(monitor); Set<Reference> references = getReferencesFromBody(monitor);
for (Reference reference : references) { for (Reference reference : references) {

View file

@ -32,6 +32,16 @@ public interface TaskMonitor {
public static final TaskMonitor DUMMY = new StubTaskMonitor(); public static final TaskMonitor DUMMY = new StubTaskMonitor();
/**
* Returns the given task monitor if it is not {@code null}. Otherwise, a {@link #DUMMY}
* monitor is returned.
* @param tm the monitor to check for {@code null}
* @return a non-null task monitor
*/
public static TaskMonitor dummyIfNull(TaskMonitor tm) {
return tm == null ? DUMMY : tm;
}
/** A value to indicate that this monitor has no progress value set */ /** A value to indicate that this monitor has no progress value set */
public static final int NO_PROGRESS_VALUE = -1; public static final int NO_PROGRESS_VALUE = -1;