public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [RFA] New port: CR16: BFD Changes required by the gdb port
@ 2012-11-26  7:04 Kaushik Phatak
  2012-12-14 18:52 ` Pedro Alves
  0 siblings, 1 reply; 10+ messages in thread
From: Kaushik Phatak @ 2012-11-26  7:04 UTC (permalink / raw)
  To: binutils; +Cc: gdb-patches, Joel Brobecker

Hi,
Please find below a patch for CR16 BFD related changes required by the
new CR16 gdb port. The gdb port was pre-approved last week,
http://sourceware.org/ml/gdb-patches/2012-11/msg00600.html

The below changes are needed so that the cr16-tdep code can easily access
the disassembler functions. Kindly review the same and let me know
if these changes are ok.

Thanks,
Kaushik

2012-11-26  Kaushik Phatak  <kaushik.phatak@kpitcummins.com>
opcodes/ChangeLog
	* cr16-dis.c (match_opcode,make_instruction: Remove static declaration.
	(dwordU,wordU): Moved typedefs to opcode/cr16.h

bfd/Changelog	
	* config.bfd (cr16*-*-uclinux*): New target support.	

include/opcode/ChangeLog
	* cr16.h (dwordU,wordU): Moved typedefs from cr16-dis.c
	(make_instruction,match_opcode): Added function prototypes.
	(words,allWords,currInsn): Declare as extern.
	
diff -uprN ./gdb_src.orig/opcodes/cr16-dis.c ./gdb_src/opcodes/cr16-dis.c
--- ./gdb_src.orig/opcodes/cr16-dis.c	2012-05-17 20:43:25.000000000 +0530
+++ ./gdb_src/opcodes/cr16-dis.c	2012-11-26 11:21:43.000000000 +0530
@@ -36,9 +36,6 @@
 /* Set Bit Mask - a mask to set all bits starting from offset 'offs'.  */
 #define SBM(offs)  ((((1 << (32 - offs)) -1) << (offs)))
 
-typedef unsigned long dwordU;
-typedef unsigned short wordU;
-
 typedef struct
 {
   dwordU val;
@@ -317,7 +314,7 @@ build_mask (void)
 
 /* Search for a matching opcode. Return 1 for success, 0 for failure.  */
 
-static int
+int
 match_opcode (void)
 {
   unsigned long mask;
@@ -734,7 +731,7 @@ print_arguments (ins *currentInsn, bfd_v
 
 /* Build the instruction's arguments.  */
 
-static void
+void
 make_instruction (void)
 {
   int i;
--- ./gdb_src.orig/bfd/config.bfd	2012-05-15 18:25:34.000000000 +0530
+++ ./gdb_src/bfd/config.bfd	2012-10-23 15:09:08.000000000 +0530
@@ -345,6 +345,11 @@ case "${targ}" in
     targ_underscore=yes
     ;;
 
+  cr16*-*-uclinux*)
+    targ_defvec=bfd_elf32_cr16_vec
+    targ_underscore=yes
+    ;;
+
   cr16c-*-elf*)
     targ_defvec=bfd_elf32_cr16c_vec
     targ_underscore=yes
--- ./gdb_src.orig/include/opcode/cr16.h	2010-04-15 15:56:09.000000000 +0530
+++ ./gdb_src/include/opcode/cr16.h	2012-11-16 12:43:59.000000000 +0530
@@ -435,4 +435,17 @@ extern const inst *instruction;
 typedef long long int LONGLONG;
 typedef unsigned long long ULONGLONG;
 
+/* Data types for opcode handling.  */
+typedef unsigned long dwordU;
+typedef unsigned short wordU;
+
+/* Globals to store opcode data and build the instruction.  */
+extern wordU words[3];
+extern ULONGLONG allWords;
+extern ins currInsn;
+
+/* Prototypes for function in cr16-dis.c.  */
+void make_instruction (void);
+int match_opcode (void);
+
 #endif /* _CR16_H_ */


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

* Re: [RFA] New port: CR16: BFD Changes required by the gdb port
  2012-11-26  7:04 [RFA] New port: CR16: BFD Changes required by the gdb port Kaushik Phatak
@ 2012-12-14 18:52 ` Pedro Alves
  2012-12-28 12:18   ` Kaushik Phatak
  0 siblings, 1 reply; 10+ messages in thread
From: Pedro Alves @ 2012-12-14 18:52 UTC (permalink / raw)
  To: Kaushik Phatak; +Cc: binutils, gdb-patches, Joel Brobecker

On 11/26/2012 07:03 AM, Kaushik Phatak wrote:
> diff -uprN ./gdb_src.orig/opcodes/cr16-dis.c ./gdb_src/opcodes/cr16-dis.c
> --- ./gdb_src.orig/opcodes/cr16-dis.c	2012-05-17 20:43:25.000000000 +0530
> +++ ./gdb_src/opcodes/cr16-dis.c	2012-11-26 11:21:43.000000000 +0530
> @@ -36,9 +36,6 @@
>  /* Set Bit Mask - a mask to set all bits starting from offset 'offs'.  */
>  #define SBM(offs)  ((((1 << (32 - offs)) -1) << (offs)))
>  
> -typedef unsigned long dwordU;
> -typedef unsigned short wordU;
> -
>  typedef struct
>  {
>    dwordU val;
> @@ -317,7 +314,7 @@ build_mask (void)
>  
>  /* Search for a matching opcode. Return 1 for success, 0 for failure.  */
>  
> -static int
> +int
>  match_opcode (void)
>  {
>    unsigned long mask;
> @@ -734,7 +731,7 @@ print_arguments (ins *currentInsn, bfd_v
>  
>  /* Build the instruction's arguments.  */
>  
> -static void
> +void
>  make_instruction (void)
>  {
>    int i;

...

> --- ./gdb_src.orig/include/opcode/cr16.h	2010-04-15 15:56:09.000000000 +0530
> +++ ./gdb_src/include/opcode/cr16.h	2012-11-16 12:43:59.000000000 +0530
> @@ -435,4 +435,17 @@ extern const inst *instruction;
>  typedef long long int LONGLONG;
>  typedef unsigned long long ULONGLONG;
>  
> +/* Data types for opcode handling.  */
> +typedef unsigned long dwordU;
> +typedef unsigned short wordU;
> +
> +/* Globals to store opcode data and build the instruction.  */
> +extern wordU words[3];
> +extern ULONGLONG allWords;
> +extern ins currInsn;
> +
> +/* Prototypes for function in cr16-dis.c.  */
> +void make_instruction (void);
> +int match_opcode (void);
> +
>  #endif /* _CR16_H_ */

It'd be nice if all these exported symbols were prefixed, to avoid
namespace collisions.

-- 
Pedro Alves

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

* RE: [RFA] New port: CR16: BFD Changes required by the gdb port
  2012-12-14 18:52 ` Pedro Alves
@ 2012-12-28 12:18   ` Kaushik Phatak
  2013-01-02 13:14     ` nick clifton
  2013-01-02 14:19     ` Tom Tromey
  0 siblings, 2 replies; 10+ messages in thread
From: Kaushik Phatak @ 2012-12-28 12:18 UTC (permalink / raw)
  To: Pedro Alves; +Cc: binutils, gdb-patches, Joel Brobecker

Hi Pedro,
Thanks for taking out time to review this.

> It'd be nice if all these exported symbols were prefixed, to avoid
> namespace collisions.

I have added 'cr16_' as a prefix to all these exported symbols. 
I have also fixed the 80-char limit for lines affected by this change.
Please let me know if the below changes are ok.

Thanks & Best Regards,
Kaushik

2012-12-28  Kaushik Phatak  <kaushik.phatak@kpitcummins.com>
opcodes/ChangeLog
	* cr16-dis.c (match_opcode,make_instruction: Remove static declaration.
	(dwordU,wordU): Moved typedefs to opcode/cr16.h
	(cr16_words,cr16_allWords,cr16_currInsn): Added prefix 'cr16_'

bfd/Changelog	
	* config.bfd (cr16*-*-uclinux*): New target support.	

include/opcode/ChangeLog
	* cr16.h (dwordU,wordU): Moved typedefs from cr16-dis.c
	(make_instruction,match_opcode): Added function prototypes.
	(cr16_words,cr16_allWords,cr16_currInsn): Declare as extern.
	
diff -uprN ./gdb_src.orig/opcodes/cr16-dis.c ./gdb_src/opcodes/cr16-dis.c
--- ./gdb_src.orig/opcodes/cr16-dis.c	2012-05-17 20:43:25.000000000 +0530
+++ ./gdb_src/opcodes/cr16-dis.c	2012-12-28 17:24:14.000000000 +0530
@@ -36,9 +36,6 @@
 /* Set Bit Mask - a mask to set all bits starting from offset 'offs'.  */
 #define SBM(offs)  ((((1 << (32 - offs)) -1) << (offs)))
 
-typedef unsigned long dwordU;
-typedef unsigned short wordU;
-
 typedef struct
 {
   dwordU val;
@@ -83,11 +80,11 @@ REG_ARG_TYPE;
 /* Current opcode table entry we're disassembling.  */
 const inst *instruction;
 /* Current instruction we're disassembling.  */
-ins currInsn;
+ins cr16_currInsn;
 /* The current instruction is read into 3 consecutive words.  */
-wordU words[3];
+wordU cr16_words[3];
 /* Contains all words in appropriate order.  */
-ULONGLONG allWords;
+ULONGLONG cr16_allWords;
 /* Holds the current processed argument number.  */
 int processing_argument_number;
 /* Nonzero means a IMM4 instruction.  */
@@ -281,7 +278,7 @@ getprocpregname (int reg_index)
   return "ILLEGAL REGISTER";
 }
 
-/* START and END are relating 'allWords' struct, which is 48 bits size.
+/* START and END are relating 'cr16_allWords' struct, which is 48 bits size.
 
                           START|--------|END
              +---------+---------+---------+---------+
@@ -317,12 +314,13 @@ build_mask (void)
 
 /* Search for a matching opcode. Return 1 for success, 0 for failure.  */
 
-static int
+int
 match_opcode (void)
 {
   unsigned long mask;
   /* The instruction 'constant' opcode doewsn't exceed 32 bits.  */
-  unsigned long doubleWord = (words[1] + (words[0] << 16)) & 0xffffffff;
+  unsigned long doubleWord = (cr16_words[1]
+			     + (cr16_words[0] << 16)) & 0xffffffff;
 
   /* Start searching from end of instruction table.  */
   instruction = &cr16_instruction[NUMOPCODES - 2];
@@ -360,38 +358,44 @@ make_argument (argument * a, int start_b
   switch (a->type)
     {
     case arg_r:
-      p = makelongparameter (allWords, inst_bit_size - (start_bits + a->size),
-                             inst_bit_size - start_bits);
+      p = makelongparameter (cr16_allWords, 
+			     inst_bit_size - (start_bits + a->size),
+			     inst_bit_size - start_bits);
       a->r = p.val;
       break;
 
     case arg_rp:
-      p = makelongparameter (allWords, inst_bit_size - (start_bits + a->size),
-                             inst_bit_size - start_bits);
+      p = makelongparameter (cr16_allWords,
+			     inst_bit_size - (start_bits + a->size),
+			     inst_bit_size - start_bits);
       a->rp = p.val;
       break;
 
     case arg_pr:
-      p = makelongparameter (allWords, inst_bit_size - (start_bits + a->size),
-                             inst_bit_size - start_bits);
+      p = makelongparameter (cr16_allWords,
+			     inst_bit_size - (start_bits + a->size),
+			     inst_bit_size - start_bits);
       a->pr = p.val;
       break;
 
     case arg_prp:
-      p = makelongparameter (allWords, inst_bit_size - (start_bits + a->size),
-                             inst_bit_size - start_bits);
+      p = makelongparameter (cr16_allWords,
+			     inst_bit_size - (start_bits + a->size),
+			     inst_bit_size - start_bits);
       a->prp = p.val;
       break;
 
     case arg_ic:
-      p = makelongparameter (allWords, inst_bit_size - (start_bits + a->size),
-                             inst_bit_size - start_bits);
+      p = makelongparameter (cr16_allWords, 
+			     inst_bit_size - (start_bits + a->size),
+			     inst_bit_size - start_bits);
       a->constant = p.val;
       break;
 
     case arg_cc:
-      p = makelongparameter (allWords, inst_bit_size - (start_bits + a->size),
-                             inst_bit_size - start_bits);
+      p = makelongparameter (cr16_allWords,
+			     inst_bit_size - (start_bits + a->size),
+			     inst_bit_size - start_bits);
 
       a->cc = p.val;
       break;
@@ -400,28 +404,30 @@ make_argument (argument * a, int start_b
       if ((IS_INSN_MNEMONIC ("cbitb"))
 	  || (IS_INSN_MNEMONIC ("sbitb"))
 	  || (IS_INSN_MNEMONIC ("tbitb")))
-	p = makelongparameter (allWords, 8, 9);
+	p = makelongparameter (cr16_allWords, 8, 9);
       else
-	p = makelongparameter (allWords, 9, 10);
+	p = makelongparameter (cr16_allWords, 9, 10);
       a->i_r = p.val;
-      p = makelongparameter (allWords, inst_bit_size - a->size, inst_bit_size);
+      p = makelongparameter (cr16_allWords,
+			     inst_bit_size - a->size, inst_bit_size);
       a->constant = p.val;
       break;
 
     case arg_idxrp:
-      p = makelongparameter (allWords, start_bits + 12, start_bits + 13);
+      p = makelongparameter (cr16_allWords, start_bits + 12, start_bits + 13);
       a->i_r = p.val;
-      p = makelongparameter (allWords, start_bits + 13, start_bits + 16);
+      p = makelongparameter (cr16_allWords, start_bits + 13, start_bits + 16);
       a->rp = p.val;
       if (inst_bit_size > 32)
 	{
-	  p = makelongparameter (allWords, inst_bit_size - start_bits - 12,
+	  p = makelongparameter (cr16_allWords, inst_bit_size - start_bits - 12,
 				 inst_bit_size);
 	  a->constant = ((p.val & 0xffff) | (p.val >> 8 & 0xf0000));
 	}
       else if (instruction->size == 2)
 	{
-	  p = makelongparameter (allWords, inst_bit_size - 22, inst_bit_size);
+	  p = makelongparameter (cr16_allWords, inst_bit_size - 22,
+				 inst_bit_size);
 	  a->constant = (p.val & 0xf) | (((p.val >>20) & 0x3) << 4)
 	    | ((p.val >>14 & 0x3) << 6) | (((p.val >>7) & 0x1f) <<7);
 	}
@@ -431,41 +437,42 @@ make_argument (argument * a, int start_b
       break;

     case arg_rbase:
-      p = makelongparameter (allWords, inst_bit_size, inst_bit_size);
+      p = makelongparameter (cr16_allWords, inst_bit_size, inst_bit_size);
       a->constant = p.val;
-      p = makelongparameter (allWords, inst_bit_size - (start_bits + 4),
+      p = makelongparameter (cr16_allWords, inst_bit_size - (start_bits + 4),
                              inst_bit_size - start_bits);
       a->r = p.val;
       break;
 
     case arg_cr:
-      p = makelongparameter (allWords, start_bits + 12, start_bits + 16);
+      p = makelongparameter (cr16_allWords, start_bits + 12, start_bits + 16);
       a->r = p.val;
-      p = makelongparameter (allWords, inst_bit_size - 16, inst_bit_size);
+      p = makelongparameter (cr16_allWords, inst_bit_size - 16, inst_bit_size);
       a->constant = p.val;
       break;
 
     case arg_crp:
       if (instruction->size == 1)
-	p = makelongparameter (allWords, 12, 16);
+	p = makelongparameter (cr16_allWords, 12, 16);
       else
-	p = makelongparameter (allWords, start_bits + 12, start_bits + 16);
+	p = makelongparameter (cr16_allWords, start_bits + 12, start_bits + 16);
       a->rp = p.val;
 
       if (inst_bit_size > 32)
 	{
-	  p = makelongparameter (allWords, inst_bit_size - start_bits - 12,
+	  p = makelongparameter (cr16_allWords, inst_bit_size - start_bits - 12,
 				 inst_bit_size);
 	  a->constant = ((p.val & 0xffff) | (p.val >> 8 & 0xf0000));
 	}
       else if (instruction->size == 2)
 	{
-	  p = makelongparameter (allWords, inst_bit_size - 16, inst_bit_size);
+	  p = makelongparameter (cr16_allWords, inst_bit_size - 16, 
+				 inst_bit_size);
 	  a->constant = p.val;
 	}
       else if (instruction->size == 1 && a->size != 0)
 	{
-	  p = makelongparameter (allWords, 4, 8);
+	  p = makelongparameter (cr16_allWords, 4, 8);
 	  if (IS_INSN_MNEMONIC ("loadw")
 	      || IS_INSN_MNEMONIC ("loadd")
 	      || IS_INSN_MNEMONIC ("storw")
@@ -489,36 +496,37 @@ make_argument (argument * a, int start_b
 	  switch (a->size)
 	    {
 	    case 8 :
-	      p = makelongparameter (allWords, 0, start_bits);
+	      p = makelongparameter (cr16_allWords, 0, start_bits);
 	      a->constant = ((((p.val&0xf00)>>4)) | (p.val&0xf));
 	      break;
 
 	    case 24:
 	      if (instruction->size == 3)
 		{
-		  p = makelongparameter (allWords, 16, inst_bit_size);
+		  p = makelongparameter (cr16_allWords, 16, inst_bit_size);
 		  a->constant = ((((p.val>>16)&0xf) << 20)
 				 | (((p.val>>24)&0xf) << 16)
 				 | (p.val & 0xffff));
 		}
 	      else if (instruction->size == 2)
 		{
-		  p = makelongparameter (allWords, 8, inst_bit_size);
+		  p = makelongparameter (cr16_allWords, 8, inst_bit_size);
 		  a->constant = p.val;
 		}
 	      break;
 
 	    default:
-	      p = makelongparameter (allWords, inst_bit_size - (start_bits +
-								a->size), inst_bit_size - start_bits);
+	      p = makelongparameter (cr16_allWords,
+				     inst_bit_size - (start_bits + a->size),
+				     inst_bit_size - start_bits);
 	      a->constant = p.val;
 	      break;
 	    }
 	}
       else
 	{
-	  p = makelongparameter (allWords, inst_bit_size -
-				 (start_bits + a->size),
+	  p = makelongparameter (cr16_allWords,
+				 inst_bit_size - (start_bits + a->size),
 				 inst_bit_size - start_bits);
 	  a->constant = p.val;
 	}
@@ -734,13 +742,13 @@ print_arguments (ins *currentInsn, bfd_v
 
 /* Build the instruction's arguments.  */
 
-static void
+void
 make_instruction (void)
 {
   int i;
   unsigned int shift;
 
-  for (i = 0; i < currInsn.nargs; i++)
+  for (i = 0; i < cr16_currInsn.nargs; i++)
     {
       argument a;
 
@@ -750,13 +758,13 @@ make_instruction (void)
       shift = instruction->operands[i].shift;
 
       make_argument (&a, shift);
-      currInsn.arg[i] = a;
+      cr16_currInsn.arg[i] = a;
     }
 
   /* Calculate instruction size (in bytes).  */
-  currInsn.size = instruction->size + (size_changed ? 1 : 0);
+  cr16_currInsn.size = instruction->size + (size_changed ? 1 : 0);
   /* Now in bits.  */
-  currInsn.size *= 2;
+  cr16_currInsn.size *= 2;
 }
 
 /* Retrieve a single word from a given memory address.  */
@@ -785,10 +793,10 @@ get_words_at_PC (bfd_vma memaddr, struct
   bfd_vma mem;
 
   for (i = 0, mem = memaddr; i < 3; i++, mem += 2)
-    words[i] = get_word_at_PC (mem, info);
+    cr16_words[i] = get_word_at_PC (mem, info);
 
-  allWords =
-    ((ULONGLONG) words[0] << 32) + ((unsigned long) words[1] << 16) + words[2];
+  cr16_allWords =  ((ULONGLONG) cr16_words[0] << 32) 
+		   + ((unsigned long) cr16_words[1] << 16) + cr16_words[2];
 }
 
 /* Prints the instruction by calling print_arguments after proper matching.  */
@@ -807,22 +815,22 @@ print_insn_cr16 (bfd_vma memaddr, struct
   /* Find a matching opcode in table.  */
   is_decoded = match_opcode ();
   /* If found, print the instruction's mnemonic and arguments.  */
-  if (is_decoded > 0 && (words[0] << 16 || words[1]) != 0)
+  if (is_decoded > 0 && (cr16_words[0] << 16 || cr16_words[1]) != 0)
     {
       if (strneq (instruction->mnemonic, "cinv", 4))
         info->fprintf_func (info->stream,"%s", getcinvstring (instruction->mnemonic));
       else
         info->fprintf_func (info->stream, "%s", instruction->mnemonic);
 
-      if (((currInsn.nargs = get_number_of_operands ()) != 0)
+      if (((cr16_currInsn.nargs = get_number_of_operands ()) != 0)
 	  && ! (IS_INSN_MNEMONIC ("b")))
         info->fprintf_func (info->stream, "\t");
       make_instruction ();
       /* For push/pop/pushrtn with RA instructions.  */
-      if ((INST_HAS_REG_LIST) && ((words[0] >> 7) & 0x1))
-        currInsn.nargs +=1;
-      print_arguments (&currInsn, memaddr, info);
-      return currInsn.size;
+      if ((INST_HAS_REG_LIST) && ((cr16_words[0] >> 7) & 0x1))
+        cr16_currInsn.nargs +=1;
+      print_arguments (&cr16_currInsn, memaddr, info);
+      return cr16_currInsn.size;
     }
 
   /* No match found.  */
--- ./gdb_src.orig/bfd/config.bfd	2012-05-15 18:25:34.000000000 +0530
+++ ./gdb_src/bfd/config.bfd	2012-10-23 15:09:08.000000000 +0530
@@ -345,6 +345,11 @@ case "${targ}" in
     targ_underscore=yes
     ;;
 
+  cr16*-*-uclinux*)
+    targ_defvec=bfd_elf32_cr16_vec
+    targ_underscore=yes
+    ;;
+
   cr16c-*-elf*)
     targ_defvec=bfd_elf32_cr16c_vec
     targ_underscore=yes
--- ./gdb_src.orig/include/opcode/cr16.h	2010-04-15 15:56:09.000000000 +0530
+++ ./gdb_src/include/opcode/cr16.h	2012-12-28 12:49:50.000000000 +0530
@@ -435,4 +435,17 @@ extern const inst *instruction;
 typedef long long int LONGLONG;
 typedef unsigned long long ULONGLONG;
 
+/* Data types for opcode handling.  */
+typedef unsigned long dwordU;
+typedef unsigned short wordU;
+
+/* Globals to store opcode data and build the instruction.  */
+extern wordU cr16_words[3];
+extern ULONGLONG cr16_allWords;
+extern ins cr16_currInsn;
+
+/* Prototypes for function in cr16-dis.c.  */
+void make_instruction (void);
+int match_opcode (void);
+
 #endif /* _CR16_H_ */	

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

* Re: [RFA] New port: CR16: BFD Changes required by the gdb port
  2012-12-28 12:18   ` Kaushik Phatak
@ 2013-01-02 13:14     ` nick clifton
  2013-01-03 11:16       ` Kaushik Phatak
  2013-01-02 14:19     ` Tom Tromey
  1 sibling, 1 reply; 10+ messages in thread
From: nick clifton @ 2013-01-02 13:14 UTC (permalink / raw)
  To: Kaushik Phatak; +Cc: Pedro Alves, binutils, gdb-patches, Joel Brobecker

Hi Kaushik,

> 2012-12-28  Kaushik Phatak  <kaushik.phatak@kpitcummins.com>
> opcodes/ChangeLog
> 	* cr16-dis.c (match_opcode,make_instruction: Remove static declaration.
> 	(dwordU,wordU): Moved typedefs to opcode/cr16.h
> 	(cr16_words,cr16_allWords,cr16_currInsn): Added prefix 'cr16_'
>
> bfd/Changelog	
> 	* config.bfd (cr16*-*-uclinux*): New target support.	
>
> include/opcode/ChangeLog
> 	* cr16.h (dwordU,wordU): Moved typedefs from cr16-dis.c
> 	(make_instruction,match_opcode): Added function prototypes.
> 	(cr16_words,cr16_allWords,cr16_currInsn): Declare as extern.


Approved and applied.

Cheers
   Nick


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

* Re: [RFA] New port: CR16: BFD Changes required by the gdb port
  2012-12-28 12:18   ` Kaushik Phatak
  2013-01-02 13:14     ` nick clifton
@ 2013-01-02 14:19     ` Tom Tromey
  1 sibling, 0 replies; 10+ messages in thread
From: Tom Tromey @ 2013-01-02 14:19 UTC (permalink / raw)
  To: Kaushik Phatak; +Cc: Pedro Alves, binutils, gdb-patches, Joel Brobecker

>>>>> "Kaushik" == Kaushik Phatak <Kaushik.Phatak@kpitcummins.com> writes:

Pedro> It'd be nice if all these exported symbols were prefixed, to avoid
Pedro> namespace collisions.

Kaushik> I have added 'cr16_' as a prefix to all these exported symbols. 

Kaushik> 	(make_instruction,match_opcode): Added function prototypes.

What about these?

Kaushik>  /* Current opcode table entry we're disassembling.  */
Kaushik>  const inst *instruction;

I don't know opcodes, but it seems to me that it is best if a library
either makes symbols static or gives them a name prefix.
Otherwise you are going to run into clashes at link time.

Tom

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

* RE: [RFA] New port: CR16: BFD Changes required by the gdb port
  2013-01-02 13:14     ` nick clifton
@ 2013-01-03 11:16       ` Kaushik Phatak
  2013-01-07 15:11         ` nick clifton
  0 siblings, 1 reply; 10+ messages in thread
From: Kaushik Phatak @ 2013-01-03 11:16 UTC (permalink / raw)
  To: nick clifton, Tom Tromey
  Cc: Pedro Alves, binutils, gdb-patches, Joel Brobecker

Hi Nick,
Thanks for the review and commit.

Tom Tromey > make_instruction,match_opcode): Added function prototypes.
> What about these?
Yes, I agree. These functions are used by the tdep files as well, so a prefix
here would be useful.

Please find below a patch that adds similar prefix for make_instruction
and match_opcode. I have re-based this against gdb-7.5.50.20130103.
Also fixed a minor typo (doewsn't -> doesn't)

Please review and let me know if ok.
Thanks,
Kaushik

2013-01-03  Kaushik Phatak  <kaushik.phatak@kpitcummins.com>
include/opcode/ChangeLog
	* cr16.h (cr16_match_opcode,cr16_make_instruction): Added
	prefix 'cr16_'.
	
diff -uprN gdb_src.orig/include/opcode/cr16.h gdb_src/include/opcode/cr16.h
--- gdb_src.orig/include/opcode/cr16.h	2013-01-02 18:43:36.000000000 +0530
+++ gdb_src/include/opcode/cr16.h	2013-01-03 15:53:35.000000000 +0530
@@ -445,7 +445,7 @@ extern ULONGLONG cr16_allWords;
 extern ins cr16_currInsn;
 
 /* Prototypes for function in cr16-dis.c.  */
-extern void make_instruction (void);
-extern int  match_opcode (void);
+extern void cr16_make_instruction (void);
+extern int  cr16_match_opcode (void);
 
 #endif /* _CR16_H_ */
diff -uprN gdb_src.orig/opcodes/cr16-dis.c gdb_src/opcodes/cr16-dis.c
--- gdb_src.orig/opcodes/cr16-dis.c	2013-01-02 18:43:35.000000000 +0530
+++ gdb_src/opcodes/cr16-dis.c	2013-01-03 16:25:42.000000000 +0530
@@ -315,10 +315,10 @@ build_mask (void)
 /* Search for a matching opcode. Return 1 for success, 0 for failure.  */
 
 int
-match_opcode (void)
+cr16_match_opcode (void)
 {
   unsigned long mask;
-  /* The instruction 'constant' opcode doewsn't exceed 32 bits.  */
+  /* The instruction 'constant' opcode doesn't exceed 32 bits.  */
   unsigned long doubleWord = (cr16_words[1]
 			     + (cr16_words[0] << 16)) & 0xffffffff;
 
@@ -743,7 +743,7 @@ print_arguments (ins *currentInsn, bfd_v
 /* Build the instruction's arguments.  */
 
 void
-make_instruction (void)
+cr16_make_instruction (void)
 {
   int i;
   unsigned int shift;
@@ -813,7 +813,7 @@ print_insn_cr16 (bfd_vma memaddr, struct
   /* Retrieve the encoding from current memory location.  */
   get_words_at_PC (memaddr, info);
   /* Find a matching opcode in table.  */
-  is_decoded = match_opcode ();
+  is_decoded = cr16_match_opcode ();
   /* If found, print the instruction's mnemonic and arguments.  */
   if (is_decoded > 0 && (cr16_words[0] << 16 || cr16_words[1]) != 0)
     {
@@ -825,7 +825,7 @@ print_insn_cr16 (bfd_vma memaddr, struct
       if (((cr16_currInsn.nargs = get_number_of_operands ()) != 0)
 	  && ! (IS_INSN_MNEMONIC ("b")))
         info->fprintf_func (info->stream, "\t");
-      make_instruction ();
+      cr16_make_instruction ();
       /* For push/pop/pushrtn with RA instructions.  */
       if ((INST_HAS_REG_LIST) && ((cr16_words[0] >> 7) & 0x1))
         cr16_currInsn.nargs +=1;


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

* Re: [RFA] New port: CR16: BFD Changes required by the gdb port
  2013-01-03 11:16       ` Kaushik Phatak
@ 2013-01-07 15:11         ` nick clifton
  2013-01-08 11:24           ` Kaushik Phatak
  0 siblings, 1 reply; 10+ messages in thread
From: nick clifton @ 2013-01-07 15:11 UTC (permalink / raw)
  To: Kaushik Phatak
  Cc: Tom Tromey, Pedro Alves, binutils, gdb-patches, Joel Brobecker

Hi Kaushik,

> Please find below a patch that adds similar prefix for make_instruction
> and match_opcode. I have re-based this against gdb-7.5.50.20130103.
> Also fixed a minor typo (doewsn't -> doesn't)

Thanks - I have applied your patch along with these changelog entries.

Cheers
   Nick

opcodes/ChangeLog
2013-01-07  Kaushik Phatak  <kaushik.phatak@kpitcummins.com>

	* cr16-dis.c (make_instruction): Rename to cr16_make_instruction.
	(match_opcode): Rename to cr16_match_opcode.

include/opcodes/ChangeLog
2013-01-07  Kaushik Phatak  <kaushik.phatak@kpitcummins.com>

	* cr16.h (make_instruction): Rename to cr16_make_instruction.
	(match_opcode): Rename to cr16_match_opcode.

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

* RE: [RFA] New port: CR16: BFD Changes required by the gdb port
  2013-01-07 15:11         ` nick clifton
@ 2013-01-08 11:24           ` Kaushik Phatak
  2013-01-08 17:54             ` Pedro Alves
  0 siblings, 1 reply; 10+ messages in thread
From: Kaushik Phatak @ 2013-01-08 11:24 UTC (permalink / raw)
  To: nick clifton
  Cc: Tom Tromey, Pedro Alves, binutils, gdb-patches, Joel Brobecker

Hi Nick,
Thanks for applying these changes with appropriate Changelogs.

I noticed that the entries for cr16 were missing in the latest gdb snapshot
in configure.ac and configure.

  cr16-*-*)
    noconfigdirs="$noconfigdirs gdb"
    ;;
This entry is present in the 7.5 release version of gdb but not
in the latest snapshot, gdb-7.5.50.20130108

How is this controlled, in gcc or here? Could you please throw some light on this.

Please let me know if I need to submit any patch for this as couple of hunks
from my gdb patch are failing due to this.

Thanks,
Kaushik


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

* Re: [RFA] New port: CR16: BFD Changes required by the gdb port
  2013-01-08 11:24           ` Kaushik Phatak
@ 2013-01-08 17:54             ` Pedro Alves
  2013-01-15  9:24               ` Kaushik Phatak
  0 siblings, 1 reply; 10+ messages in thread
From: Pedro Alves @ 2013-01-08 17:54 UTC (permalink / raw)
  To: Kaushik Phatak
  Cc: nick clifton, Tom Tromey, binutils, gdb-patches, Joel Brobecker

On 01/08/2013 11:24 AM, Kaushik Phatak wrote:
> Hi Nick,
> Thanks for applying these changes with appropriate Changelogs.
> 
> I noticed that the entries for cr16 were missing in the latest gdb snapshot
> in configure.ac and configure.
> 
>   cr16-*-*)
>     noconfigdirs="$noconfigdirs gdb"
>     ;;
> This entry is present in the 7.5 release version of gdb but not
> in the latest snapshot, gdb-7.5.50.20130108
> 
> How is this controlled, in gcc or here? Could you please throw some light on this.

On gdb's git mirror, I see:

commit ce3c5eda0b8d664790bc633a1013193a3289dff0
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Sun Aug 26 14:34:38 2012 +0000

    Sync toplevel files with GCC tree

...
-  cr16-*-*)
-    noconfigdirs="$noconfigdirs gdb"
-    ;;
   d10v-*-*)
     noconfigdirs="$noconfigdirs target-libgloss"
     ;;
@@ -924,7 +939,8 @@ case "${target}" in
     noconfigdirs="$noconfigdirs libgui itcl ld"
     ;;
   ia64*-*-*vms*)
-    noconfigdirs="$noconfigdirs libgui itcl"
+    # No ld support yet.
+    noconfigdirs="$noconfigdirs libgui itcl ld"
     ;;
   i[[3456789]]86-w64-mingw*)
     ;;
@@ -1069,16 +1085,13 @@ case "${host}" in
   *-mingw*)
     host_makefile_frag="config/mh-mingw"
     ;;
-  *-interix*)
-    host_makefile_frag="config/mh-interix"
-    ;;
   hppa*-hp-hpux10*)
     host_makefile_frag="config/mh-pa-hpux10"
     ;;
   hppa*-hp-hpux*)
     host_makefile_frag="config/mh-pa"
     ;;
-  hppa*-*)
+  hppa*-*)
     host_makefile_frag="config/mh-pa"
     ;;

Dunno why these were removed with that merge.  The
ChangeLog entries brought in don't seen to
mention these changes.  Maybe it was a merge error
where local binutils changes were lost?

> Please let me know if I need to submit any patch for this as couple of hunks
> from my gdb patch are failing due to this.

Please always base the work you submit against the current
development mainline.  For GDB, that is:

 http://sourceware.org/gdb/current/

-- 
Pedro Alves

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

* RE: [RFA] New port: CR16: BFD Changes required by the gdb port
  2013-01-08 17:54             ` Pedro Alves
@ 2013-01-15  9:24               ` Kaushik Phatak
  0 siblings, 0 replies; 10+ messages in thread
From: Kaushik Phatak @ 2013-01-15  9:24 UTC (permalink / raw)
  To: Pedro Alves; +Cc: binutils, gdb-patches, Joel Brobecker, gcc-patches

Hi Pedro, 

>> -  cr16-*-*)
>> -    noconfigdirs="$noconfigdirs gdb"
>> -    ;;
>> Dunno why these were removed with that merge.  The
>> ChangeLog entries brought in don't seen to mention these changes.

Thanks for looking this up.

The below patch includes these above entries into configure.ac and 
configure(regenerated). Not sure if this should be submitted to gcc-patches, 
adding them in cc. 

Additionally, I have tried to answer queries related to my gdbserver port here,
http://sourceware.org/ml/gdb-patches/2012-12/msg00832.html

Let me know if you have any comments on the same.

Thanks,
Kaushik

2013-01-15 Kaushik Phatak  <kaushik.phatak@kpitcummins.com>

	* configure.ac (cr16-*-*): Adding cr16 target.
	* configure (cr16-*-*): Regenerate.

Index: configure
===================================================================
RCS file: /cvs/src/src/configure,v
retrieving revision 1.440
diff -u -a -r1.440 configure
--- configure	16 Dec 2012 07:10:07 -0000	1.440
+++ configure	15 Jan 2013 07:30:06 -0000
@@ -3600,6 +3600,9 @@
   tic54x-*-*)
     noconfigdirs="$noconfigdirs target-libgloss gdb"
     ;;
+  cr16-*-*)
+    noconfigdirs="$noconfigdirs target-libgloss"
+    ;;
   d10v-*-*)
     noconfigdirs="$noconfigdirs target-libgloss"
     ;;
Index: configure.ac
===================================================================
RCS file: /cvs/src/src/configure.ac,v
retrieving revision 1.184
diff -u -a -r1.184 configure.ac
--- configure.ac	16 Dec 2012 07:10:07 -0000	1.184
+++ configure.ac	15 Jan 2013 07:30:06 -0000
@@ -939,6 +939,9 @@
   tic54x-*-*)
     noconfigdirs="$noconfigdirs target-libgloss gdb"
     ;;
+  cr16-*-*)
+    noconfigdirs="$noconfigdirs target-libgloss"
+    ;;
   d10v-*-*)
     noconfigdirs="$noconfigdirs target-libgloss"
     ;;	

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

end of thread, other threads:[~2013-01-15  9:24 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-26  7:04 [RFA] New port: CR16: BFD Changes required by the gdb port Kaushik Phatak
2012-12-14 18:52 ` Pedro Alves
2012-12-28 12:18   ` Kaushik Phatak
2013-01-02 13:14     ` nick clifton
2013-01-03 11:16       ` Kaushik Phatak
2013-01-07 15:11         ` nick clifton
2013-01-08 11:24           ` Kaushik Phatak
2013-01-08 17:54             ` Pedro Alves
2013-01-15  9:24               ` Kaushik Phatak
2013-01-02 14:19     ` Tom Tromey

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