MCPcopy Create free account
hub / github.com/Vector35/binaryninja-api / Assemble

Method Assemble

arch/powerpc/arch_ppc.cpp:1833–1857  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1831 }
1832
1833 bool Assemble(const string& code, uint64_t addr, DataBuffer& result, string& errors) override
1834 {
1835 MYLOG("%s()\n", __func__);
1836
1837 /* prepend directives to command the assembler's origin and endianness */
1838 string src;
1839 char buf[1024];
1840 snprintf(buf, sizeof(buf), ".org %" PRIx64 "\n", addr);
1841 src += string(buf);
1842 snprintf(buf, sizeof(buf), ".endian %s\n", (endian == BigEndian) ? "big" : "little");
1843 src += string(buf);
1844 src += code;
1845
1846 /* assemble */
1847 vector<uint8_t> byteEncoding;
1848 if(assemble_multiline(src, byteEncoding, errors)) {
1849 MYLOG("assemble_multiline() failed, errors contains: %s\n", errors.c_str());
1850 return false;
1851 }
1852
1853 result.Clear();
1854 //for(int i=0; i<byteEncoding.size(); ++i)
1855 result.Append(&(byteEncoding[0]), byteEncoding.size());
1856 return true;
1857 }
1858
1859 /*************************************************************************/
1860

Callers

nothing calls this directly

Calls 5

assemble_multilineFunction · 0.85
c_strMethod · 0.80
ClearMethod · 0.45
AppendMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected