use of com.google.security.zynamics.zylib.disassembly.IAddress in project binnavi by google.
the class CReferenceFinder method fetchReferenceMap.
/**
* Fetch for outgoing code references of a tree node and all of its children.
*
* @param node The start node of the search.
* @param instruction The instruction the operand tree belongs to.
* @param functions The map of code references.
*/
private static void fetchReferenceMap(final IOperandTreeNode node, final INaviInstruction instruction, final Map<INaviInstruction, INaviFunction> functions) {
final List<IReference> references = node.getReferences();
for (final IReference reference : references) {
if (ReferenceType.isCodeReference(reference.getType())) {
final IAddress target = reference.getTarget();
final INaviFunction function = instruction.getModule().getContent().getFunctionContainer().getFunction(target);
if (function != null) {
functions.put(instruction, function);
}
}
}
for (final IOperandTreeNode child : node.getChildren()) {
fetchReferenceMap(child, instruction, functions);
}
}
use of com.google.security.zynamics.zylib.disassembly.IAddress in project binnavi by google.
the class CBookmarksTableModelTest method test2getValueAt.
@Test
public void test2getValueAt() {
final DebugTargetSettings target = new ModuleTargetSettings(CommonTestObjects.MODULE);
final DebuggerProvider debuggerProvider = new DebuggerProvider(target);
final CBookmarkTableModel model = new CBookmarkTableModel(debuggerProvider);
final IAddress address = new MockAddress();
final CBookmark bookmark = new CBookmark(address, "foo");
final MockDebugger debugger = new MockDebugger(new ModuleTargetSettings(CommonTestObjects.MODULE));
debugger.getBreakpointManager().addBreakpoints(BreakpointType.REGULAR, CommonTestObjects.BP_ADDRESS_0_SET);
debuggerProvider.addDebugger(debugger);
final BookmarkManager bookmarkManager = debugger.getBookmarkManager();
bookmarkManager.addBookmark(bookmark);
assertEquals(1, bookmarkManager.getNumberOfBookmarks());
assertEquals("foo", model.getValueAt(0, 2));
assertEquals(address.toHexString(), model.getValueAt(0, 1));
assertEquals(debugger.getPrintableString(), model.getValueAt(0, 0));
final int[] rows = { 0 };
CBookmarkFunctions.deleteBookmarks(debuggerProvider, rows);
assertEquals(0, bookmarkManager.getNumberOfBookmarks());
model.dispose();
}
use of com.google.security.zynamics.zylib.disassembly.IAddress in project binnavi by google.
the class CStackMemoryProvider method hasData.
@Override
public boolean hasData(final long startAddress, final long numberOfBytes) {
if (m_debugger == null) {
return false;
}
if (m_debugger.getProcessManager().getTargetInformation().getDebuggerOptions().canMemmap()) {
return m_memoryProvider != null && m_memoryProvider.hasData(BigInteger.valueOf(startAddress), (int) numberOfBytes);
} else {
final CAddress stackStart = new CAddress(getStartAddress());
final int stackSize = getNumberOfEntries() * 4;
final CAddress stackEnd = new CAddress(getStartAddress() + stackSize);
final Pair<IAddress, Integer> realRange = MemoryRangeCalculator.calculateRequestRange(BigInteger.valueOf(startAddress), (int) numberOfBytes, stackStart, stackEnd);
final long realStart = realRange.first().toLong();
final long realSize = realRange.second();
return m_memoryProvider != null && m_memoryProvider.hasData(BigInteger.valueOf(startAddress), (int) numberOfBytes, BigInteger.valueOf(realStart), (int) realSize);
}
}
use of com.google.security.zynamics.zylib.disassembly.IAddress in project binnavi by google.
the class CGraphInliner method prepareFunctionInlining.
/**
* Prepares the function inlining by checking if the arguments are properly set and locating the
* function to inline.
*
* @param parent The parent JFrame.
* @param node The node where the inlining will take place.
* @param instruction The instruction which is the function call.
* @param function
* @param viewContainer The view Container.
*
* @return The function to be inlined.
*/
private static INaviFunction prepareFunctionInlining(final JFrame parent, final INaviCodeNode node, final INaviInstruction instruction, final INaviFunction function, final IViewContainer viewContainer) {
Preconditions.checkNotNull(parent, "IE00825: Parent argument can not be null");
Preconditions.checkNotNull(viewContainer, "IE00915: View container argument can not be null");
Preconditions.checkNotNull(node, "IE00916: Node argument can't be null");
Preconditions.checkNotNull(instruction, "IE01153: Instruction argument can't be null");
Preconditions.checkNotNull(function, "IE01173: Function argument can't be null");
final int forwarderModuleId = function.getForwardedFunctionModuleId();
final IAddress forwarderAddress = function.getForwardedFunctionAddress();
return getFunctionToInline(parent, viewContainer, function, forwarderModuleId, forwarderAddress);
}
use of com.google.security.zynamics.zylib.disassembly.IAddress in project binnavi by google.
the class CGotoAddressField method zoomToAddress.
/**
* Zooms to the current address.
*/
private void zoomToAddress() {
if (!"".equals(getText())) {
add(getText());
final IAddress address = new CAddress(Long.parseLong(getText(), 16));
m_textField.setSuccessful(ZyZoomHelpers.zoomToAddress(m_graph, address, m_modules.get(0), true));
}
}
Aggregations