Patchwork [01/48] arm-dis debug helper

login
register
mail settings
Submitter Riku Voipio
Date March 26, 2010, 4:06 p.m.
Message ID <4fc35202c28544bebaab3bee440a6bc8f9e04d83.1269617186.git.riku.voipio@nokia.com>
Download mbox | patch
Permalink /patch/48673/
State New
Headers show

Comments

Riku Voipio - March 26, 2010, 4:06 p.m.
From: Juha Riihimäki <juha.riihimaki@nokia.com>

modified the arm disassembler to include the opcode binary representation along
with the symbolic disassembly.

Signed-Off-By: Riku Voipio <riku.voipio@nokia.com>
Signed-Off-By: Juha Riihimäki <juha.riihimaki@nokia.com>
---
 arm-dis.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
Aurelien Jarno - April 8, 2010, 7:03 p.m.
On Fri, Mar 26, 2010 at 04:06:24PM +0000, Riku Voipio wrote:
> From: Juha Riihimäki <juha.riihimaki@nokia.com>
> 
> modified the arm disassembler to include the opcode binary representation along
> with the symbolic disassembly.
> 
> Signed-Off-By: Riku Voipio <riku.voipio@nokia.com>
> Signed-Off-By: Juha Riihimäki <juha.riihimaki@nokia.com>
> ---
>  arm-dis.c |   10 ++++++++--
>  1 files changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/arm-dis.c b/arm-dis.c
> index 4fb899e..2b37c24 100644
> --- a/arm-dis.c
> +++ b/arm-dis.c
> @@ -4101,8 +4101,14 @@ print_insn_arm (bfd_vma pc, struct disassemble_info *info)
>         In such cases, we can ignore the pc when computing
>         addresses, since the addend is not currently pc-relative.  */
>      pc = 0;
> -
> -  printer (pc, info, given);
> +    if (size == 2) {
> +        info->fprintf_func(info->stream, "[%04lx]      ",
> +                           ((unsigned long)given) & 0xffffffff);

Is the mask here correct? As far as I understand, we only want to keep
16 bits here.

> +    } else {
> +        info->fprintf_func(info->stream, "[%08lx]  ",
> +                           ((unsigned long)given) & 0xffffffff);
> +    }
> +    printer (pc, info, given);
>  
>    if (is_thumb)
>      {
> -- 
> 1.6.5
> 
> 
> 
>

Patch

diff --git a/arm-dis.c b/arm-dis.c
index 4fb899e..2b37c24 100644
--- a/arm-dis.c
+++ b/arm-dis.c
@@ -4101,8 +4101,14 @@  print_insn_arm (bfd_vma pc, struct disassemble_info *info)
        In such cases, we can ignore the pc when computing
        addresses, since the addend is not currently pc-relative.  */
     pc = 0;
-
-  printer (pc, info, given);
+    if (size == 2) {
+        info->fprintf_func(info->stream, "[%04lx]      ",
+                           ((unsigned long)given) & 0xffffffff);
+    } else {
+        info->fprintf_func(info->stream, "[%08lx]  ",
+                           ((unsigned long)given) & 0xffffffff);
+    }
+    printer (pc, info, given);
 
   if (is_thumb)
     {