Home | History | Annotate | Download | only in Support
      1 /*
      2  * Copyright 2011-2012, The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *     http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 #ifndef BCC_SUPPORT_DISASSEMBLER_H
     18 #define BCC_SUPPORT_DISASSEMBLER_H
     19 
     20 #include <stdint.h>
     21 #include <stddef.h>
     22 
     23 namespace llvm {
     24   class raw_ostream;
     25 } // end namespace llvm
     26 
     27 namespace bcc {
     28 
     29 class OutputFile;
     30 
     31 enum DisassembleResult {
     32   kDisassembleSuccess,
     33   kDisassemblerNotAvailable,
     34   kDisassembleInvalidOutput,
     35   kDisassembleFailedPrepareOutput,
     36   kDisassembleUnknownTarget,
     37   kDisassembleFailedSetup,
     38   kDisassembleOutOfMemory,
     39   kDisassembleInvalidInstruction,
     40 };
     41 
     42 DisassembleResult Disassemble(llvm::raw_ostream &pOutput, const char *pTriple,
     43                               const char *pFuncName, const uint8_t *pFunc,
     44                               size_t pFuncSize);
     45 
     46 DisassembleResult Disassemble(OutputFile &pOutput, const char *pTriple,
     47                               const char *pFuncName, const uint8_t *pFunc,
     48                               size_t pFuncSize);
     49 
     50 } // end namespace bcc
     51 
     52 #endif // BCC_SUPPORT_DISASSEMBLER_H
     53