* [libopcodes] Switching manually between print_insn_arm and print_insn_thumb(16|32)
@ 2014-08-18 8:46 Emmanuel Fleury
2014-08-18 9:38 ` Dr. David Alan Gilbert
0 siblings, 1 reply; 3+ messages in thread
From: Emmanuel Fleury @ 2014-08-18 8:46 UTC (permalink / raw)
To: binutils
[-- Attachment #1: Type: text/plain, Size: 970 bytes --]
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 ?
Regards
--
Emmanuel Fleury
Computer Science is no more about computers than astronomy is
about telescopes.
-- Edsger Dijkstra
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [libopcodes] Switching manually between print_insn_arm and print_insn_thumb(16|32)
2014-08-18 8:46 [libopcodes] Switching manually between print_insn_arm and print_insn_thumb(16|32) Emmanuel Fleury
@ 2014-08-18 9:38 ` Dr. David Alan Gilbert
2014-08-18 12:56 ` Emmanuel Fleury
0 siblings, 1 reply; 3+ messages in thread
From: Dr. David Alan Gilbert @ 2014-08-18 9:38 UTC (permalink / raw)
To: Emmanuel Fleury; +Cc: binutils
* 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 |_______/
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [libopcodes] Switching manually between print_insn_arm and print_insn_thumb(16|32)
2014-08-18 9:38 ` Dr. David Alan Gilbert
@ 2014-08-18 12:56 ` Emmanuel Fleury
0 siblings, 0 replies; 3+ messages in thread
From: Emmanuel Fleury @ 2014-08-18 12:56 UTC (permalink / raw)
To: binutils
[-- Attachment #1: Type: text/plain, Size: 752 bytes --]
Hello,
On 08/18/2014 11:38 AM, Dr. David Alan Gilbert wrote:
>
> 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'
Thanks for your answer.
Indeed, the 'force-thumb' is far enough to switch between the two modes.
And, the code you pointed on GitHub gave me the right direction for
coding what I want (I think that my original problem was indeed coming
from my code and not the binutils code).
Thanks again !
Regards
--
Emmanuel Fleury
What if everything is an illusion and nothing exists?
In that case, I definitely overpaid for my carpet.
-- Woody Allen
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-08-18 12:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-18 8:46 [libopcodes] Switching manually between print_insn_arm and print_insn_thumb(16|32) Emmanuel Fleury
2014-08-18 9:38 ` Dr. David Alan Gilbert
2014-08-18 12:56 ` Emmanuel Fleury
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).