llvm.org GIT mirror llvm / c6551ff
Implement PR1240 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34959 91177308-0d34-0410-b5e6-96231b3b80d8 Anton Korobeynikov 13 years ago
3 changed file(s) with 17 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
2020 namespace llvm {
2121 namespace sys {
2222
23 /// This function returns true, if there is possible to use some external
24 /// disassembler library. False otherwise.
25 bool hasDisassembler(void);
26
2327 /// This function provides some "glue" code to call external disassembler
2428 /// libraries.
2529 std::string disassembleBuffer(uint8_t* start, size_t length, uint64_t pc = 0);
875875 Relocations.clear();
876876
877877 #ifndef NDEBUG
878 DOUT << "Disassembled code:\n"
879 << sys::disassembleBuffer(FnStart, FnEnd-FnStart, (uintptr_t)FnStart);
878 if (sys::hasDisassembler())
879 DOUT << "Disassembled code:\n"
880 << sys::disassembleBuffer(FnStart, FnEnd-FnStart, (uintptr_t)FnStart);
880881 #endif
881882
882883 return false;
2424 #endif
2525
2626 using namespace llvm;
27
28 bool llvm::sys::hasDisassembler(void)
29 {
30 #if defined (__i386__) || defined (__amd64__) || defined (__x86_64__)
31 // We have option to enable udis86 library.
32 return true;
33 #else
34 return false;
35 #endif
36 }
2737
2838 std::string llvm::sys::disassembleBuffer(uint8_t* start, size_t length,
2939 uint64_t pc) {