disassembler.h revision b23a7729cf7855fa05345d03a4d84111d5ec7172
13a5c1ce3f11805a3382046f699c8fb1410a602b3Ian Rogers/*
23a5c1ce3f11805a3382046f699c8fb1410a602b3Ian Rogers * Copyright (C) 2012 The Android Open Source Project
33a5c1ce3f11805a3382046f699c8fb1410a602b3Ian Rogers *
43a5c1ce3f11805a3382046f699c8fb1410a602b3Ian Rogers * Licensed under the Apache License, Version 2.0 (the "License");
53a5c1ce3f11805a3382046f699c8fb1410a602b3Ian Rogers * you may not use this file except in compliance with the License.
63a5c1ce3f11805a3382046f699c8fb1410a602b3Ian Rogers * You may obtain a copy of the License at
73a5c1ce3f11805a3382046f699c8fb1410a602b3Ian Rogers *
83a5c1ce3f11805a3382046f699c8fb1410a602b3Ian Rogers *      http://www.apache.org/licenses/LICENSE-2.0
93a5c1ce3f11805a3382046f699c8fb1410a602b3Ian Rogers *
103a5c1ce3f11805a3382046f699c8fb1410a602b3Ian Rogers * Unless required by applicable law or agreed to in writing, software
113a5c1ce3f11805a3382046f699c8fb1410a602b3Ian Rogers * distributed under the License is distributed on an "AS IS" BASIS,
123a5c1ce3f11805a3382046f699c8fb1410a602b3Ian Rogers * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
133a5c1ce3f11805a3382046f699c8fb1410a602b3Ian Rogers * See the License for the specific language governing permissions and
143a5c1ce3f11805a3382046f699c8fb1410a602b3Ian Rogers * limitations under the License.
153a5c1ce3f11805a3382046f699c8fb1410a602b3Ian Rogers */
163a5c1ce3f11805a3382046f699c8fb1410a602b3Ian Rogers
173a5c1ce3f11805a3382046f699c8fb1410a602b3Ian Rogers#ifndef ART_SRC_DISASSEMBLER_H_
183a5c1ce3f11805a3382046f699c8fb1410a602b3Ian Rogers#define ART_SRC_DISASSEMBLER_H_
193a5c1ce3f11805a3382046f699c8fb1410a602b3Ian Rogers
200f3c55331439970e01af67f80ac117c473bc04cfElliott Hughes#include <stdint.h>
210f3c55331439970e01af67f80ac117c473bc04cfElliott Hughes
220f3c55331439970e01af67f80ac117c473bc04cfElliott Hughes#include <iosfwd>
230f3c55331439970e01af67f80ac117c473bc04cfElliott Hughes
240f3c55331439970e01af67f80ac117c473bc04cfElliott Hughes#include "instruction_set.h"
25105afd2bd8f9f0ddfcfcb4b8db9f356ee82ae8cdElliott Hughes#include "macros.h"
263a5c1ce3f11805a3382046f699c8fb1410a602b3Ian Rogers
273a5c1ce3f11805a3382046f699c8fb1410a602b3Ian Rogersnamespace art {
283a5c1ce3f11805a3382046f699c8fb1410a602b3Ian Rogers
293a5c1ce3f11805a3382046f699c8fb1410a602b3Ian Rogersclass Disassembler {
303a5c1ce3f11805a3382046f699c8fb1410a602b3Ian Rogers public:
313a5c1ce3f11805a3382046f699c8fb1410a602b3Ian Rogers  static Disassembler* Create(InstructionSet instruction_set);
323a5c1ce3f11805a3382046f699c8fb1410a602b3Ian Rogers  virtual ~Disassembler() {}
333a5c1ce3f11805a3382046f699c8fb1410a602b3Ian Rogers
34b23a7729cf7855fa05345d03a4d84111d5ec7172Ian Rogers  // Dump a single instruction returning the length of that instruction.
35b23a7729cf7855fa05345d03a4d84111d5ec7172Ian Rogers  virtual size_t Dump(std::ostream& os, const uint8_t* begin) = 0;
36b23a7729cf7855fa05345d03a4d84111d5ec7172Ian Rogers  // Dump instructions within a range.
373a5c1ce3f11805a3382046f699c8fb1410a602b3Ian Rogers  virtual void Dump(std::ostream& os, const uint8_t* begin, const uint8_t* end) = 0;
38105afd2bd8f9f0ddfcfcb4b8db9f356ee82ae8cdElliott Hughes
39105afd2bd8f9f0ddfcfcb4b8db9f356ee82ae8cdElliott Hughes protected:
40105afd2bd8f9f0ddfcfcb4b8db9f356ee82ae8cdElliott Hughes  Disassembler() {}
41105afd2bd8f9f0ddfcfcb4b8db9f356ee82ae8cdElliott Hughes
42105afd2bd8f9f0ddfcfcb4b8db9f356ee82ae8cdElliott Hughes private:
43105afd2bd8f9f0ddfcfcb4b8db9f356ee82ae8cdElliott Hughes  DISALLOW_COPY_AND_ASSIGN(Disassembler);
443a5c1ce3f11805a3382046f699c8fb1410a602b3Ian Rogers};
453a5c1ce3f11805a3382046f699c8fb1410a602b3Ian Rogers
463a5c1ce3f11805a3382046f699c8fb1410a602b3Ian Rogers}  // namespace art
473a5c1ce3f11805a3382046f699c8fb1410a602b3Ian Rogers
483a5c1ce3f11805a3382046f699c8fb1410a602b3Ian Rogers#endif  // ART_SRC_DISASSEMBLER_H_
49