RE: [RFA] Fix gdb compilation error in opcodes/dlx-dis.c with --enable-targets=all for mingw64

Pierre Muller
2010-09-09T16:32:43Z

> What's wrong with dlx_insn?
>
> Andreas.

Whoops, nothing in fact...
It's just that as it was typecast to an integer,
I tried to find an integer type that was of the same size
as a pointer for all configurations. I found out
that bfd_hostptr_t was this type, so I went on using
that type.

Of course you are right, it is much cleaner to directly
typecast it to the correct type.

Here is a new version of the patch.
Is this OK?

2010-09-09 Pierre Muller <muller@ics.u-strasbg.fr>

* src/opcodes/dlx-dis.c (print_insn_dlx): Use dlx_insn type for
dlx_insn_type array.

Index: src/opcodes/dlx-dis.c
===================================================================
RCS file: /cvs/src/src/opcodes/dlx-dis.c,v
retrieving revision 1.5
diff -u -p -r1.5 dlx-dis.c
--- src/opcodes/dlx-dis.c 27 Jun 2010 04:07:55 -0000 1.5
+++ src/opcodes/dlx-dis.c 9 Sep 2010 12:06:19 -0000
@@ -437,18 +437,18 @@ print_insn_dlx (bfd_vma memaddr, struct
bfd_byte buffer[4];
int insn_idx;
unsigned long insn_word;
- unsigned long dlx_insn_type[] =
+ dlx_insn dlx_insn_type[] =
{
- (unsigned long) dlx_r_type,
- (unsigned long) dlx_load_type,
- (unsigned long) dlx_store_type,
- (unsigned long) dlx_aluI_type,
- (unsigned long) dlx_br_type,
- (unsigned long) dlx_jmp_type,
- (unsigned long) dlx_jr_type,
- (unsigned long) NULL
+ dlx_r_type,
+ dlx_load_type,
+ dlx_store_type,
+ dlx_aluI_type,
+ dlx_br_type,
+ dlx_jmp_type,
+ dlx_jr_type,
+ (dlx_insn) NULL
};
- int dlx_insn_type_num = ((sizeof dlx_insn_type) / (sizeof (unsigned long))) - 1;
+ int dlx_insn_type_num = ((sizeof dlx_insn_type) / (sizeof (dlx_insn))) - 1;
int status =
(*info->read_memory_func) (memaddr, (bfd_byte *) &buffer[0], 4, info);

@@ -483,7 +483,7 @@ print_insn_dlx (bfd_vma memaddr, struct
current_insn_addr = (unsigned long) memaddr;

for (insn_idx = 0; dlx_insn_type[insn_idx] != 0x0; insn_idx++)
- switch (((dlx_insn) (dlx_insn_type[insn_idx])) (info))
+ switch (((dlx_insn_type[insn_idx])) (info))
{
/* Found the correct opcode */