Java Code Examples for ghidra.program.model.lang.Language#getDefaultCompilerSpec()
The following examples show how to use
ghidra.program.model.lang.Language#getDefaultCompilerSpec() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PinnedSymbolTest.java From ghidra with Apache License 2.0 | 5 votes |
@Before public void setUp() throws Exception { Language lang = getZ80_LANGUAGE(); program = new ProgramDB("z80", lang, lang.getDefaultCompilerSpec(), this); symbolTable = program.getSymbolTable(); space = program.getAddressFactory().getDefaultAddressSpace(); transactionID = program.startTransaction("Test"); createMemBlock(); createProcessorSymbols(lang); createBobSymbol(); createPinnedFunctionSymbol(); }
Example 2
Source File: ProgramContextTest.java From ghidra with Apache License 2.0 | 5 votes |
@Before public void setUp() throws IOException { Language lang = getSLEIGH_8051_LANGUAGE(); space = lang.getAddressFactory().getDefaultAddressSpace(); program = new ProgramDB("8051", lang, lang.getDefaultCompilerSpec(), this); mem = program.getMemory(); }
Example 3
Source File: ProjectFileManagerTest.java From ghidra with Apache License 2.0 | 5 votes |
private DomainFile createFile(DomainFolder folder, String name) throws Exception { // Using existing domain object since implementation and content handler is required Language language = getSLEIGH_X86_LANGUAGE(); Program p = new ProgramDB(name, language, language.getDefaultCompilerSpec(), this); try { return folder.createFile(name, p, TaskMonitorAdapter.DUMMY_MONITOR); } finally { p.release(this); } }
Example 4
Source File: GenerateLotsOfProgramsScript.java From ghidra with Apache License 2.0 | 5 votes |
private void createPrograms(DomainFolder parent, int count) throws IOException, InvalidNameException, CancelledException { Processor processor = Processor.toProcessor("x86"); Language language = getDefaultLanguage(processor); Program program = new ProgramDB("dummy", language, language.getDefaultCompilerSpec(), this); for (int i = 0; i < count; i++) { parent.createFile("Prog_" + i, program, monitor); } program.release(this); }
Example 5
Source File: AddressIndexPrimaryKeyIteratorTest.java From ghidra with Apache License 2.0 | 4 votes |
@Before public void setUp() throws Exception { TestEnv env = new TestEnv(); LanguageService ls = getLanguageService(); Language language = ls.getDefaultLanguage(TestProcessorConstants.PROCESSOR_SPARC); program = new ProgramDB("TestProgram", language, language.getDefaultCompilerSpec(), this); env.dispose(); // program = new ProgramDB("TestProgram", new SparcV8Language(),this); space = program.getAddressFactory().getDefaultAddressSpace(); memMap = program.getMemory(); addrMap = (AddressMap) getInstanceField("addrMap", memMap); transactionID = program.startTransaction("Test"); // Create fragmented memory memMap.createInitializedBlock("Block1", addr(0x8000), 0x10, (byte) 0, null, false);// startKey: 0x0 memMap.createUninitializedBlock("Block2", addr(0x5000), 0x10, false);// startKey: 0x10000 memMap.createBitMappedBlock("Block3", addr(0x9000), addr(0x5000), 0x10, false);// startKey: 0x20000 memMap.createUninitializedBlock("Block4", addr(0x3000), 0x10, false);// startKey: 0x30000 // Create table with indexed address column Schema schema = new Schema(0, "id", new Class[] { LongField.class }, new String[] { "addr" }); DBHandle handle = program.getDBHandle(); myTable = handle.createTable("MyTable", schema, new int[] { 0 }); assertTrue(memMap.contains(addr(0x3000))); assertTrue(memMap.contains(addr(0x5000))); assertTrue(memMap.contains(addr(0x8000))); assertTrue(memMap.contains(addr(0x9000))); assertTrue(!memMap.contains(addr(0x100))); int cnt = 0; AddressRangeIterator ranges = memMap.getAddressRanges(); while (ranges.hasNext()) { AddressRange r = ranges.next(); Address a = r.getMinAddress(); Address maxAddr = r.getMaxAddress(); while (a.compareTo(maxAddr) <= 0) { long addrKey = addrMap.getKey(a, true); Record rec = schema.createRecord(myTable.getKey()); rec.setLongValue(0, addrKey); myTable.putRecord(rec); a = a.add(1); ++cnt; } } assertEquals(0x40, cnt); assertEquals(0x40, myTable.getRecordCount()); }