Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* debugging sh4 in mi mode
@ 2002-11-08  8:55 Kris Warkentin
  2002-11-08  9:20 ` Elena Zannoni
  0 siblings, 1 reply; 3+ messages in thread
From: Kris Warkentin @ 2002-11-08  8:55 UTC (permalink / raw)
  To: gdb

We were having a problem when debugging sh4 in mi mode with the
"-data-disassemble" command.  It seems that mi_cmd_disassemble() uses the
function pointer tm_print_insn which, for sh, was NULL.  I looked at some
other arches and they seem to set tm_print_insn in their
_initialize_<arch>_tdep() in <arch>-tdep.c so that is what I did to solve
our problem.  Is this the proper way to do it?

cheers,

Kris

Index: sh-tdep.c
===================================================================
RCS file: /product/tools/gdb/gdb/sh-tdep.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -c -r1.8 -r1.9
*** sh-tdep.c   17 Sep 2002 18:31:22 -0000      1.8
--- sh-tdep.c   8 Nov 2002 16:33:39 -0000       1.9
***************
*** 2207,2211 ****
--- 2207,2214 ----

    register_gdbarch_init (bfd_arch_sh, sh_gdbarch_init);

+   if(!tm_print_insn)
+         tm_print_insn = gdb_print_insn_sh;
+
    add_com ("regs", class_vars, sh_show_regs_command, "Print all
registers");
  }


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

* Re: debugging sh4 in mi mode
  2002-11-08  8:55 debugging sh4 in mi mode Kris Warkentin
@ 2002-11-08  9:20 ` Elena Zannoni
  2002-11-08  9:31   ` Kris Warkentin
  0 siblings, 1 reply; 3+ messages in thread
From: Elena Zannoni @ 2002-11-08  9:20 UTC (permalink / raw)
  To: Kris Warkentin; +Cc: gdb

Kris Warkentin writes:
 > We were having a problem when debugging sh4 in mi mode with the
 > "-data-disassemble" command.  It seems that mi_cmd_disassemble() uses the
 > function pointer tm_print_insn which, for sh, was NULL.  I looked at some
 > other arches and they seem to set tm_print_insn in their
 > _initialize_<arch>_tdep() in <arch>-tdep.c so that is what I did to solve
 > our problem.  Is this the proper way to do it?
 > 


Are you working with an older version of gdb? This should be fixed in
current CVS. Right now the disassembler functions use 
      ui_file_rewind (stb->stream);
      pc += TARGET_PRINT_INSN (pc, di);
      ui_out_field_stream (uiout, "inst", stb);

TARGET_PRINT_INSN is wired into the multiarch machinery, and it will call
gdb_print_insns_sh:

  set_gdbarch_print_insn (gdbarch, gdb_print_insn_sh);


Do you have the above lines in your version of gdb?

Elena


 > cheers,
 > 
 > Kris
 > 
 > Index: sh-tdep.c
 > ===================================================================
 > RCS file: /product/tools/gdb/gdb/sh-tdep.c,v
 > retrieving revision 1.8
 > retrieving revision 1.9
 > diff -c -r1.8 -r1.9
 > *** sh-tdep.c   17 Sep 2002 18:31:22 -0000      1.8
 > --- sh-tdep.c   8 Nov 2002 16:33:39 -0000       1.9
 > ***************
 > *** 2207,2211 ****
 > --- 2207,2214 ----
 > 
 >     register_gdbarch_init (bfd_arch_sh, sh_gdbarch_init);
 > 
 > +   if(!tm_print_insn)
 > +         tm_print_insn = gdb_print_insn_sh;
 > +
 >     add_com ("regs", class_vars, sh_show_regs_command, "Print all
 > registers");
 >   }


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

* Re: debugging sh4 in mi mode
  2002-11-08  9:20 ` Elena Zannoni
@ 2002-11-08  9:31   ` Kris Warkentin
  0 siblings, 0 replies; 3+ messages in thread
From: Kris Warkentin @ 2002-11-08  9:31 UTC (permalink / raw)
  To: Elena Zannoni; +Cc: gdb

Yes.  We're stuck on 5.2.1 for now.  I had seen that everything was
multi-arch and wasn't sure if I was fixing it right.  I'll fix it to match
what's on the head branch.

Thanks,

Kris

----- Original Message -----
From: "Elena Zannoni" <ezannoni@redhat.com>
To: "Kris Warkentin" <kewarken@qnx.com>
Cc: <gdb@sources.redhat.com>
Sent: Friday, November 08, 2002 12:16 PM
Subject: Re: debugging sh4 in mi mode


> Kris Warkentin writes:
>  > We were having a problem when debugging sh4 in mi mode with the
>  > "-data-disassemble" command.  It seems that mi_cmd_disassemble() uses
the
>  > function pointer tm_print_insn which, for sh, was NULL.  I looked at
some
>  > other arches and they seem to set tm_print_insn in their
>  > _initialize_<arch>_tdep() in <arch>-tdep.c so that is what I did to
solve
>  > our problem.  Is this the proper way to do it?
>  >
>
>
> Are you working with an older version of gdb? This should be fixed in
> current CVS. Right now the disassembler functions use
>       ui_file_rewind (stb->stream);
>       pc += TARGET_PRINT_INSN (pc, di);
>       ui_out_field_stream (uiout, "inst", stb);
>
> TARGET_PRINT_INSN is wired into the multiarch machinery, and it will call
> gdb_print_insns_sh:
>
>   set_gdbarch_print_insn (gdbarch, gdb_print_insn_sh);
>
>
> Do you have the above lines in your version of gdb?
>
> Elena
>
>
>  > cheers,
>  >
>  > Kris
>  >
>  > Index: sh-tdep.c
>  > ===================================================================
>  > RCS file: /product/tools/gdb/gdb/sh-tdep.c,v
>  > retrieving revision 1.8
>  > retrieving revision 1.9
>  > diff -c -r1.8 -r1.9
>  > *** sh-tdep.c   17 Sep 2002 18:31:22 -0000      1.8
>  > --- sh-tdep.c   8 Nov 2002 16:33:39 -0000       1.9
>  > ***************
>  > *** 2207,2211 ****
>  > --- 2207,2214 ----
>  >
>  >     register_gdbarch_init (bfd_arch_sh, sh_gdbarch_init);
>  >
>  > +   if(!tm_print_insn)
>  > +         tm_print_insn = gdb_print_insn_sh;
>  > +
>  >     add_com ("regs", class_vars, sh_show_regs_command, "Print all
>  > registers");
>  >   }
>


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

end of thread, other threads:[~2002-11-08 17:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-11-08  8:55 debugging sh4 in mi mode Kris Warkentin
2002-11-08  9:20 ` Elena Zannoni
2002-11-08  9:31   ` Kris Warkentin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox