RE: [RFA] New port: CR16: BFD Changes required by the gdb port

Kaushik Phatak
2013-01-03T11:16:31Z

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;