This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [libopcodes] Switching manually between print_insn_arm and print_insn_thumb(16|32)
- From: "Dr. David Alan Gilbert" <dave at treblig dot org>
- To: Emmanuel Fleury <fleury at labri dot fr>
- Cc: binutils at sourceware dot org
- Date: Mon, 18 Aug 2014 10:38:39 +0100
- Subject: Re: [libopcodes] Switching manually between print_insn_arm and print_insn_thumb(16|32)
- Authentication-results: sourceware.org; auth=none
- References: <53F1BD49 dot 1050400 at labri dot fr>
* Emmanuel Fleury (fleury@labri.fr) wrote:
> Hello,
>
> I am writing a small disassembler for ARM based on libopcodes. For now,
> I managed to get the full ARM mode to be operational (32 bits
> instructions).
>
> But, once I get the disassembler_ftype (I simplified the code):
>
> abfd->arch_info = bfd_scan_arch ("arm");
> this->disassembler_fn = disassembler(abfd);
>
> How can I switch to thumb mode on demand ?
>
> I would like to get access to print_insn_thumb(16|32) when needed.
>
>
> I also have a second question which is somehow a bit similar. I would
> like to be able to decide what endianness is selected in the abdf
> structure. I tried to access directly to the field and set it:
>
> (abfd)->xvec->byteorder = BFD_ENDIAN_BIG;
>
> But, the xvec created by new_bfd() seems to be read-only. Is there a way
> to work around and be able to modify endianness on-the-fly ?
I used the following to do it:
https://github.com/penguin42/pocketdisassembler/blob/master/jni/binutilsglue.c#L46
there's also an option you can pass to force thumb mode. I think it's 'force-thumb'
Dave
>
> Regards
> --
> Emmanuel Fleury
>
> Computer Science is no more about computers than astronomy is
> about telescopes.
> -- Edsger Dijkstra
>
--
-----Open up your eyes, open up your mind, open up your code -------
/ Dr. David Alan Gilbert | Running GNU/Linux | Happy \
\ gro.gilbert @ treblig.org | | In Hex /
\ _________________________|_____ http://www.treblig.org |_______/