public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* Re: [RFA] Fix gdb compilation error in opcodes/dlx-dis.c with --enable-targets=all for mingw64
       [not found] <2531.82755918733$1284046069@news.gmane.org>
@ 2010-09-09 16:32 ` Andreas Schwab
  2010-09-09 19:56   ` Pierre Muller
  0 siblings, 1 reply; 5+ messages in thread
From: Andreas Schwab @ 2010-09-09 16:32 UTC (permalink / raw)
  To: Pierre Muller; +Cc: binutils, gdb-patches

"Pierre Muller" <pierre.muller@ics-cnrs.unistra.fr> writes:

>   'unsigned long' type is 4-byte
> on x86_64-w64-mingw systems, which is less
> than a pointer size.
>   After some searching, I found bfd_hostptr_t
> type that is supposed to have the correct size of a host 
> pointer.

What's wrong with dlx_insn?

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [RFA] Fix gdb compilation error in opcodes/dlx-dis.c with --enable-targets=all for mingw64
  2010-09-09 16:32 ` [RFA] Fix gdb compilation error in opcodes/dlx-dis.c with --enable-targets=all for mingw64 Andreas Schwab
@ 2010-09-09 19:56   ` Pierre Muller
  2010-09-10 13:47     ` Nick Clifton
  0 siblings, 1 reply; 5+ messages in thread
From: Pierre Muller @ 2010-09-09 19:56 UTC (permalink / raw)
  To: 'Andreas Schwab'; +Cc: binutils, gdb-patches

> 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   */
       case R_TYPE:

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [RFA] Fix gdb compilation error in opcodes/dlx-dis.c with --enable-targets=all for mingw64
  2010-09-09 19:56   ` Pierre Muller
@ 2010-09-10 13:47     ` Nick Clifton
  2010-09-10 13:57       ` Pierre Muller
  0 siblings, 1 reply; 5+ messages in thread
From: Nick Clifton @ 2010-09-10 13:47 UTC (permalink / raw)
  To: Pierre Muller; +Cc: 'Andreas Schwab', binutils, gdb-patches

Hi Pierre,

> 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.

Approved - please apply.

Cheers
   Nick

> -    switch (((dlx_insn) (dlx_insn_type[insn_idx])) (info))
> +    switch (((dlx_insn_type[insn_idx])) (info))

You appear to have an unnecessary set of parentheses here...

Cheers
   Nick


^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [RFA] Fix gdb compilation error in opcodes/dlx-dis.c with --enable-targets=all for mingw64
  2010-09-10 13:47     ` Nick Clifton
@ 2010-09-10 13:57       ` Pierre Muller
  0 siblings, 0 replies; 5+ messages in thread
From: Pierre Muller @ 2010-09-10 13:57 UTC (permalink / raw)
  To: 'Nick Clifton'; +Cc: 'Andreas Schwab', binutils, gdb-patches

> Hi Pierre,
> 
> > 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.
> 
> Approved - please apply.

  Thanks for the approval
 
> Cheers
>    Nick
> 
> > -    switch (((dlx_insn) (dlx_insn_type[insn_idx])) (info))
> > +    switch (((dlx_insn_type[insn_idx])) (info))
> 
> You appear to have an unnecessary set of parentheses here...

committed after removing the unneeded parentheses.

Pierre

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [RFA] Fix gdb compilation error in opcodes/dlx-dis.c with --enable-targets=all for mingw64
@ 2010-09-09 16:16 Pierre Muller
  0 siblings, 0 replies; 5+ messages in thread
From: Pierre Muller @ 2010-09-09 16:16 UTC (permalink / raw)
  To: binutils, gdb-patches

  'unsigned long' type is 4-byte
on x86_64-w64-mingw systems, which is less
than a pointer size.
  After some searching, I found bfd_hostptr_t
type that is supposed to have the correct size of a host 
pointer.

  I tested the patch below by compilation 
with --enable-targets=all configure option
for i386-cygwin, x86_64-w64-mingw and x86_64-unknown-linux-gnu.

  I also ran the gdb testsuite on x86_64-unknown-linux-gnu
(gcc10 machine from gcc compile farm).
  No regression found.

  I don't know who is the main maintainer project
binutils or gdb?

  Who can give me the approval for this patch?
Is the patch itself OK?


Pierre Muller
Pascal language support maintainer for GDB


opcodes/ChangeLog entry:

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

	* dlx-dis.c (print_insn_dlx): Use bfd_hostptr_t 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,16 +437,16 @@ print_insn_dlx (bfd_vma memaddr, struct 
   bfd_byte buffer[4];
   int insn_idx;
   unsigned long insn_word;
-  unsigned long dlx_insn_type[] =
+  bfd_hostptr_t 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
+    (bfd_hostptr_t) dlx_r_type,
+    (bfd_hostptr_t) dlx_load_type,
+    (bfd_hostptr_t) dlx_store_type,
+    (bfd_hostptr_t) dlx_aluI_type,
+    (bfd_hostptr_t) dlx_br_type,
+    (bfd_hostptr_t) dlx_jmp_type,
+    (bfd_hostptr_t) dlx_jr_type,
+    (bfd_hostptr_t) NULL
   };
   int dlx_insn_type_num = ((sizeof dlx_insn_type) / (sizeof (unsigned long))) - 1;
   int status =

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-09-10 13:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <2531.82755918733$1284046069@news.gmane.org>
2010-09-09 16:32 ` [RFA] Fix gdb compilation error in opcodes/dlx-dis.c with --enable-targets=all for mingw64 Andreas Schwab
2010-09-09 19:56   ` Pierre Muller
2010-09-10 13:47     ` Nick Clifton
2010-09-10 13:57       ` Pierre Muller
2010-09-09 16:16 Pierre Muller

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).