Subject: gdb disassembler problem (fixed)
To: None <mrg@eterna.com.au>
From: Gordon W. Ross <gwr@mc.com>
List: port-sparc
Date: 11/12/1997 12:38:37
OK, it was not a V6 vs V8 problem, but a missing initialization
in the stock gdb-4.16 sources.  I've integrated a fix from the
latest GDB snapshot.  Pullup request done; change below.

Gordon



*** src/gnu/dist/gdb/printcmd.c.orig	Thu Sep 25 07:13:03 1997
--- src/gnu/dist/gdb/printcmd.c	Wed Nov 12 12:20:37 1997
***************
*** 113,118 ****
--- 113,119 ----
  /* Pointer to the target-dependent disassembly function.  */
  
  int (*tm_print_insn) PARAMS ((bfd_vma, disassemble_info *));
+ disassemble_info tm_print_insn_info;
  
  /* Prototypes for local functions.  */
  
***************
*** 2079,2096 ****
       CORE_ADDR memaddr;
       GDB_FILE *stream;
  {
-   disassemble_info info;
- 
-   INIT_DISASSEMBLE_INFO (info, stream, (fprintf_ftype)fprintf_filtered);
-   info.read_memory_func = dis_asm_read_memory;
-   info.memory_error_func = dis_asm_memory_error;
-   info.print_address_func = dis_asm_print_address;
- 
    /* If there's no disassembler, something is very wrong.  */
    if (tm_print_insn == NULL)
      abort ();
  
!   return (*tm_print_insn) (memaddr, &info);
  }
  
  
--- 2080,2094 ----
       CORE_ADDR memaddr;
       GDB_FILE *stream;
  {
    /* If there's no disassembler, something is very wrong.  */
    if (tm_print_insn == NULL)
      abort ();
  
!   if (TARGET_BYTE_ORDER == BIG_ENDIAN)
!     tm_print_insn_info.endian = BFD_ENDIAN_BIG;
!   else
!     tm_print_insn_info.endian = BFD_ENDIAN_LITTLE;
!   return (*tm_print_insn) (memaddr, &tm_print_insn_info);
  }
  
  
***************
*** 2245,2248 ****
--- 2243,2252 ----
    examine_h_type = init_type (TYPE_CODE_INT, 2, 0, "examine_h_type", NULL);
    examine_w_type = init_type (TYPE_CODE_INT, 4, 0, "examine_w_type", NULL);
    examine_g_type = init_type (TYPE_CODE_INT, 8, 0, "examine_g_type", NULL);
+ 
+   INIT_DISASSEMBLE_INFO (tm_print_insn_info, gdb_stdout,
+ 			 (fprintf_ftype)fprintf_filtered);
+   tm_print_insn_info.read_memory_func = dis_asm_read_memory;
+   tm_print_insn_info.memory_error_func = dis_asm_memory_error;
+   tm_print_insn_info.print_address_func = dis_asm_print_address;
  }