hsdis.c revision 2273
2273N/A * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved. 100N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 100N/A * This code is free software; you can redistribute it and/or modify it 100N/A * under the terms of the GNU General Public License version 2 only, as 100N/A * published by the Free Software Foundation. 100N/A * This code is distributed in the hope that it will be useful, but WITHOUT 100N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 100N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 100N/A * version 2 for more details (a copy is included in the LICENSE file that 100N/A * accompanied this code). 100N/A * You should have received a copy of the GNU General Public License version 100N/A * 2 along with this work; if not, write to the Free Software Foundation, 100N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1472N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 100N/A/* hsdis.c -- dump a range of addresses as native instructions 100N/A This implements the plugin protocol required by the 100N/A HotSpot PrintAssembly option. 100N/A/* disassemble_info.application_data object */ 100N/A /* the arguments to decode_instructions */ 100N/A /* the architecture being disassembled */ 100N/A /* the disassembler we are going to use: */ 100N/A /* now reload everything from app_data: */ 100N/A /* reset certain state, so we can read it with confidence */ 100N/A /* follow each complete insn by a nice newline */ 100N/A/* take the address of the function, for luck, and also test the typedef: */ 100N/A /* read is out of bounds */ 100N/A /* the actual value to print: */ 100N/A /* Make reasonable defaults for null callbacks. 100N/A A non-null stream for a null callback is assumed to be a FILE* for output. 100N/A Events are rendered as XML. 100N/A /* Look into caller_options for anything interesting. */ 100N/A /* Discover which architecture we are going to disassemble. */ 100N/A /* Make a fake bfd to hold the arch. and byteorder info. */ 100N/A /* Finish linking together the various callback blocks. */ 100N/A/* ignore all events, return a null */ 100N/A/* print all events as XML markup */ 100N/A /* issue the tag, with or without a formatted argument */ 100N/A /* no arguments; just issue the closing tag */ 100N/A /* split out the closing attributes as <dis:foo_done attr='val'/> */ 100N/A // do not pass these to the next level 100N/A /* just copy it; {i386,sparc}-dis.c might like to see it */ 100N/A/* low-level bfd and arch stuff that binutils doesn't do for us */ 720N/A res =
"architecture not set in Makefile!";
100N/A/* Prime the pump by running the selected disassembler on a null input. 100N/A This forces the machine-specific disassembler to divulge invariant 100N/A information like bytes_per_line.